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:
Mike R
2018-03-13 23:35:31 +03:00
committed by Christopher Dunn
parent af2598cdd3
commit a07fc53287
6 changed files with 85 additions and 8 deletions

View File

@@ -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