Go to the documentation of this file.
31 #include <google/protobuf/util/internal/utility.h>
38 #include <google/protobuf/stubs/callback.h>
39 #include <google/protobuf/stubs/common.h>
40 #include <google/protobuf/stubs/logging.h>
41 #include <google/protobuf/wrappers.pb.h>
42 #include <google/protobuf/descriptor.pb.h>
43 #include <google/protobuf/descriptor.h>
44 #include <google/protobuf/util/internal/constants.h>
45 #include <google/protobuf/stubs/strutil.h>
46 #include <google/protobuf/stubs/map_util.h>
49 #include <google/protobuf/port_def.inc>
149 if (opt.name() == option_name) {
158 if (
type !=
nullptr) {
159 for (
int i = 0;
i <
type->fields_size(); ++
i) {
161 if (
field.name() == field_name) {
171 if (
type !=
nullptr) {
172 for (
int i = 0;
i <
type->fields_size(); ++
i) {
174 if (
field.json_name() == json_name) {
184 if (
type !=
nullptr) {
185 for (
int i = 0;
i <
type->fields_size(); ++
i) {
198 for (
int i = 0;
i <
enum_type->enumvalue_size(); ++
i) {
200 if (enum_value.name() == enum_name) {
211 for (
int i = 0;
i <
enum_type->enumvalue_size(); ++
i) {
213 if (enum_value.number() ==
value) {
224 for (
int i = 0;
i <
enum_type->enumvalue_size(); ++
i) {
226 std::string enum_name_without_underscore = enum_value.name();
229 enum_name_without_underscore.erase(
230 std::remove(enum_name_without_underscore.begin(),
231 enum_name_without_underscore.end(),
'_'),
232 enum_name_without_underscore.end());
235 it != enum_name_without_underscore.end(); ++
it) {
239 if (enum_name_without_underscore == enum_name) {
249 std::transform(input_string.begin(), input_string.end(), input_string.begin(),
255 bool capitalize_next =
false;
258 bool first_word =
true;
262 for (
size_t i = 0;
i <
input.size(); ++
i, was_cap = is_cap) {
264 if (
input[i] ==
'_') {
265 capitalize_next =
true;
266 if (!
result.empty()) first_word =
false;
268 }
else if (first_word) {
273 if (!
result.empty() && is_cap &&
282 }
else if (capitalize_next) {
283 capitalize_next =
false;
299 bool was_not_underscore =
false;
300 bool was_not_cap =
false;
304 for (
size_t i = 0;
i <
input.size(); ++
i) {
315 if (was_not_underscore &&
317 (i + 1 <
input.size() &&
323 was_not_underscore =
true;
327 was_not_underscore =
input[
i] !=
'_';
337 "google.protobuf.Timestamp",
"google.protobuf.Duration",
338 "google.protobuf.DoubleValue",
"google.protobuf.FloatValue",
339 "google.protobuf.Int64Value",
"google.protobuf.UInt64Value",
340 "google.protobuf.Int32Value",
"google.protobuf.UInt32Value",
341 "google.protobuf.BoolValue",
"google.protobuf.StringValue",
342 "google.protobuf.BytesValue",
"google.protobuf.FieldMask"};
361 return bool_string ==
"true" || bool_string ==
"false" ||
362 bool_string ==
"1" || bool_string ==
"0";
367 return field.cardinality() == google::protobuf::Field::CARDINALITY_REPEATED &&
370 "google.protobuf.MessageOptions.map_entry",
379 "google.protobuf.MessageOptions.message_set_wire_format",
false);
383 if (
value == std::numeric_limits<double>::infinity())
return "Infinity";
384 if (
value == -std::numeric_limits<double>::infinity())
return "-Infinity";
409 *
value =
static_cast<float>(double_value);
const char * well_known_types_name_array_[]
const Descriptor::ReservedRange value
const google::protobuf::Field * FindJsonFieldInTypeOrNull(const google::protobuf::Type *type, StringPiece json_name)
std::string ToCamelCase(const StringPiece input)
bool IsWellKnownType(const std::string &type_name)
bool ContainsKey(const Collection &collection, const Key &key)
const StringPiece GetTypeWithoutUrl(StringPiece type_url)
struct DoubleValue DoubleValue
bool safe_strtod(const char *str, double *value)
bool SafeStrToFloat(StringPiece str, float *value)
char ascii_tolower(char c)
std::string ToSnakeCase(StringPiece input)
const typedef MCPhysReg * iterator
int64 GetInt64FromAny(const google::protobuf::Any &any)
#define T(upbtypeconst, upbtype, ctype, default_value)
string StrCat(const AlphaNum &a, const AlphaNum &b)
void OnShutdown(void(*func)())
bool ascii_isupper(char c)
void call_once(absl::once_flag &flag, Callable &&fn, Args &&... args)
bool IsMessageSetWireFormat(const google::protobuf::Type &type)
const std::string GetFullTypeWithUrl(StringPiece simple_type)
int64 GetInt64OptionOrDefault(const RepeatedPtrField< google::protobuf::Option > &options, const std::string &option_name, int64 default_value)
static const int64 kTypeUrlSize
std::set< std::string > * well_known_types_
void InitWellKnownTypes()
string SimpleFtoa(float value)
double GetDoubleFromAny(const google::protobuf::Any &any)
bool IsMap(const google::protobuf::Field &field, const google::protobuf::Type &type)
const google::protobuf::Option * FindOptionOrNull(const RepeatedPtrField< google::protobuf::Option > &options, const std::string &option_name)
const google::protobuf::EnumValue * FindEnumValueByNumberOrNull(const google::protobuf::Enum *enum_type, int32 value)
double GetDoubleOptionOrDefault(const RepeatedPtrField< google::protobuf::Option > &options, const std::string &option_name, double default_value)
std::string EnumValueNameToLowerCamelCase(const StringPiece input)
const char kTypeServiceBaseUrl[]
std::string GetStringFromAny(const google::protobuf::Any &any)
std::string DoubleAsString(double value)
const google::protobuf::EnumValue * FindEnumValueByNameWithoutUnderscoreOrNull(const google::protobuf::Enum *enum_type, StringPiece enum_name)
const google::protobuf::Field * FindFieldInTypeByNumberOrNull(const google::protobuf::Type *type, int32 number)
string SimpleDtoa(double value)
const FieldDescriptor * field
std::string GetStringOptionOrDefault(const RepeatedPtrField< google::protobuf::Option > &options, const std::string &option_name, const std::string &default_value)
const google::protobuf::EnumValue * FindEnumValueByNameOrNull(const google::protobuf::Enum *enum_type, StringPiece enum_name)
void ParseFromAny(const std::string &data, T *result)
bool ascii_islower(char c)
bool GetBoolOptionOrDefault(const RepeatedPtrField< google::protobuf::Option > &options, const std::string &option_name, bool default_value)
#define GOOGLE_ARRAYSIZE(a)
char ascii_toupper(char c)
struct BoolValue BoolValue
PROTOBUF_NAMESPACE_ID::internal::once_flag well_known_types_init_
struct StringValue StringValue
const google::protobuf::Field * FindFieldInTypeOrNull(const google::protobuf::Type *type, StringPiece field_name)
bool GetBoolFromAny(const google::protobuf::Any &any)
std::string FloatAsString(float value)
void DeleteWellKnownTypes()
bool IsValidBoolString(const std::string &bool_string)
static const char * type_name(int type)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:49