|
||||
File indexing completed on 2025-01-31 10:12:02
0001 // Protocol Buffers - Google's data interchange format 0002 // Copyright 2008 Google Inc. All rights reserved. 0003 // 0004 // Use of this source code is governed by a BSD-style 0005 // license that can be found in the LICENSE file or at 0006 // https://developers.google.com/open-source/licenses/bsd 0007 0008 // A locale-independent version of strtod(), used to parse floating 0009 // point default values in .proto files, where the decimal separator 0010 // is always a dot. 0011 0012 #ifndef GOOGLE_PROTOBUF_IO_STRTOD_H__ 0013 #define GOOGLE_PROTOBUF_IO_STRTOD_H__ 0014 0015 #include <string> 0016 0017 // Must be included last. 0018 #include "google/protobuf/port_def.inc" 0019 0020 namespace google { 0021 namespace protobuf { 0022 namespace io { 0023 0024 // ---------------------------------------------------------------------- 0025 // SimpleDtoa() 0026 // SimpleFtoa() 0027 // Description: converts a double or float to a string which, if 0028 // passed to NoLocaleStrtod(), will produce the exact same original double 0029 // (except in case of NaN; all NaNs are considered the same value). 0030 // We try to keep the string short but it's not guaranteed to be as 0031 // short as possible. 0032 // 0033 // Return value: string 0034 // ---------------------------------------------------------------------- 0035 PROTOBUF_EXPORT std::string SimpleDtoa(double value); 0036 PROTOBUF_EXPORT std::string SimpleFtoa(float value); 0037 0038 // A locale-independent version of the standard strtod(), which always 0039 // uses a dot as the decimal separator. 0040 PROTOBUF_EXPORT double NoLocaleStrtod(const char* str, char** endptr); 0041 0042 // Casts a double value to a float value. If the value is outside of the 0043 // representable range of float, it will be converted to positive or negative 0044 // infinity. 0045 PROTOBUF_EXPORT float SafeDoubleToFloat(double value); 0046 0047 } // namespace io 0048 } // namespace protobuf 0049 } // namespace google 0050 0051 #include "google/protobuf/port_undef.inc" 0052 0053 #endif // GOOGLE_PROTOBUF_IO_STRTOD_H__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |