CMSC23700 Common Code Library
Support code for CS23700 programming projects
JSON::Object Class Reference

JSON objects. More...

#include <json.hxx>

Inherits JSON::Value.

Public Member Functions

 Object ()
 
 ~Object ()
 
int size () const
 return the number of fields in the object More...
 
void insert (std::string key, Value *val)
 insert a key-value pair into the object More...
 
Valueoperator[] (std::string key) const
 
std::string toString ()
 
- Public Member Functions inherited from JSON::Value
Type type () const
 return the type of this JSON value More...
 
bool isObject () const
 return true if this value is an object More...
 
bool isArray () const
 return true if this value is an array More...
 
bool isNumber () const
 return true if this value is a number More...
 
bool isString () const
 return true if this value is a string More...
 
bool isBool () const
 return true if this value is a boolean More...
 
bool isNull () const
 return true if this value is the null value More...
 
const ObjectasObject () const
 dynamic cast to JSON object More...
 
const ArrayasArray () const
 dynamic cast to JSON object More...
 
const NumberasNumber () const
 dynamic cast to JSON object More...
 
const StringasString () const
 dynamic cast to JSON object More...
 
const BoolasBool () const
 dynamic cast to JSON object More...
 
virtual ~Value ()=0
 

Additional Inherited Members

- Protected Member Functions inherited from JSON::Value
 Value (Type ty)
 
- Protected Attributes inherited from JSON::Value
Type _ty
 

Detailed Description

JSON objects.

Constructor & Destructor Documentation

JSON::Object::Object ( )
JSON::Object::~Object ( )

Member Function Documentation

void JSON::Object::insert ( std::string  key,
Value val 
)

insert a key-value pair into the object

Value* JSON::Object::operator[] ( std::string  key) const

return the value corresponding to the given key.

Returns
nil if the key is not defined in the object
int JSON::Object::size ( ) const
inline

return the number of fields in the object

std::string JSON::Object::toString ( )
virtual

Implements JSON::Value.


The documentation for this class was generated from the following file: