faunus
Public Member Functions | List of all members
Faunus::SingleUseJSON Struct Reference

Like json, but delete entries after access. More...

#include <json_support.h>

Inheritance diagram for Faunus::SingleUseJSON:
Inheritance graph
[legend]
Collaboration diagram for Faunus::SingleUseJSON:
Collaboration graph
[legend]

Public Member Functions

 SingleUseJSON (const json &)
 
bool empty () const
 
size_type count (const std::string &) const
 
std::string dump (int=-1) const
 
bool is_object () const
 
void clear ()
 
json at (const std::string &)
 
json operator[] (const std::string &)
 
void erase (const std::string &)
 
template<class T >
T value (const std::string &key, const T &fallback)
 

Detailed Description

Like json, but delete entries after access.

Only selected functions from the json class is exposed and and accessing a key it will be deleted afterwards, i.e. a key can be used only once. This can be used to check for unknown keys as the object should be zero after being processed by i.e. from_json or similar.

Todo:
This class should be retired and handled by JSON schema instead

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