3D Repo Bouncer  1.4
Public Member Functions | List of all members
repo::lib::PropertyTree Class Reference

Public Member Functions

 PropertyTree (const bool &enableJSONWorkAround)
 
void addArrayObjects (const std::string &label, const std::vector< PropertyTree > &value)
 
template<typename T >
void addFieldAttribute (const std::string &label, const std::string &attribute, const T &value)
 
template<typename T >
void addFieldAttribute (const std::string &label, const std::string &attribute, const std::vector< T > &value, const bool &useDelimiter=true)
 
template<typename T >
void addToTree (const std::string &label, const T &value)
 
template<std::size_t N>
void addToTree (const std::string &label, const char(&value)[N])
 
template<typename T >
void addToTree (const std::string &label, const std::vector< T > &value, const bool &join=true)
 
void disableJSONWorkaround ()
 
void mergeSubTree (const std::string &label, const PropertyTree &subTree)
 
void write_json (std::iostream &stream) const
 
void write_xml (std::iostream &stream) const
 
template<>
void addFieldAttribute (const std::string &label, const std::string &attribute, const std::string &value)
 
template<>
void addFieldAttribute (const std::string &label, const std::string &attribute, const repo_vector_t &value)
 
template<>
void addToTree (const std::string &label, const repoUUID &value)
 
template<>
void addToTree (const std::string &label, const repo_vector_t &value)
 
template<>
void addToTree (const std::string &label, const std::vector< PropertyTree > &value, const bool &join)
 
template<>
void addToTree (const std::string &label, const repo_vector_t &value)
 
template<>
void addToTree (const std::string &label, const repoUUID &value)
 

Member Function Documentation

void repo::lib::PropertyTree::addArrayObjects ( const std::string &  label,
const std::vector< PropertyTree > &  value 
)
inline

Add an array of objects to the tree at a specified level This is used for things like arrays of objects within JSON

Parameters
labelindicating where the child lives in the tree
valuevector of children to add
template<typename T >
void repo::lib::PropertyTree::addFieldAttribute ( const std::string &  label,
const std::string &  attribute,
const T &  value 
)
inline

Add an attribute to the field This is very xml specific it is to achieve things like <FIELD name="Hi"> instead of <FIELD>"Hi"</FIELD> The type fo the value can be of any type as long as it is a qualified member of std::to_string()

Parameters
labelfield name to add to
attributename of attribute
valuevalue of attribute
template<typename T >
void repo::lib::PropertyTree::addFieldAttribute ( const std::string &  label,
const std::string &  attribute,
const std::vector< T > &  value,
const bool &  useDelimiter = true 
)
inline

Add an attribute to the field This is very xml specific it is to achieve things like <FIELD name="Hi"> instead of <FIELD>"Hi"</FIELD> The type of the vector can be of any type as long as it is a qualified member of std::to_string()

Parameters
labelfield name to add to
attributename of attribute
valuevalue of attribute
template<typename T >
void repo::lib::PropertyTree::addToTree ( const std::string &  label,
const T &  value 
)
inline

Add a children onto the tree label can denote it's inheritance. for e.g. trunk.branch.leaf would denote the child name is leaf, with parent branch and grandparent trunk.

Parameters
labelindicating where the child lives in the tree
valuevalue of the children
template<typename T >
void repo::lib::PropertyTree::addToTree ( const std::string &  label,
const std::vector< T > &  value,
const bool &  join = true 
)
inline

Add an array of values to the tree at a specified level This is used for things like arrays within JSON

Parameters
labelindicating where the child lives in the tree
valuevector of children to add
joinmerge vector into a string value instead of putting in a vector
void repo::lib::PropertyTree::disableJSONWorkaround ( )
inline

Disable the JSON workaround for quotes There is currently a work around to allow json parser writes to remove quotes from anything that isn't a string. Calling this function will disable it. You might want to do this BEFORE you add any data into the tree for XML or any non JSON exports

void repo::lib::PropertyTree::mergeSubTree ( const std::string &  label,
const PropertyTree subTree 
)
inline

Merging sub tree into this tree

Parameters
labellabel where the subTree goes
subTreethe sub tree to add
void repo::lib::PropertyTree::write_json ( std::iostream &  stream) const
inline

Write tree data onto a stream

Parameters
streamstream to write onto
void repo::lib::PropertyTree::write_xml ( std::iostream &  stream) const
inline

Write tree data onto a stream

Parameters
streamstream to write onto

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