Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | List of all members
ola::web::PointerTracker Class Reference

Detailed Description

Maintains a Json Pointer (RFC 6901) given a set of Json parse events.

Given the JSON:

{
"foo": {
"bar": 1,
"baz": true
},
"bat": [0, 1, 2]
}

It has the pointers:

When parsing this example, the order of method invocation should be:

JsonPointer pointer;
PointerTracker tracker(&pointer);
tracker.OpenObject()
tracker.SetProperty("foo");
tracker.OpenObject();
tracker.SetProperty("bar");
tracker.SetProperty("baz");
tracker.CloseObject();
tracker.SetProperty("bat");
tracker.OpenArray();
tracker.IncrementIndex();
tracker.IncrementIndex();
tracker.IncrementIndex();
tracker.CloseArray();
tracker.CloseObject();

Public Member Functions

 PointerTracker (JsonPointer *pointer)
 
void OpenObject ()
 Open a new Object Element.
 
void SetProperty (const std::string &property)
 Set the property name within an Object element. Note if we're not currently in an object element this has no effect.
 
void CloseObject ()
 Close an Object element. Note if we're not currently in an object element this has no effect.
 
void OpenArray ()
 Open a new Array Element Note that until IncrementIndex() is called, the array index will be -1. This is so you can call IncrementIndex() on each element.
 
void CloseArray ()
 Close an Array Element If we're not currently in an array this doesn't do anything.
 
void IncrementIndex ()
 Increment an array index. If we're not current in an array this doesn't do anything.
 

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