6#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
7#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
9#if !defined(JSON_IS_AMALGAMATION)
14#ifdef NO_LOCALE_SUPPORT
15#define JSONCPP_NO_LOCALE_SUPPORT
18#ifndef JSONCPP_NO_LOCALE_SUPPORT
30#ifdef JSONCPP_NO_LOCALE_SUPPORT
33 struct lconv* lc = localeconv();
34 return lc ? *(lc->decimal_point) :
'\0';
46 result[0] =
static_cast<char>(cp);
47 }
else if (cp <= 0x7FF) {
49 result[1] =
static_cast<char>(0x80 | (0x3f & cp));
50 result[0] =
static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
51 }
else if (cp <= 0xFFFF) {
53 result[2] =
static_cast<char>(0x80 | (0x3f & cp));
54 result[1] =
static_cast<char>(0x80 | (0x3f & (cp >> 6)));
55 result[0] =
static_cast<char>(0xE0 | (0xf & (cp >> 12)));
56 }
else if (cp <= 0x10FFFF) {
58 result[3] =
static_cast<char>(0x80 | (0x3f & cp));
59 result[2] =
static_cast<char>(0x80 | (0x3f & (cp >> 6)));
60 result[1] =
static_cast<char>(0x80 | (0x3f & (cp >> 12)));
61 result[0] =
static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
84 *--current =
static_cast<char>(value % 10U +
static_cast<unsigned>(
'0'));
95 for (; begin != end; ++begin) {
105 if (decimalPoint ==
'\0' || decimalPoint ==
'.') {
108 for (; begin != end; ++begin) {
110 *begin = decimalPoint;
119template <
typename Iter>
121 for (; begin != end; --end) {
122 if (*(end - 1) !=
'0') {
126 if (begin != (end - 1) && begin != (end - 2) && *(end - 2) ==
'.') {
JSON (JavaScript Object Notation).
Iter fixNumericLocale(Iter begin, Iter end)
Change ',' to '.
static String codePointToUTF8(unsigned int cp)
Converts a unicode code-point to UTF-8.
@ uintToStringBufferSize
Constant that specify the size of the buffer that must be passed to uintToString.
Iter fixZerosInTheEnd(Iter begin, Iter end, unsigned int precision)
Return iterator that would be the new end of the range [begin,end), if we were to delete zeros in the...
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
char[uintToStringBufferSize] UIntToStringBuffer
static void uintToString(LargestUInt value, char *¤t)
Converts an unsigned integer to string.
static char getDecimalPoint()
void fixNumericLocaleInput(Iter begin, Iter end)