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
31#ifdef JSONCPP_NO_LOCALE_SUPPORT
34 struct lconv* lc = localeconv();
35 return lc ? *(lc->decimal_point) :
'\0';
47 result[0] =
static_cast<char>(cp);
48 }
else if (cp <= 0x7FF) {
50 result[1] =
static_cast<char>(0x80 | (0x3f & cp));
51 result[0] =
static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
52 }
else if (cp <= 0xFFFF) {
54 result[2] =
static_cast<char>(0x80 | (0x3f & cp));
55 result[1] =
static_cast<char>(0x80 | (0x3f & (cp >> 6)));
56 result[0] =
static_cast<char>(0xE0 | (0xf & (cp >> 12)));
57 }
else if (cp <= 0x10FFFF) {
59 result[3] =
static_cast<char>(0x80 | (0x3f & cp));
60 result[2] =
static_cast<char>(0x80 | (0x3f & (cp >> 6)));
61 result[1] =
static_cast<char>(0x80 | (0x3f & (cp >> 12)));
62 result[0] =
static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
85 *--current =
static_cast<char>(value % 10U +
static_cast<unsigned>(
'0'));
95template <
typename Iter>
97 for (; begin != end; ++begin) {
105template <
typename Iter>
108 if (decimalPoint ==
'\0' || decimalPoint ==
'.') {
111 for (; begin != end; ++begin) {
113 *begin = decimalPoint;
122template <
typename Iter>
124 for (; begin != end; --end) {
125 if (*(end - 1) !=
'0') {
129 if (begin != (end - 1) && *(end - 2) ==
'.') {
Iter fixZerosInTheEnd(Iter begin, Iter end)
Definition json_tool.h:123
char[uintToStringBufferSize] UIntToStringBuffer
Definition json_tool.h:75
@ uintToStringBufferSize
Definition json_tool.h:71
static char getDecimalPoint()
Definition json_tool.h:30
Iter fixNumericLocale(Iter begin, Iter end)
Definition json_tool.h:96
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
Definition config.h:110
static void uintToString(LargestUInt value, char *¤t)
Definition json_tool.h:82
static String codePointToUTF8(unsigned int cp)
Converts a unicode code-point to UTF-8.
Definition json_tool.h:40
void fixNumericLocaleInput(Iter begin, Iter end)
Definition json_tool.h:106
UInt64 LargestUInt
Definition config.h:104
JSON (JavaScript Object Notation).
Definition allocator.h:14