protobuf/src/google/protobuf/util/internal/datapiece.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #include <google/protobuf/util/internal/datapiece.h>
32 
33 #include <cmath>
34 #include <cstdint>
35 #include <limits>
36 
37 #include <google/protobuf/struct.pb.h>
38 #include <google/protobuf/type.pb.h>
39 #include <google/protobuf/descriptor.h>
40 #include <google/protobuf/util/internal/utility.h>
41 #include <google/protobuf/stubs/status.h>
42 #include <google/protobuf/stubs/strutil.h>
43 #include <google/protobuf/stubs/mathutil.h>
44 
45 namespace google {
46 namespace protobuf {
47 namespace util {
48 namespace converter {
49 
50 using util::Status;
51 
52 namespace {
53 
54 template <typename To, typename From>
55 util::StatusOr<To> ValidateNumberConversion(To after, From before) {
56  if (after == before &&
57  MathUtil::Sign<From>(before) == MathUtil::Sign<To>(after)) {
58  return after;
59  } else {
64  }
65 }
66 
67 // For general conversion between
68 // int32, int64, uint32, uint64, double and float
69 // except conversion between double and float.
70 template <typename To, typename From>
71 util::StatusOr<To> NumberConvertAndCheck(From before) {
73 
74  To after = static_cast<To>(before);
75  return ValidateNumberConversion(after, before);
76 }
77 
78 // For conversion to integer types (int32, int64, uint32, uint64) from floating
79 // point types (double, float) only.
80 template <typename To, typename From>
81 util::StatusOr<To> FloatingPointToIntConvertAndCheck(From before) {
83 
84  To after = static_cast<To>(before);
85  return ValidateNumberConversion(after, before);
86 }
87 
88 // For conversion between double and float only.
89 util::StatusOr<double> FloatToDouble(float before) {
90  // Casting float to double should just work as double has more precision
91  // than float.
92  return static_cast<double>(before);
93 }
94 
95 util::StatusOr<float> DoubleToFloat(double before) {
96  if (std::isnan(before)) {
97  return std::numeric_limits<float>::quiet_NaN();
98  } else if (!std::isfinite(before)) {
99  // Converting a double +inf/-inf to float should just work.
100  return static_cast<float>(before);
101  } else if (before > std::numeric_limits<float>::max() ||
103  // Double value outside of the range of float.
105  } else {
106  return static_cast<float>(before);
107  }
108 }
109 
110 } // namespace
111 
112 util::StatusOr<int32_t> DataPiece::ToInt32() const {
113  if (type_ == TYPE_STRING)
114  return StringToNumber<int32_t>(safe_strto32);
115 
116  if (type_ == TYPE_DOUBLE)
117  return FloatingPointToIntConvertAndCheck<int32_t, double>(double_);
118 
119  if (type_ == TYPE_FLOAT)
120  return FloatingPointToIntConvertAndCheck<int32_t, float>(float_);
121 
122  return GenericConvert<int32_t>();
123 }
124 
125 util::StatusOr<uint32_t> DataPiece::ToUint32() const {
126  if (type_ == TYPE_STRING)
127  return StringToNumber<uint32_t>(safe_strtou32);
128 
129  if (type_ == TYPE_DOUBLE)
130  return FloatingPointToIntConvertAndCheck<uint32_t, double>(double_);
131 
132  if (type_ == TYPE_FLOAT)
133  return FloatingPointToIntConvertAndCheck<uint32_t, float>(float_);
134 
135  return GenericConvert<uint32_t>();
136 }
137 
138 util::StatusOr<int64_t> DataPiece::ToInt64() const {
139  if (type_ == TYPE_STRING)
140  return StringToNumber<int64_t>(safe_strto64);
141 
142  if (type_ == TYPE_DOUBLE)
143  return FloatingPointToIntConvertAndCheck<int64_t, double>(double_);
144 
145  if (type_ == TYPE_FLOAT)
146  return FloatingPointToIntConvertAndCheck<int64_t, float>(float_);
147 
148  return GenericConvert<int64_t>();
149 }
150 
151 util::StatusOr<uint64_t> DataPiece::ToUint64() const {
152  if (type_ == TYPE_STRING)
153  return StringToNumber<uint64_t>(safe_strtou64);
154 
155  if (type_ == TYPE_DOUBLE)
156  return FloatingPointToIntConvertAndCheck<uint64_t, double>(double_);
157 
158  if (type_ == TYPE_FLOAT)
159  return FloatingPointToIntConvertAndCheck<uint64_t, float>(float_);
160 
161  return GenericConvert<uint64_t>();
162 }
163 
164 util::StatusOr<double> DataPiece::ToDouble() const {
165  if (type_ == TYPE_FLOAT) {
166  return FloatToDouble(float_);
167  }
168  if (type_ == TYPE_STRING) {
169  if (str_ == "Infinity") return std::numeric_limits<double>::infinity();
170  if (str_ == "-Infinity") return -std::numeric_limits<double>::infinity();
171  if (str_ == "NaN") return std::numeric_limits<double>::quiet_NaN();
172  util::StatusOr<double> value = StringToNumber<double>(safe_strtod);
173  if (value.ok() && !std::isfinite(value.value())) {
174  // safe_strtod converts out-of-range values to +inf/-inf, but we want
175  // to report them as errors.
176  return util::InvalidArgumentError(StrCat("\"", str_, "\""));
177  } else {
178  return value;
179  }
180  }
181  return GenericConvert<double>();
182 }
183 
184 util::StatusOr<float> DataPiece::ToFloat() const {
185  if (type_ == TYPE_DOUBLE) {
186  return DoubleToFloat(double_);
187  }
188  if (type_ == TYPE_STRING) {
189  if (str_ == "Infinity") return std::numeric_limits<float>::infinity();
190  if (str_ == "-Infinity") return -std::numeric_limits<float>::infinity();
191  if (str_ == "NaN") return std::numeric_limits<float>::quiet_NaN();
192  // SafeStrToFloat() is used instead of safe_strtof() because the later
193  // does not fail on inputs like SimpleDtoa(DBL_MAX).
194  return StringToNumber<float>(SafeStrToFloat);
195  }
196  return GenericConvert<float>();
197 }
198 
199 util::StatusOr<bool> DataPiece::ToBool() const {
200  switch (type_) {
201  case TYPE_BOOL:
202  return bool_;
203  case TYPE_STRING:
204  return StringToNumber<bool>(safe_strtob);
205  default:
207  ValueAsStringOrDefault("Wrong type. Cannot convert to Bool."));
208  }
209 }
210 
211 util::StatusOr<std::string> DataPiece::ToString() const {
212  switch (type_) {
213  case TYPE_STRING:
214  return std::string(str_);
215  case TYPE_BYTES: {
216  std::string base64;
217  Base64Escape(str_, &base64);
218  return base64;
219  }
220  default:
222  ValueAsStringOrDefault("Cannot convert to string."));
223  }
224 }
225 
227  StringPiece default_string) const {
228  switch (type_) {
229  case TYPE_INT32:
230  return StrCat(i32_);
231  case TYPE_INT64:
232  return StrCat(i64_);
233  case TYPE_UINT32:
234  return StrCat(u32_);
235  case TYPE_UINT64:
236  return StrCat(u64_);
237  case TYPE_DOUBLE:
238  return DoubleAsString(double_);
239  case TYPE_FLOAT:
240  return FloatAsString(float_);
241  case TYPE_BOOL:
242  return SimpleBtoa(bool_);
243  case TYPE_STRING:
244  return StrCat("\"", str_.ToString(), "\"");
245  case TYPE_BYTES: {
246  std::string base64;
247  WebSafeBase64Escape(str_, &base64);
248  return StrCat("\"", base64, "\"");
249  }
250  case TYPE_NULL:
251  return "null";
252  default:
253  return std::string(default_string);
254  }
255 }
256 
257 util::StatusOr<std::string> DataPiece::ToBytes() const {
258  if (type_ == TYPE_BYTES) return str_.ToString();
259  if (type_ == TYPE_STRING) {
260  std::string decoded;
261  if (!DecodeBase64(str_, &decoded)) {
263  ValueAsStringOrDefault("Invalid data in input."));
264  }
265  return decoded;
266  } else {
268  "Wrong type. Only String or Bytes can be converted to Bytes."));
269  }
270 }
271 
272 util::StatusOr<int> DataPiece::ToEnum(const google::protobuf::Enum* enum_type,
273  bool use_lower_camel_for_enums,
274  bool case_insensitive_enum_parsing,
275  bool ignore_unknown_enum_values,
276  bool* is_unknown_enum_value) const {
278 
279  if (type_ == TYPE_STRING) {
280  // First try the given value as a name.
281  std::string enum_name = std::string(str_);
284  if (value != nullptr) return value->number();
285 
286  // Check if int version of enum is sent as string.
287  util::StatusOr<int32_t> int_value = ToInt32();
288  if (int_value.ok()) {
289  if (const google::protobuf::EnumValue* enum_value =
290  FindEnumValueByNumberOrNull(enum_type, int_value.value())) {
291  return enum_value->number();
292  }
293  }
294 
295  // Next try a normalized name.
296  bool should_normalize_enum =
297  case_insensitive_enum_parsing || use_lower_camel_for_enums;
298  if (should_normalize_enum) {
299  for (std::string::iterator it = enum_name.begin(); it != enum_name.end();
300  ++it) {
301  *it = *it == '-' ? '_' : ascii_toupper(*it);
302  }
304  if (value != nullptr) return value->number();
305  }
306 
307  // If use_lower_camel_for_enums is true try with enum name without
308  // underscore. This will also accept camel case names as the enum_name has
309  // been normalized before.
310  if (use_lower_camel_for_enums) {
312  if (value != nullptr) return value->number();
313  }
314 
315  // If ignore_unknown_enum_values is true an unknown enum value is ignored.
316  if (ignore_unknown_enum_values) {
317  *is_unknown_enum_value = true;
318  if (enum_type->enumvalue_size() > 0) {
319  return enum_type->enumvalue(0).number();
320  }
321  }
322  } else {
323  // We don't need to check whether the value is actually declared in the
324  // enum because we preserve unknown enum values as well.
325  return ToInt32();
326  }
328  ValueAsStringOrDefault("Cannot find enum with given value."));
329 }
330 
331 template <typename To>
333  switch (type_) {
334  case TYPE_INT32:
335  return NumberConvertAndCheck<To, int32_t>(i32_);
336  case TYPE_INT64:
337  return NumberConvertAndCheck<To, int64_t>(i64_);
338  case TYPE_UINT32:
339  return NumberConvertAndCheck<To, uint32_t>(u32_);
340  case TYPE_UINT64:
341  return NumberConvertAndCheck<To, uint64_t>(u64_);
342  case TYPE_DOUBLE:
343  return NumberConvertAndCheck<To, double>(double_);
344  case TYPE_FLOAT:
345  return NumberConvertAndCheck<To, float>(float_);
346  default: // TYPE_ENUM, TYPE_STRING, TYPE_CORD, TYPE_BOOL
348  "Wrong type. Bool, Enum, String and Cord not supported in "
349  "GenericConvert."));
350  }
351 }
352 
353 template <typename To>
355  To*)) const {
356  if (str_.size() > 0 && (str_[0] == ' ' || str_[str_.size() - 1] == ' ')) {
357  return util::InvalidArgumentError(StrCat("\"", str_, "\""));
358  }
359  To result;
360  if (func(str_, &result)) return result;
362  StrCat("\"", std::string(str_), "\""));
363 }
364 
366  // Try web-safe decode first, if it fails, try the non-web-safe decode.
367  if (WebSafeBase64Unescape(src, dest)) {
369  // In strict mode, check if the escaped version gives us the same value as
370  // unescaped.
371  std::string encoded;
372  // WebSafeBase64Escape does no padding by default.
373  WebSafeBase64Escape(*dest, &encoded);
374  // Remove trailing padding '=' characters before comparison.
375  StringPiece src_no_padding = StringPiece(src).substr(
376  0, HasSuffixString(src, "=") ? src.find_last_not_of('=') + 1
377  : src.length());
378  return encoded == src_no_padding;
379  }
380  return true;
381  }
382 
383  if (Base64Unescape(src, dest)) {
385  std::string encoded;
386  Base64Escape(reinterpret_cast<const unsigned char*>(dest->data()),
387  dest->length(), &encoded, false);
388  StringPiece src_no_padding = StringPiece(src).substr(
389  0, HasSuffixString(src, "=") ? src.find_last_not_of('=') + 1
390  : src.length());
391  return encoded == src_no_padding;
392  }
393  return true;
394  }
395 
396  return false;
397 }
398 
399 void DataPiece::InternalCopy(const DataPiece& other) {
400  type_ = other.type_;
401  use_strict_base64_decoding_ = other.use_strict_base64_decoding_;
402  switch (type_) {
403  case TYPE_INT32:
404  case TYPE_INT64:
405  case TYPE_UINT32:
406  case TYPE_UINT64:
407  case TYPE_DOUBLE:
408  case TYPE_FLOAT:
409  case TYPE_BOOL:
410  case TYPE_ENUM:
411  case TYPE_NULL:
412  case TYPE_BYTES:
413  case TYPE_STRING: {
414  str_ = other.str_;
415  break;
416  }
417  }
418 }
419 
420 } // namespace converter
421 } // namespace util
422 } // namespace protobuf
423 } // namespace google
absl::InvalidArgumentError
Status InvalidArgumentError(absl::string_view message)
Definition: third_party/abseil-cpp/absl/status/status.cc:351
google::protobuf::util::converter::DataPiece::ToBool
util::StatusOr< bool > ToBool() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:203
NULL_VALUE
@ NULL_VALUE
Definition: bloaty/third_party/protobuf/src/google/protobuf/struct.pb.h:84
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
google::protobuf::util::converter::DataPiece::ToUint32
util::StatusOr< uint32 > ToUint32() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:130
google::protobuf::WebSafeBase64Unescape
int WebSafeBase64Unescape(const char *src, int szsrc, char *dest, int szdest)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2063
google::protobuf::util::converter::DataPiece::TYPE_UINT32
@ TYPE_UINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:66
regen-readme.it
it
Definition: regen-readme.py:15
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::StringPiece::length
stringpiece_ssize_type length() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:249
google::protobuf::Enum
google::protobuf::safe_strto32
bool safe_strto32(const string &str, int32 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1366
tests.google.protobuf.internal.message_test.isnan
def isnan(val)
Definition: bloaty/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py:65
google::protobuf::util::converter::DataPiece::u64_
uint64 u64_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:202
google::protobuf::util::converter::DataPiece::TYPE_FLOAT
@ TYPE_FLOAT
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:69
google::protobuf::util::converter::DataPiece::u32_
uint32 u32_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:201
google::protobuf::safe_strtob
bool safe_strtob(StringPiece str, bool *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1326
google::protobuf::util::converter::DataPiece::TYPE_STRING
@ TYPE_STRING
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:72
google::protobuf::util::converter::DataPiece::TYPE_ENUM
@ TYPE_ENUM
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:71
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf::safe_strtod
bool safe_strtod(const char *str, double *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1354
google::protobuf::safe_strto64
bool safe_strto64(const string &str, int64 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1374
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
google::protobuf::util::converter::DataPiece::float_
float float_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:204
make_cmakelists.converter
converter
Definition: make_cmakelists.py:317
google::protobuf::util::converter::DataPiece::TYPE_NULL
@ TYPE_NULL
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:74
google::protobuf::util::converter::SafeStrToFloat
bool SafeStrToFloat(StringPiece str, float *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/utility.cc:391
default_string
static upb_StringView default_string(upb_ToProto_Context *ctx, const upb_FieldDef *f)
Definition: def_to_proto.c:124
google::protobuf::StringPiece::substr
StringPiece substr(size_type pos, size_type n=npos) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc:261
google::protobuf::SimpleBtoa
string SimpleBtoa(bool value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:525
iterator
const typedef MCPhysReg * iterator
Definition: MCRegisterInfo.h:27
google::protobuf::safe_strtou32
bool safe_strtou32(const string &str, uint32 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1370
google::protobuf::util::converter::DataPiece::ToFloat
util::StatusOr< float > ToFloat() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:188
google::protobuf::EnumValue
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1482
before
IntBeforeRegisterTypedTestSuiteP before
Definition: googletest/googletest/test/gtest-typed-test_test.cc:376
google::protobuf::util::converter::DataPiece::DecodeBase64
bool DecodeBase64(StringPiece src, std::string *dest) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:365
google::protobuf::util::converter::DataPiece::ToInt64
util::StatusOr< int64 > ToInt64() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:143
google::protobuf::Base64Unescape
bool Base64Unescape(StringPiece src, string *dest)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2092
google::protobuf::util::converter::DataPiece::ValueAsStringOrDefault
std::string ValueAsStringOrDefault(StringPiece default_string) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:230
google::protobuf::util::converter::DataPiece::TYPE_DOUBLE
@ TYPE_DOUBLE
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:68
google::protobuf::util::converter::DataPiece::ToEnum
util::StatusOr< int > ToEnum(const google::protobuf::Enum *enum_type, bool use_lower_camel_for_enums, bool case_insensitive_enum_parsing, bool ignore_unknown_enum_values, bool *is_unknown_enum_value) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:275
google::protobuf::util::converter::DataPiece::bool_
bool bool_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:205
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
google::protobuf::util::converter::DataPiece::i32_
int32 i32_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:199
google::protobuf::StringPiece
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:180
google::protobuf::util::converter::DataPiece::type_
Type type_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:193
google::protobuf::util::converter::DataPiece::ToDouble
util::StatusOr< double > ToDouble() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:168
google::protobuf::util::converter::DataPiece::ToUint64
util::StatusOr< uint64 > ToUint64() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:155
google::protobuf::util::converter::DataPiece::InternalCopy
void InternalCopy(const DataPiece &other)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:400
google::protobuf::WebSafeBase64Escape
int WebSafeBase64Escape(const unsigned char *src, int szsrc, char *dest, int szdest, bool do_padding)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2209
google::protobuf::util::converter::DataPiece::ToBytes
util::StatusOr< std::string > ToBytes() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:261
google::protobuf::util::converter::FindEnumValueByNumberOrNull
const google::protobuf::EnumValue * FindEnumValueByNumberOrNull(const google::protobuf::Enum *enum_type, int32 value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/utility.cc:204
google::protobuf.internal::StringPiecePod::ToString
std::string ToString() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:465
google::protobuf::util::converter::DataPiece::GenericConvert
util::StatusOr< To > GenericConvert() const
Definition: protobuf/src/google/protobuf/util/internal/datapiece.cc:332
tests.qps.qps_worker.dest
dest
Definition: qps_worker.py:45
after
IntAfterTypedTestSuiteP after
Definition: googletest/googletest/test/gtest-typed-test_test.cc:375
google::protobuf::util::converter::DataPiece::TYPE_BYTES
@ TYPE_BYTES
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:73
google::protobuf::util::converter::DataPiece::use_strict_base64_decoding_
bool use_strict_base64_decoding_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:210
google::protobuf::util::StatusOr
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/statusor.h:99
value
const char * value
Definition: hpack_parser_table.cc:165
google::protobuf::util::converter::DoubleAsString
std::string DoubleAsString(double value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/utility.cc:378
google::protobuf::util::converter::FindEnumValueByNameWithoutUnderscoreOrNull
const google::protobuf::EnumValue * FindEnumValueByNameWithoutUnderscoreOrNull(const google::protobuf::Enum *enum_type, StringPiece enum_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/utility.cc:217
google::protobuf::util::converter::DataPiece::StringToNumber
util::StatusOr< To > StringToNumber(bool(*func)(StringPiece, To *)) const
Definition: protobuf/src/google/protobuf/util/internal/datapiece.cc:354
func
const EVP_CIPHER *(* func)(void)
Definition: cipher_extra.c:73
google::protobuf::util::converter::FindEnumValueByNameOrNull
const google::protobuf::EnumValue * FindEnumValueByNameOrNull(const google::protobuf::Enum *enum_type, StringPiece enum_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/utility.cc:191
google::protobuf::Base64Escape
int Base64Escape(const unsigned char *src, int szsrc, char *dest, int szdest)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:2206
google::protobuf::util::converter::DataPiece::TYPE_INT64
@ TYPE_INT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:65
google::protobuf::util::converter::DataPiece::TYPE_UINT64
@ TYPE_UINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:67
google::protobuf::util::converter::DataPiece::ToInt32
util::StatusOr< int32 > ToInt32() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:118
google::protobuf::util::converter::DataPiece::i64_
int64 i64_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:200
google::protobuf::ascii_toupper
char ascii_toupper(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:90
google::protobuf::util::converter::DataPiece::ToString
util::StatusOr< std::string > ToString() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.cc:215
grpc::protobuf::util::Status
GRPC_CUSTOM_UTIL_STATUS Status
Definition: include/grpcpp/impl/codegen/config_protobuf.h:93
google::protobuf::StringPiece::find_last_not_of
stringpiece_ssize_type find_last_not_of(StringPiece s, size_type pos=npos) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc:228
google::protobuf::util::converter::DataPiece::TYPE_BOOL
@ TYPE_BOOL
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:70
google::protobuf::util::converter::DataPiece::TYPE_INT32
@ TYPE_INT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:64
google::protobuf::HasSuffixString
bool HasSuffixString(const string &str, const string &suffix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:137
google::protobuf::util::converter::ValueAsString
std::string ValueAsString(T value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/utility.h:178
google::protobuf::util::converter::FloatAsString
std::string FloatAsString(float value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/utility.cc:386
isfinite
#define isfinite
Definition: bloaty/third_party/protobuf/conformance/third_party/jsoncpp/jsoncpp.cpp:4014
google::protobuf.internal::StringPiecePod::size
stringpiece_ssize_type size() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:461
google::protobuf::safe_strtou64
bool safe_strtou64(const string &str, uint64 *value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1378
phone_pb2.enum_type
enum_type
Definition: phone_pb2.py:198
google::protobuf::util::converter::DataPiece::str_
StringPiecePod str_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:206
google::protobuf::util::converter::DataPiece::double_
double double_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h:203
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:08