Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
492 B
22 lines
492 B
1 year ago
|
#include "upb_generator/mangle.h"
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
#include "absl/strings/str_replace.h"
|
||
|
#include "absl/strings/string_view.h"
|
||
|
|
||
|
// Generate a mangled C name for a proto object.
|
||
|
static std::string MangleName(absl::string_view name) {
|
||
|
return absl::StrReplaceAll(name, {{"_", "_0"}, {".", "__"}});
|
||
|
}
|
||
|
|
||
|
namespace upb {
|
||
|
namespace generator {
|
||
|
|
||
|
std::string MessageInit(absl::string_view full_name) {
|
||
|
return MangleName(full_name) + "_msg_init";
|
||
|
}
|
||
|
|
||
|
} // namespace generator
|
||
|
} // namespace upb
|