mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 15:16:47 +02:00
Add setting precision for json writers and also add decimal places precision type. (#752)
* Added setting precision for writers. * Added special case for precise precision and global precision. * Added good setting of type of precision and also added this type to BuiltStreamWriter and for its settings. * Added some tests.
This commit is contained in:
@@ -109,6 +109,20 @@ static inline void fixNumericLocaleInput(char* begin, char* end) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete zeros in the end of string, if it isn't last zero before '.' character.
|
||||
*/
|
||||
static inline void fixZerosInTheEnd(char* begin, char* end) {
|
||||
end--;
|
||||
while ((begin < end) && (*end == '0')) {
|
||||
// don't delete last zero before point.
|
||||
if (*(end - 1) != '.') {
|
||||
*end = '\0';
|
||||
}
|
||||
end--;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Json {
|
||||
|
||||
#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||
|
Reference in New Issue
Block a user