25 #ifndef INCLUDED_GetJSONStringFromTree_h_GUID_031FFB6A_B837_4080_4784_53730E86669E 26 #define INCLUDED_GetJSONStringFromTree_h_GUID_031FFB6A_B837_4080_4784_53730E86669E 34 #include <boost/variant.hpp> 42 struct GetStringVisitor : boost::static_visitor<std::string> {
46 template <
typename T> std::string operator()(
T const &)
const {
51 inline std::string getJSONStringAtNode(
PathNode const &node) {
52 return boost::apply_visitor(GetStringVisitor(), node.value());
54 inline std::string getJSONStringFromTree(PathTree
const &tree,
55 std::string
const &path) {
57 auto const &desiredNode = tree.getNodeByPath(path);
58 return getJSONStringAtNode(desiredNode);
59 }
catch (util::tree::NoSuchChild &) {
66 #endif // INCLUDED_GetJSONStringFromTree_h_GUID_031FFB6A_B837_4080_4784_53730E86669E Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
::osvr::util::TreeNode< PathElement > PathNode
The specific tree node type that contains a path element.
Definition: PathNode_fwd.h:42
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
The element type corresponding to a string value such as a JSON string.
Definition: PathElementTypes.h:217
A small structure to hold a non zero as a triplet (i,j,value).
Definition: SparseUtil.h:148
OSVR_COMMON_EXPORT std::string & getString()
Get/set (if non const) the stored string.
Definition: PathElementTypes.cpp:83