35 #include <json/value.h> 
   45         class PathNodeToJsonVisitor
 
   46             : 
public boost::static_visitor<Json::Value> {
 
   48             PathNodeToJsonVisitor() : boost::static_visitor<
Json::Value>() {}
 
   52             void addNodeData(
PathNode const &node, Json::Value &val) {
 
   58             Json::Value operator()(
PathNode const &node, T 
const &elt) {
 
   60                 addNodeData(node, ret);
 
   65             PathNodeToJsonVisitor visitor;
 
   70         class PathTreeToJsonVisitor {
 
   72             PathTreeToJsonVisitor(
bool keepNulls)
 
   73                 : m_ret(
Json::arrayValue), m_keepNulls(keepNulls) {}
 
   75             Json::Value getResult() { 
return m_ret; }
 
   77             void operator()(
PathNode const &node) {
 
   83                 node.visitConstChildren(*
this);
 
   93         auto visitor = PathTreeToJsonVisitor{keepNulls};
 
   95         return visitor.getResult();
 
   99         for (
auto const &node : nodes) {
 
A tree representation, with path/url syntax, of the known OSVR system. 
::osvr::util::TreeNode< PathElement > PathNode
The specific tree node type that contains a path element. 
Header containing the workings of turning PathElements to/from JSON (serialization). 
Header including PathTree.h and all additional headers needed to define related types. 
Json::Value pathElementToJson(T const &element)
Returns a JSON object with any element-type-specific data for the given PathElement-holdable type...
void jsonToPathTree(PathTree &tree, Json::Value nodes)
Deserialize a path tree from a JSON array of objects. 
std::string getFullPath(PathNode const &node)
Gets the absolute path for the given node. 
PathNode & getNodeByPath(std::string const &path)
Returns the node indicated by the path, which must be absolute (begin with a /). Any non-existent nod...
bool isNull(PathElement const &elt)
Returns true if the path element provided is a NullElement. 
void visitConstTree(F &functor) const 
Visit the tree, with const nodes, starting at the root, with the given functor. 
Visitor::result_type applyPathNodeVisitor(Visitor &v, PathNode &node)
Visit a node's element's contained type, similar to boost::apply_visitor, but passing both the PathNo...
const char * getTypeName(PathNode const &node)
Gets an identifying string for the node value type. 
Internal, configured header file for verbosity macros. 
Json::Value pathTreeToJson(PathTree const &tree, bool keepNulls=false)
Serialize a path tree to a JSON array of objects, one for each node. 
boost::variant< NullElement, AliasElement, SensorElement, InterfaceElement, DeviceElement, PluginElement, StringElement > PathElement
The variant type containing a particular kind of path element. 
Json::Value pathNodeToJson(PathNode const &node)
Serialize a path node to a JSON object.