|
Free Electron
|
JSON (JavaScript Object Notation). More...
Classes | |
| class | CharReader |
| Interface for reading JSON from a char array. More... | |
| class | CharReaderBuilder |
| Build a CharReader implementation. More... | |
| class | Exception |
| Base class for all exceptions we throw. More... | |
| class | FastWriter |
| Outputs a Value in JSON format without formatting (not human friendly). More... | |
| class | Features |
| Configuration passed to reader and writer. More... | |
| class | LogicError |
| Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. More... | |
| class | Path |
| Experimental and untested: represents a "path" to access a node. More... | |
| class | PathArgument |
| Experimental and untested: represents an element of the "path" to access a node. More... | |
| class | Reader |
| Unserialize a JSON document into a Value. More... | |
| class | RuntimeError |
| Exceptions which the user cannot easily avoid. More... | |
| class | StaticString |
| Lightweight wrapper to tag static string. More... | |
| class | StreamWriter |
| Usage: More... | |
| class | StreamWriterBuilder |
| Build a StreamWriter implementation. More... | |
| class | StyledStreamWriter |
| Writes a Value in JSON format in a human friendly way, to a stream rather than to a string. More... | |
| class | StyledWriter |
| Writes a Value in JSON format in a human friendly way. More... | |
| class | Value |
| Represents a JSON value. More... | |
| class | ValueConstIterator |
| const iterator for object and array value. More... | |
| class | ValueIterator |
| Iterator for object and array value. More... | |
| class | ValueIteratorBase |
| base class for Value iterators. More... | |
| class | Writer |
| Abstract class for writers. More... | |
Typedefs | |
| using | Int = int |
| using | UInt = unsigned int |
| using | Int64 = int64_t |
| using | UInt64 = uint64_t |
| using | LargestInt = Int64 |
| using | LargestUInt = UInt64 |
| template<typename T > | |
| using | Allocator = typename std::conditional< JSONCPP_USING_SECURE_MEMORY, SecureAllocator< T >, std::allocator< T > >::type |
| using | String = std::basic_string< char, std::char_traits< char >, Allocator< char > > |
| using | IStringStream = std::basic_istringstream< String::value_type, String::traits_type, String::allocator_type > |
| using | OStringStream = std::basic_ostringstream< String::value_type, String::traits_type, String::allocator_type > |
| using | IStream = std::istream |
| using | OStream = std::ostream |
| using | ArrayIndex = unsigned int |
| using | UIntToStringBuffer = char[uintToStringBufferSize] |
Enumerations | |
| enum | ValueType { nullValue = 0, intValue, uintValue, realValue, stringValue, booleanValue, arrayValue, objectValue } |
| Type of the value held by a Value object. More... | |
| enum | CommentPlacement { commentBefore = 0, commentAfterOnSameLine, commentAfter, numberOfCommentPlacement } |
| enum | PrecisionType { significantDigits = 0, decimalPlaces } |
| Type of precision for formatting of real values. More... | |
| enum | { uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 } |
Functions | |
| template<typename T , typename U > | |
| bool | operator== (const SecureAllocator< T > &, const SecureAllocator< U > &) |
| template<typename T , typename U > | |
| bool | operator!= (const SecureAllocator< T > &, const SecureAllocator< U > &) |
| bool JSON_API | parseFromStream (CharReader::Factory const &, IStream &, Value *root, String *errs) |
| Consume entire stream and use its begin/end. More... | |
| JSON_API IStream & | operator>> (IStream &, Value &) |
| Read from 'sin' into 'root'. More... | |
| JSONCPP_NORETURN void | throwRuntimeError (String const &msg) |
| used internally More... | |
| JSONCPP_NORETURN void | throwLogicError (String const &msg) |
| used internally More... | |
| void | swap (Value &a, Value &b) |
| String JSON_API | writeString (StreamWriter::Factory const &factory, Value const &root) |
| Write into stringstream, then return string, for convenience. More... | |
| String JSON_API | valueToString (Int value) |
| String JSON_API | valueToString (UInt value) |
| String JSON_API | valueToString (LargestInt value) |
| String JSON_API | valueToString (LargestUInt value) |
| String JSON_API | valueToString (double value, unsigned int precision=Value::defaultRealPrecision, PrecisionType precisionType=PrecisionType::significantDigits) |
| String JSON_API | valueToString (bool value) |
| String JSON_API | valueToQuotedString (const char *value) |
| JSON_API OStream & | operator<< (OStream &, const Value &root) |
| Output using the StyledStreamWriter. More... | |
| static char | getDecimalPoint () |
| static String | codePointToUTF8 (unsigned int cp) |
| Converts a unicode code-point to UTF-8. More... | |
| static void | uintToString (LargestUInt value, char *¤t) |
| Converts an unsigned integer to string. More... | |
| template<typename Iter > | |
| Iter | fixNumericLocale (Iter begin, Iter end) |
| Change ',' to '. More... | |
| template<typename Iter > | |
| void | fixNumericLocaleInput (Iter begin, Iter end) |
| template<typename Iter > | |
| 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 end of string, but not the last zero before '. More... | |
JSON (JavaScript Object Notation).
| anonymous enum |
| enum Json::PrecisionType |
| enum Json::ValueType |
Type of the value held by a Value object.
|
inlinestatic |
Converts a unicode code-point to UTF-8.
| Iter Json::fixNumericLocale | ( | Iter | begin, |
| Iter | end | ||
| ) |
Change ',' to '.
' everywhere in buffer.
We had a sophisticated way, but it did not work in WinCE.
| Iter Json::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 end of string, but not the last zero before '.
'.
| JSON_API OStream& Json::operator<< | ( | OStream & | , |
| const Value & | root | ||
| ) |
Output using the StyledStreamWriter.
| JSON_API IStream& Json::operator>> | ( | IStream & | , |
| Value & | |||
| ) |
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:
Result:
* {
* "dir": {
* "file": {
* // The input stream JSON would be nested here.
* }
* }
* }
* | std::exception | on parse error. |
| bool JSON_API Json::parseFromStream | ( | CharReader::Factory const & | , |
| IStream & | , | ||
| Value * | root, | ||
| String * | errs | ||
| ) |
Consume entire stream and use its begin/end.
Someday we might have a real StreamReader, but for now this is convenient.
| JSONCPP_NORETURN void Json::throwLogicError | ( | String const & | msg | ) |
used internally
| JSONCPP_NORETURN void Json::throwRuntimeError | ( | String const & | msg | ) |
used internally
|
inlinestatic |
Converts an unsigned integer to string.
| value | Unsigned integer to convert to string |
| current | Input/Output string buffer. Must have at least uintToStringBufferSize chars free. |
| String JSON_API Json::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.
1.8.13