Skip to content

Commit f02069d

Browse files
committed
fix: rename fp_to_string to FpToString to match coding style
1 parent 4318e4a commit f02069d

File tree

4 files changed

+188
-188
lines changed

4 files changed

+188
-188
lines changed

include/yaml-cpp/emitter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ inline Emitter& Emitter::WriteStreamable(T value) {
181181
}
182182

183183
if (!special) {
184-
stream << fp_to_string(value, stream.precision());
184+
stream << FpToString(value, stream.precision());
185185
}
186186
m_stream << stream.str();
187187

include/yaml-cpp/fp_to_string.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ namespace fp_formatting {
2626
*
2727
* Example:
2828
* std::array<char, 20> buffer;
29-
* auto ct = convertToChars(buffer.begin(), buffer.end(), 23, 3);
29+
* auto ct = ConvertToChars(buffer.begin(), buffer.end(), 23, 3);
3030
* assert(ct = 3);
3131
* assert(buffer[0] == '0');
3232
* assert(buffer[1] == '2');
3333
* assert(buffer[2] == '3');
3434
*/
35-
inline auto convertToChars(char* begin, char* end, size_t value, int width=1) -> int {
35+
inline auto ConvertToChars(char* begin, char* end, size_t value, int width=1) -> int {
3636
assert(width >= 1);
3737
assert(end >= begin); // end must be after begin
3838
assert(end-begin >= width); // Buffer must be large enough
@@ -62,7 +62,7 @@ inline auto convertToChars(char* begin, char* end, size_t value, int width=1) ->
6262
* converts a value 'v' to a string. Uses dragonbox for formatting.
6363
*/
6464
template <typename T>
65-
auto fp_to_string(T v, int precision = 0) -> std::string {
65+
auto FpToString(T v, int precision = 0) -> std::string {
6666
// assert(precision > 0);
6767
// hardcoded constant, at which exponent should switch to a scientific notation
6868
int const lowerExponentThreshold = -5;
@@ -81,7 +81,7 @@ auto fp_to_string(T v, int precision = 0) -> std::string {
8181
auto r = jkj::dragonbox::to_decimal(v);
8282

8383
auto digits = std::array<char, 20>{}; // max digits of size_t is 20.
84-
auto digits_ct = convertToChars(digits.data(), digits.data() + digits.size(), r.significand);
84+
auto digits_ct = ConvertToChars(digits.data(), digits.data() + digits.size(), r.significand);
8585

8686
// check if requested precision is lower than
8787
// required digits for exact representation
@@ -136,7 +136,7 @@ auto fp_to_string(T v, int precision = 0) -> std::string {
136136
*(output_ptr++) = 'e';
137137
*(output_ptr++) = (exponent>=0)?'+':'-';
138138
auto exp_digits = std::array<char, 20>{};
139-
auto exp_digits_ct = convertToChars(exp_digits.data(), exp_digits.data() + exp_digits.size(), std::abs(exponent), /*.precision=*/ 2);
139+
auto exp_digits_ct = ConvertToChars(exp_digits.data(), exp_digits.data() + exp_digits.size(), std::abs(exponent), /*.precision=*/ 2);
140140
for (int i{0}; i < exp_digits_ct; ++i) {
141141
*(output_ptr++) = exp_digits[i];
142142
}
@@ -184,18 +184,18 @@ auto fp_to_string(T v, int precision = 0) -> std::string {
184184
}
185185
}
186186

187-
inline auto fp_to_string(float v, size_t precision = 0) -> std::string {
188-
return detail::fp_formatting::fp_to_string(v, precision);
187+
inline auto FpToString(float v, size_t precision = 0) -> std::string {
188+
return detail::fp_formatting::FpToString(v, precision);
189189
}
190190

191-
inline auto fp_to_string(double v, size_t precision = 0) -> std::string {
192-
return detail::fp_formatting::fp_to_string(v, precision);
191+
inline auto FpToString(double v, size_t precision = 0) -> std::string {
192+
return detail::fp_formatting::FpToString(v, precision);
193193
}
194194

195195
/**
196196
* dragonbox only works for floats/doubles not long double
197197
*/
198-
inline auto fp_to_string(long double v, size_t precision = std::numeric_limits<long double>::max_digits10) -> std::string {
198+
inline auto FpToString(long double v, size_t precision = std::numeric_limits<long double>::max_digits10) -> std::string {
199199
std::stringstream ss;
200200
ss.precision(precision);
201201
ss.imbue(std::locale("C"));

include/yaml-cpp/node/convert.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ inner_encode(const T& rhs, std::stringstream& stream){
130130
stream << ".inf";
131131
}
132132
} else {
133-
stream << fp_to_string(rhs, stream.precision());
133+
stream << FpToString(rhs, stream.precision());
134134
}
135135
}
136136

0 commit comments

Comments
 (0)