JSON (JavaScript Object Notation).
Classes | |
class | Features |
class | StaticString |
class | Value |
class | PathArgument |
class | Path |
class | ValueIteratorBase |
class | ValueConstIterator |
class | ValueIterator |
class | Reader |
class | CharReader |
Interface for reading JSON from a char array. More... | |
class | CharReaderBuilder |
class | StreamWriter |
Usage:. More... | |
class | StreamWriterBuilder |
class | Writer |
class | FastWriter |
class | StyledWriter |
class | StyledStreamWriter |
Typedefs | |
typedef int | Int |
typedef unsigned int | UInt |
typedef __int64 | Int64 |
typedef unsigned __int64 | UInt64 |
typedef Int64 | LargestInt |
typedef UInt64 | LargestUInt |
typedef unsigned int | ArrayIndex |
typedef int | Int |
typedef unsigned int | UInt |
typedef __int64 | Int64 |
typedef unsigned __int64 | UInt64 |
typedef Int64 | LargestInt |
typedef UInt64 | LargestUInt |
typedef unsigned int | ArrayIndex |
typedef char | UIntToStringBuffer [uintToStringBufferSize] |
typedef std::auto_ptr < CharReader > | CharReaderPtr |
typedef std::auto_ptr < StreamWriter > | StreamWriterPtr |
typedef int | Int |
typedef unsigned int | UInt |
typedef __int64 | Int64 |
typedef unsigned __int64 | UInt64 |
typedef Int64 | LargestInt |
typedef UInt64 | LargestUInt |
typedef unsigned int | ArrayIndex |
typedef std::auto_ptr < CharReader > | CharReaderPtr |
typedef char | UIntToStringBuffer [uintToStringBufferSize] |
typedef std::auto_ptr < StreamWriter > | StreamWriterPtr |
typedef int | Int |
typedef unsigned int | UInt |
typedef __int64 | Int64 |
typedef unsigned __int64 | UInt64 |
typedef Int64 | LargestInt |
typedef UInt64 | LargestUInt |
typedef unsigned int | ArrayIndex |
Enumerations | |
enum | ValueType { nullValue = 0, nullValue = 0, intValue, intValue, uintValue, uintValue, realValue, realValue, stringValue, stringValue, booleanValue, booleanValue, arrayValue, arrayValue, objectValue, objectValue, nullValue = 0, nullValue = 0, intValue, intValue, uintValue, uintValue, realValue, realValue, stringValue, stringValue, booleanValue, booleanValue, arrayValue, arrayValue, objectValue, objectValue } |
enum | CommentPlacement { commentBefore = 0, commentBefore = 0, commentAfterOnSameLine, commentAfterOnSameLine, commentAfter, commentAfter, numberOfCommentPlacement, numberOfCommentPlacement, commentBefore = 0, commentBefore = 0, commentAfterOnSameLine, commentAfterOnSameLine, commentAfter, commentAfter, numberOfCommentPlacement, numberOfCommentPlacement } |
enum | { uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1, uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 } |
enum | ValueType { nullValue = 0, nullValue = 0, intValue, intValue, uintValue, uintValue, realValue, realValue, stringValue, stringValue, booleanValue, booleanValue, arrayValue, arrayValue, objectValue, objectValue, nullValue = 0, nullValue = 0, intValue, intValue, uintValue, uintValue, realValue, realValue, stringValue, stringValue, booleanValue, booleanValue, arrayValue, arrayValue, objectValue, objectValue } |
enum | CommentPlacement { commentBefore = 0, commentBefore = 0, commentAfterOnSameLine, commentAfterOnSameLine, commentAfter, commentAfter, numberOfCommentPlacement, numberOfCommentPlacement, commentBefore = 0, commentBefore = 0, commentAfterOnSameLine, commentAfterOnSameLine, commentAfter, commentAfter, numberOfCommentPlacement, numberOfCommentPlacement } |
enum | { uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1, uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 } |
Functions | |
bool | parseFromStream (CharReader::Factory const &, std::istream &, Value *root, std::string *errs) |
Consume entire stream and use its begin/end. | |
JSON_API std::istream & | operator>> (std::istream &, Value &) |
std::string | writeString (StreamWriter::Factory const &factory, Value const &root) |
std::string JSON_API | valueToString (Int value) |
std::string JSON_API | valueToString (UInt value) |
std::string JSON_API | valueToString (LargestInt value) |
std::string JSON_API | valueToString (LargestUInt value) |
std::string JSON_API | valueToString (double value) |
std::string JSON_API | valueToString (bool value) |
std::string JSON_API | valueToQuotedString (const char *value) |
JSON_API std::ostream & | operator<< (std::ostream &, const Value &root) |
static std::string | codePointToUTF8 (unsigned int cp) |
Converts a unicode code-point to UTF-8. | |
static bool | isControlCharacter (char ch) |
Returns true if ch is a control character (in range [0,32[). | |
static void | uintToString (LargestUInt value, char *¤t) |
Converts an unsigned integer to string. | |
static void | fixNumericLocale (char *begin, char *end) |
Change ',' to '. | |
static bool | containsNewLine (Reader::Location begin, Reader::Location end) |
static std::string | normalizeEOL (Reader::Location begin, Reader::Location end) |
static void | getValidReaderKeys (std::set< std::string > *valid_keys) |
static const unsigned char | ALIGNAS (8) kNull[sizeof(Value)] |
template<typename T, typename U> | |
static bool | InRange (double d, T min, U max) |
static char * | duplicateStringValue (const char *value, unsigned int length=unknown) |
Duplicates the specified string value. | |
static void | releaseStringValue (char *value) |
Free the string duplicated by duplicateStringValue(). | |
static bool | IsIntegral (double d) |
static bool | containsControlCharacter (const char *str) |
static void | getValidWriterKeys (std::set< std::string > *valid_keys) |
Variables | |
static const Value | null |
const unsigned char & | kNullRef = kNull[0] |
static const unsigned int | unknown = (unsigned)-1 |
Unknown size marker. | |
static const Value | null |
const unsigned char & | kNullRef = kNull[0] |
static const unsigned int | unknown = (unsigned)-1 |
Unknown size marker. |
typedef unsigned int ArrayIndex |
typedef unsigned int ArrayIndex |
typedef unsigned int ArrayIndex |
typedef unsigned int ArrayIndex |
typedef std::auto_ptr<CharReader> CharReaderPtr |
typedef std::auto_ptr<CharReader> CharReaderPtr |
typedef int Int |
typedef int Int |
typedef int Int |
typedef int Int |
typedef __int64 Int64 |
typedef __int64 Int64 |
typedef __int64 Int64 |
typedef __int64 Int64 |
typedef Int64 LargestInt |
typedef Int64 LargestInt |
typedef Int64 LargestInt |
typedef Int64 LargestInt |
typedef UInt64 LargestUInt |
typedef UInt64 LargestUInt |
typedef UInt64 LargestUInt |
typedef UInt64 LargestUInt |
typedef std::auto_ptr<StreamWriter> StreamWriterPtr |
typedef std::auto_ptr<StreamWriter> StreamWriterPtr |
typedef unsigned int UInt |
typedef unsigned int UInt |
typedef unsigned int UInt |
typedef unsigned int UInt |
typedef unsigned __int64 UInt64 |
typedef unsigned __int64 UInt64 |
typedef unsigned __int64 UInt64 |
typedef unsigned __int64 UInt64 |
typedef char UIntToStringBuffer[uintToStringBufferSize] |
typedef char UIntToStringBuffer[uintToStringBufferSize] |
anonymous enum |
anonymous enum |
enum CommentPlacement |
enum CommentPlacement |
enum ValueType |
Type of the value held by a Value object.
enum ValueType |
Type of the value held by a Value object.
static const unsigned char Json::ALIGNAS | ( | 8 | ) | [static] |
static std::string Json::codePointToUTF8 | ( | unsigned int | cp | ) | [inline, static] |
Converts a unicode code-point to UTF-8.
static bool Json::containsControlCharacter | ( | const char * | str | ) | [static] |
static bool Json::containsNewLine | ( | Reader::Location | begin, | |
Reader::Location | end | |||
) | [static] |
static char* Json::duplicateStringValue | ( | const char * | value, | |
unsigned int | length = unknown | |||
) | [inline, static] |
Duplicates the specified string value.
value | Pointer to the string to duplicate. Must be zero-terminated if length is "unknown". | |
length | Length of the value. if equals to unknown, then it will be computed using strlen(value). |
static void Json::fixNumericLocale | ( | char * | begin, | |
char * | end | |||
) | [inline, static] |
Change ',' to '.
' everywhere in buffer.
We had a sophisticated way, but it did not work in WinCE.
static void Json::getValidReaderKeys | ( | std::set< std::string > * | valid_keys | ) | [static] |
static void Json::getValidWriterKeys | ( | std::set< std::string > * | valid_keys | ) | [static] |
static bool Json::InRange | ( | double | d, | |
T | min, | |||
U | max | |||
) | [inline, static] |
static bool Json::isControlCharacter | ( | char | ch | ) | [inline, static] |
Returns true if ch is a control character (in range [0,32[).
static bool Json::IsIntegral | ( | double | d | ) | [static] |
static std::string Json::normalizeEOL | ( | Reader::Location | begin, | |
Reader::Location | end | |||
) | [static] |
std::ostream & operator<< | ( | std::ostream & | sout, | |
const Value & | root | |||
) |
Output using the StyledStreamWriter.
std::istream & operator>> | ( | std::istream & | sin, | |
Value & | root | |||
) |
Read from 'sin' into 'root'.
Always keep comments from the input JSON.
This can be used to read a file into a particular sub-object. For example:
Json::Value root; cin >> root["dir"]["file"]; cout << root;
{ "dir": { "file": { // The input stream JSON would be nested here. } } }
std::exception | on parse error. |
bool parseFromStream | ( | CharReader::Factory const & | fact, | |
std::istream & | sin, | |||
Value * | root, | |||
std::string * | errs | |||
) |
Consume entire stream and use its begin/end.
Someday we might have a real StreamReader, but for now this is convenient.
static void Json::releaseStringValue | ( | char * | value | ) | [inline, static] |
Free the string duplicated by duplicateStringValue().
static void Json::uintToString | ( | LargestUInt | value, | |
char *& | current | |||
) | [inline, static] |
Converts an unsigned integer to string.
value | Unsigned interger to convert to string | |
current | Input/Output string buffer. Must have at least uintToStringBufferSize chars free. |
std::string valueToQuotedString | ( | const char * | value | ) |
std::string valueToString | ( | bool | value | ) |
std::string valueToString | ( | double | value | ) |
std::string valueToString | ( | LargestUInt | value | ) |
std::string valueToString | ( | LargestInt | value | ) |
std::string JSON_API Json::valueToString | ( | UInt | value | ) |
std::string JSON_API valueToString | ( | Int | value | ) |
std::string writeString | ( | StreamWriter::Factory const & | factory, | |
Value const & | root | |||
) |
Write into stringstream, then return string, for convenience. A StreamWriter will be created from the factory, used, and then deleted.
const unsigned char& kNullRef = kNull[0] |
const unsigned char& kNullRef = kNull[0] |
const unsigned int unknown = (unsigned)-1 [static] |
Unknown size marker.
const unsigned int unknown = (unsigned)-1 [static] |
Unknown size marker.