API Documentation
|
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text to transmit data objects consisting of attribute–value pairs and array data types(or any other serializable value). More...
#include <JSONParser.h>
Public Types | |
enum | NodeType { e_number , e_array , e_bool , e_object , e_node , e_root } |
Public Member Functions | |
decltype(auto) | begin () |
decltype(auto) | begin () const |
const Buffer< JSONNode * > & | children () const |
JSONNode & | createChildNode (const String &child_node, NodeType type) |
decltype(auto) | end () |
decltype(auto) | end () const |
const JSONNode & | get (const String &child_node) const |
template<class t_type > | |
decltype(auto) | getAs () const |
bool | hasNode (const String &child_node) const |
bool | isEmpty () const |
JSONNode () | |
JSONNode (const JSONNode &node) | |
JSONNode (const String &node, const String &json_string) | |
JSONNode (File &file) | |
JSONNode (JSONNode &&node) noexcept | |
JSONNode (Scanner &scan) | |
const String & | nodeName () const |
template<class t_type > | |
JSONNode & | operator= (const Angle< t_type > &value) |
template<class t_type , class t_allocator > | |
JSONNode & | operator= (const Buffer< t_type, t_allocator > &buffer) |
JSONNode & | operator= (const JSONNode &node) |
JSONNode & | operator= (const String &value) |
template<class t_type > | |
JSONNode & | operator= (const t_type &value) |
JSONNode & | operator= (const Time &time) |
template<uint01 t_dims, class t_type > | |
JSONNode & | operator= (const Vector< t_dims, t_type > &buffer) |
JSONNode & | operator[] (const String &child_node) |
const JSONNode & | operator[] (const String &child_node) const |
JSONNode & | operator[] (const uint04 &child_idx) |
const JSONNode & | operator[] (const uint04 &child_idx) const |
void | remove (const String &child_node) |
uint04 | size () |
NodeType | type () const |
void | write (File &file) |
Writes the JSON structure out to a file with no frills. Same as write(String&) but for files. | |
void | write (std::ostream &file) |
void | write (String &stream) const |
void | writePretty (File &file) |
Writes our structure out to a file using tabs and new lines. Same as writePretty(String&) but for files. | |
void | writePretty (std::ostream &file) |
void | writePretty (String &stream, const uint04 tab_indention=0) const |
Same as write, but adds tabs and new lines to make it easier to read, though will result in larger file. | |
~JSONNode () | |
Static Public Member Functions | |
static JSONNode | ParseYAML (Scanner &scan) |
Protected Member Functions | |
JSONNode (const String &name) | |
bool | parseJSON (Scanner &scan) |
bool | parseJSONContent (char start, Scanner &scan) |
bool | parseYAMLContent (uint04 indentention, Scanner &scan) |
void | readArray (Scanner &scan) |
void | readChildrenNodes (Scanner &scan) |
void | readData (Scanner &scan) |
Static Protected Member Functions | |
static TranslatedString | BadChildErrorString (const Scanner &scan) |
static void | ConvertFromJSONString (String &string) |
static void | ConvertToJSONString (String &string) |
static TranslatedString | DuplicateChildErrorString (const String &child, const Scanner &scan) |
static TranslatedString | UnexpectedCharErrorString (char current_char, const Scanner &scan) |
static void | WriteTabs (String &stream, uint04 tab_indention) |
Protected Attributes | |
Dictionary< String, JSONNode * > | m_json_children |
const String | m_name |
Buffer< JSONNode * > | m_sorted_json_children |
NodeType | m_type |
String | m_value |
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text to transmit data objects consisting of attribute–value pairs and array data types(or any other serializable value).
Class: JSONNode
It is a very common data format used for asynchronous browser–server communication, including as a replacement for XML in some AJAX - style systems.
The JSONNode class serves as a container for data and it's children. Includes options to read and write from streams and files.
Author: Tyler Parke
Date: 2017-11-13
enum NodeType |
JSONNode | ( | ) |
Creates a root JSON node
Author: Tyler Parke
Date: 2017-11-19
Very basic move constructor.
Author: Tyler Parke
Date: 2017-11-19
~JSONNode | ( | ) |
|
staticprotected |
|
inlinenodiscard |
|
inlinenodiscard |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
inlinenodiscard |
|
inlinenodiscard |
returns the child, if it exists. Is read only. Same as (*this)[child_node]
Author: Tyler Parke
Date: 2017-11-19
Parameters: child_node - The name of the node you want to return. Must be an existing child node.
|
inline |
Returns this object as the type specified.
Author: Tyler Parke
Date: 2017-11-19
|
inline |
|
inlinenodiscard |
Returns true if the node contains no information.
Author: Tyler Parke
Date: 2019-14-12
|
inline |
|
inline |
A special case of the = operator for nodes. Note that this will not set the name of the node, but set the contents equal to that of another
Author: Tyler Parke
Date: 2017-11-19
|
inline |
A general case t_type equals. Sets the value internal and predicts the type.
Author: Tyler Parke
Date: 2017-11-19
A special case Time equals. writes in YYYY/MM/DDTHH:mm:ss.fffZ format.
Author: Tyler Parke
Date: 2017-11-19
|
inline |
returns the child, if it exists. Is read only. Same as get
Author: Tyler Parke
Date: 2017-11-19
Parameters: child_node - The name of the node you want to return. Must be an existing child node.
Returns the child, if it exists.
Author: Tyler Parke
Date: 2017-11-19
Parameters: child_idx - The index of the node you want to return.
|
protected |
Reads in the next JSON item and adds it to this node's children
Parameters: scan - The object tasked with reading in our data. Shold be just past the second '"' at the end of the node's title at this point.
Author: Tyler Parke
Date: 2017-11-19
|
protected |
Reads in the next YAML item and adds it to this node's children
Parameters: scan - The object tasked with reading in our data. Shold be just past the second '"' at the end of the node's title at this point.
Author: Tyler Parke
Date: 2024-07-08
|
protected |
Reads in an array of items for this child.
Parameters: scan - The object tasked with reading in our data. Shold be just past the first '[' specifying the beginning of the array
Author: Tyler Parke
Date: 2017-11-19
|
protected |
Reads in all of the children nodes for this node and adds them to the children list
Parameters: scan - The object tasked with reading in our data. Shold be just before the first '"' specifying the title
Author: Tyler Parke
Date: 2017-11-19
|
protected |
Reads in a single object type for this child.
Parameters: scan - The object tasked with reading in our data. Shold be just past the first '"' specifying the data
Author: Tyler Parke
Date: 2017-11-19
void remove | ( | const String & | child_node | ) |
|
inline |
Returns the number of children within this node.
Author: Tyler Parke
Date: 2017-11-19
NodeType type | ( | ) | const |
Author: Tyler Parke
Date: 2017-11-19
|
staticprotected |
void write | ( | File & | file | ) |
Writes the JSON structure out to a file with no frills. Same as write(String&) but for files.
Author: Tyler Parke
Date: 2017-11-19
Parameters: file - The file where you want the JSON node to be written
void write | ( | std::ostream & | file | ) |
void write | ( | String & | stream | ) | const |
A no frills write routine. Useful for writing to a file.
Author: Tyler Parke
Date: 2017-11-19
Parameters: stream - The stream where you want the JSON node to be written
void writePretty | ( | File & | file | ) |
Writes our structure out to a file using tabs and new lines. Same as writePretty(String&) but for files.
Author: Tyler Parke
Date: 2017-11-19
Parameters: file - The file where you want the JSON node to be written
void writePretty | ( | std::ostream & | file | ) |
Same as write, but adds tabs and new lines to make it easier to read, though will result in larger file.
Author: Tyler Parke
Date: 2017-11-19
Parameters: stream - The stream where you want the JSON node to be written tab_indention - The number of tabs to place before writing data
Writes tabs to the file
Parameters: stream - Where to append the tabs tab_indention - The number of tabs to write
Author: Tyler Parke
Date: 2017-11-19
|
protected |
|
protected |
|
protected |
|
protected |