C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Public Types | Public Member Functions | Friends | List of all members
web::json::object Class Reference

A JSON object represented as a C++ class. More...

#include <json.h>

Public Types

typedef storage_type::iterator iterator
 
typedef storage_type::const_iterator const_iterator
 
typedef storage_type::reverse_iterator reverse_iterator
 
typedef storage_type::const_reverse_iterator const_reverse_iterator
 
typedef storage_type::size_type size_type
 

Public Member Functions

iterator begin ()
 Gets the beginning iterator element of the object More...
 
const_iterator begin () const
 Gets the beginning const iterator element of the object. More...
 
iterator end ()
 Gets the end iterator element of the object More...
 
const_iterator end () const
 Gets the end const iterator element of the object. More...
 
reverse_iterator rbegin ()
 Gets the beginning reverse iterator element of the object More...
 
const_reverse_iterator rbegin () const
 Gets the beginning const reverse iterator element of the object More...
 
reverse_iterator rend ()
 Gets the end reverse iterator element of the object More...
 
const_reverse_iterator rend () const
 Gets the end const reverse iterator element of the object More...
 
const_iterator cbegin () const
 Gets the beginning const iterator element of the object. More...
 
const_iterator cend () const
 Gets the end const iterator element of the object. More...
 
const_reverse_iterator crbegin () const
 Gets the beginning const reverse iterator element of the object. More...
 
const_reverse_iterator crend () const
 Gets the end const reverse iterator element of the object. More...
 
iterator erase (iterator position)
 Deletes an element of the JSON object. More...
 
void erase (const utility::string_t &key)
 Deletes an element of the JSON object. If the key doesn't exist, this method throws. More...
 
json::valueat (const utility::string_t &key)
 Accesses an element of a JSON object. If the key doesn't exist, this method throws. More...
 
const json::valueat (const utility::string_t &key) const
 Accesses an element of a JSON object. If the key doesn't exist, this method throws. More...
 
json::valueoperator[] (const utility::string_t &key)
 Accesses an element of a JSON object. More...
 
const_iterator find (const utility::string_t &key) const
 Gets an iterator to an element of a JSON object. More...
 
size_type size () const
 Gets the number of elements of the object. More...
 
bool empty () const
 Checks if there are any elements in the JSON object. More...
 

Friends

class details::_Object
 
template<typename CharType >
class json::details::JSON_Parser
 

Detailed Description

A JSON object represented as a C++ class.

Member Function Documentation

json::value& web::json::object::at ( const utility::string_t &  key)
inline

Accesses an element of a JSON object. If the key doesn't exist, this method throws.

Parameters
keyThe key of an element in the JSON object.
Returns
If the key exists, a reference to the value kept in the field.
const json::value& web::json::object::at ( const utility::string_t &  key) const
inline

Accesses an element of a JSON object. If the key doesn't exist, this method throws.

Parameters
keyThe key of an element in the JSON object.
Returns
If the key exists, a reference to the value kept in the field.
iterator web::json::object::begin ( )
inline

Gets the beginning iterator element of the object

Returns
An iterator to the beginning of the JSON object.
const_iterator web::json::object::begin ( ) const
inline

Gets the beginning const iterator element of the object.

Returns
A const_iterator to the beginning of the JSON object.
const_iterator web::json::object::cbegin ( ) const
inline

Gets the beginning const iterator element of the object.

Returns
A const_iterator to the beginning of the JSON object.
const_iterator web::json::object::cend ( ) const
inline

Gets the end const iterator element of the object.

Returns
A const_iterator to the end of the JSON object.
const_reverse_iterator web::json::object::crbegin ( ) const
inline

Gets the beginning const reverse iterator element of the object.

Returns
A const_reverse_iterator to the beginning of the JSON object.
const_reverse_iterator web::json::object::crend ( ) const
inline

Gets the end const reverse iterator element of the object.

Returns
A const_reverse_iterator to the end of the JSON object.
bool web::json::object::empty ( ) const
inline

Checks if there are any elements in the JSON object.

Returns
True iff empty.
iterator web::json::object::end ( )
inline

Gets the end iterator element of the object

Returns
An iterator to the end of the JSON object.
const_iterator web::json::object::end ( ) const
inline

Gets the end const iterator element of the object.

Returns
A const_iterator to the end of the JSON object.
iterator web::json::object::erase ( iterator  position)
inline

Deletes an element of the JSON object.

Parameters
positionA const_iterator to the element to delete.
Returns
Iterator to the new location of the element following the erased element.

GCC doesn't support erase with const_iterator on vector yet. In the future this should be changed.

void web::json::object::erase ( const utility::string_t &  key)
inline

Deletes an element of the JSON object. If the key doesn't exist, this method throws.

Parameters
keyThe key of an element in the JSON object.
const_iterator web::json::object::find ( const utility::string_t &  key) const
inline

Gets an iterator to an element of a JSON object.

Parameters
keyThe key of an element in the JSON object.
Returns
A const iterator to the value kept in the field.
json::value& web::json::object::operator[] ( const utility::string_t &  key)
inline

Accesses an element of a JSON object.

Parameters
keyThe key of an element in the JSON object.
Returns
If the key exists, a reference to the value kept in the field, otherwise a newly created null value that will be stored for the given key.
reverse_iterator web::json::object::rbegin ( )
inline

Gets the beginning reverse iterator element of the object

Returns
An reverse_iterator to the beginning of the JSON object.
const_reverse_iterator web::json::object::rbegin ( ) const
inline

Gets the beginning const reverse iterator element of the object

Returns
An const_reverse_iterator to the beginning of the JSON object.
reverse_iterator web::json::object::rend ( )
inline

Gets the end reverse iterator element of the object

Returns
An reverse_iterator to the end of the JSON object.
const_reverse_iterator web::json::object::rend ( ) const
inline

Gets the end const reverse iterator element of the object

Returns
An const_reverse_iterator to the end of the JSON object.
size_type web::json::object::size ( ) const
inline

Gets the number of elements of the object.

Returns
The number of elements.

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