#include <sdf/sdf.hh>
Inherits std::enable_shared_from_this< Element >.
Public Member Functions | |
Element () | |
Constructor. | |
virtual | ~Element () |
Destructor. | |
void | AddAttribute (const std::string &_key, const std::string &_type, const std::string &_defaultvalue, bool _required, const std::string &_description="") |
Add an attribute value. | |
void | AddAttribute (const std::string &_key, const std::string &_type, const std::string &_defaultvalue, bool _required, sdf::Errors &_errors, const std::string &_description="") |
Add an attribute value. | |
ElementPtr | AddElement (const std::string &_name) |
Add a named element. | |
ElementPtr | AddElement (const std::string &_name, sdf::Errors &_errors) |
Add a named element. | |
void | AddValue (const std::string &_type, const std::string &_defaultValue, bool _required, const std::string &_description="") |
Add a value to this Element. | |
void | AddValue (const std::string &_type, const std::string &_defaultValue, bool _required, const std::string &_minValue, const std::string &_maxValue, const std::string &_description="") |
Add a value to this Element. | |
void | AddValue (const std::string &_type, const std::string &_defaultValue, bool _required, const std::string &_minValue, const std::string &_maxValue, sdf::Errors &_errors, const std::string &_description="") |
Add a value to this Element. | |
void | AddValue (const std::string &_type, const std::string &_defaultValue, bool _required, sdf::Errors &_errors, const std::string &_description="") |
Add a value to this Element. | |
void | Clear () |
Remove all child elements and reset file path and original version. | |
void | ClearElements () |
Remove all child elements. | |
ElementPtr | Clone () const |
Create a copy of this Element. | |
ElementPtr | Clone (sdf::Errors &_errors) const |
Create a copy of this Element. | |
void | Copy (const ElementPtr _elem) |
Copy values from an Element. | |
void | Copy (const ElementPtr _elem, sdf::Errors &_errors) |
Copy values from an Element. | |
std::map< std::string, std::size_t > | CountNamedElements (const std::string &_type, const std::vector< std::string > &_ignoreElements) const |
Count the number of child elements of the specified element type that have the same name attribute value with the exception of elements listed in _ignoreElements . | |
std::map< std::string, std::size_t > | CountNamedElements (const std::string &_type="") const |
Count the number of child elements of the specified element type that have the same name attribute value. | |
std::map< std::string, std::size_t > | CountNamedElements (sdf::Errors &_errors, const std::string &_type, const std::vector< std::string > &_ignoreElements) const |
Count the number of child elements of the specified element type that have the same name attribute value with the exception of elements listed in _ignoreElements . | |
std::map< std::string, std::size_t > | CountNamedElements (sdf::Errors &_errors, const std::string &_type="") const |
Count the number of child elements of the specified element type that have the same name attribute value. | |
const std::string & | FilePath () const |
Get the path to the SDF document where this element came from. | |
ElementPtr | FindElement (const std::string &_name) |
Return a pointer to the child element with the provided name. | |
ElementConstPtr | FindElement (const std::string &_name) const |
Return a pointer to the child element with the provided name. | |
template<typename T > | |
std::pair< T, bool > | Get (const std::string &_key, const T &_defaultValue) const |
Get the value of a key. | |
template<typename T > | |
bool | Get (const std::string &_key, T &_param, const T &_defaultValue) const |
Get the value of a key. | |
template<typename T > | |
T | Get (const std::string &_key="") const |
Get the value of a key. | |
template<typename T > | |
std::pair< T, bool > | Get (sdf::Errors &_errors, const std::string &_key, const T &_defaultValue) const |
Get the value of a key. | |
template<typename T > | |
bool | Get (sdf::Errors &_errors, const std::string &_key, T &_param, const T &_defaultValue) const |
Get the value of a key. | |
template<typename T > | |
T | Get (sdf::Errors &_errors, const std::string &_key="") const |
Get the value of a key. | |
std::any | GetAny (const std::string &_key="") const |
Get the element value/attribute as a std::any. | |
std::any | GetAny (sdf::Errors &_errors, const std::string &_key="") const |
Get the element value/attribute as a std::any. | |
ParamPtr | GetAttribute (const std::string &_key) const |
Get the param of an attribute. | |
ParamPtr | GetAttribute (unsigned int _index) const |
Get an attribute using an index. | |
size_t | GetAttributeCount () const |
Get the number of attributes. | |
const Param_V & | GetAttributes () const |
Get all the attribute params. | |
bool | GetAttributeSet (const std::string &_key) const |
Return true if the attribute was set (i.e. | |
bool | GetCopyChildren () const |
Return true if this Element's child elements should be copied during parsing. | |
ElementPtr | GetElement (const std::string &_name) |
Return a pointer to the child element with the provided name. | |
ElementPtr | GetElement (const std::string &_name, sdf::Errors &_errors) |
Return a pointer to the child element with the provided name. | |
ElementPtr | GetElementDescription (const std::string &_key) const |
Get an element description using a key. | |
ElementPtr | GetElementDescription (unsigned int _index) const |
Get an element description using an index. | |
size_t | GetElementDescriptionCount () const |
Get the number of element descriptions. | |
std::set< std::string > | GetElementTypeNames () const |
Get set of child element type names. | |
bool | GetExplicitlySetInFile () const |
Return if the element was been explicitly set in the file. | |
ElementPtr | GetFirstElement () const |
Get the first child element. | |
sdf::ElementPtr | GetIncludeElement () const |
Get the element that was used to load this element. | |
const std::string & | GetName () const |
Get the Element's name. | |
ElementPtr | GetNextElement (const std::string &_name="") const |
Get the next sibling of this element. | |
ElementPtr | GetParent () const |
Get a pointer to this Element's parent. | |
const std::string & | GetRequired () const |
Get the requirement string. | |
ParamPtr | GetValue () const |
Get the param of the elements value return A Param pointer to the value of this element. | |
bool | HasAttribute (const std::string &_key) const |
Return true if an attribute exists. | |
bool | HasElement (const std::string &_name) const |
Return true if the named element exists. | |
bool | HasElementDescription (const std::string &_name) const |
Return true if an element description exists. | |
bool | HasUniqueChildNames (const std::string &_type, const std::vector< std::string > &_ignoreElements) const |
Checks whether any child elements of the specified element type, except those listed in _ignoreElements , have identical name attribute values and returns false if so. | |
bool | HasUniqueChildNames (const std::string &_type="") const |
Checks whether any child elements of the specified element type have identical name attribute values and returns false if so. | |
bool | HasUniqueChildNames (sdf::Errors &_errors, const std::string &_type, const std::vector< std::string > &_ignoreElements) const |
Checks whether any child elements of the specified element type, except those listed in _ignoreElements , have identical name attribute values and returns false if so. | |
bool | HasUniqueChildNames (sdf::Errors &_errors, const std::string &_type="") const |
Checks whether any child elements of the specified element type have identical name attribute values and returns false if so. | |
void | InsertElement (ElementPtr _elem) |
Add an element object. | |
void | InsertElement (ElementPtr _elem, bool _setParentToSelf) |
Add an element object, and optionally set the given element's parent to this object. | |
std::optional< int > | LineNumber () const |
Get the line number of this element within the SDF document. | |
void | PrintDescription (const std::string &_prefix) const |
Output Element's description to stdout. | |
void | PrintDescription (sdf::Errors &_errors, const std::string &_prefix) const |
Output Element's description to stdout. | |
void | PrintDocLeftPane (std::string &_html, int _spacing, int &_index) const |
Helper function for SDF::PrintDoc. | |
void | PrintDocRightPane (std::string &_html, int _spacing, int &_index) const |
Helper function for SDF::PrintDoc. | |
void | PrintValues (const std::string &_prefix, bool _includeDefaultElements, bool _includeDefaultAttributes, const PrintConfig &_config=PrintConfig()) const |
Output Element's values to stdout. | |
void | PrintValues (sdf::Errors &_errors, const std::string &_prefix, bool _includeDefaultElements, bool _includeDefaultAttributes, const PrintConfig &_config=PrintConfig()) const |
Output Element's values to stdout. | |
void | PrintValues (sdf::Errors &_errors, std::string _prefix, const PrintConfig &_config=PrintConfig()) const |
Output Element's values to stdout. | |
void | PrintValues (std::string _prefix, const PrintConfig &_config=PrintConfig()) const |
Output Element's values to stdout. | |
std::string | ReferenceSDF () const |
Get the name of the reference SDF element. | |
void | RemoveAllAttributes () |
Removes all attributes. | |
void | RemoveAttribute (const std::string &_key) |
Remove an attribute. | |
void | RemoveChild (ElementPtr _child) |
Remove a child element. | |
void | RemoveChild (ElementPtr _child, sdf::Errors &_errors) |
Remove a child element. | |
void | RemoveFromParent () |
Remove this element from its parent. | |
void | Reset () |
Call reset on each element and element description before deleting all of them. | |
template<typename T > | |
bool | Set (const T &_value) |
Set the value of this element. | |
template<typename T > | |
bool | Set (sdf::Errors &_errors, const T &_value) |
Set the value of this element. | |
void | SetCopyChildren (bool _value) |
Set whether this element should copy its child elements during parsing. | |
void | SetExplicitlySetInFile (const bool _value) |
Set if the element and children where set or default in the original file. | |
void | SetFilePath (const std::string &_path) |
Set the path to the SDF document where this element came from. | |
void | SetIncludeElement (sdf::ElementPtr _includeElem) |
Set the element that was used to load this element. | |
void | SetLineNumber (int _lineNumber) |
Set the line number of this element within the SDF document. | |
void | SetName (const std::string &_name) |
Set the name of the Element. | |
void | SetParent (const ElementPtr _parent) |
Set the parent of this Element. | |
void | SetReferenceSDF (const std::string &_value) |
Set reference SDF element. | |
void | SetRequired (const std::string &_req) |
Set the requirement type. | |
std::string | ToString (const std::string &_prefix, bool _includeDefaultElements, bool _includeDefaultAttributes, const PrintConfig &_config=PrintConfig()) const |
Convert the element values to a string representation. | |
std::string | ToString (const std::string &_prefix, const PrintConfig &_config=PrintConfig()) const |
Convert the element values to a string representation. | |
std::string | ToString (sdf::Errors &_errors, const std::string &_prefix, bool _includeDefaultElements, bool _includeDefaultAttributes, const PrintConfig &_config=PrintConfig()) const |
Convert the element values to a string representation. | |
std::string | ToString (sdf::Errors &_errors, const std::string &_prefix, const PrintConfig &_config=PrintConfig()) const |
Convert the element values to a string representation. | |
void | Update () |
Call the Update() callback on each element, as well as the embedded Param. | |
void | Update (sdf::Errors &_errors) |
Call the Update() callback on each element, as well as the embedded Param. | |
="default"]/model[@name="robot1"]/link[@name="link"]) | |
Set the XML path of this element. | |
void | SetXmlPath (const std::string &_path) |
Private data pointer. | |
const std::string & | XmlPath () const |
Get the XML path of this element. | |
void | SetOriginalVersion (const std::string &_version) |
Set the spec version that this was originally parsed from. | |
const std::string & | OriginalVersion () const |
Get the spec version that this was originally parsed from. | |
std::string | GetDescription () const |
Get a text description of the element. | |
void | SetDescription (const std::string &_desc) |
Set a text description for the element. | |
void | AddElementDescription (ElementPtr _elem) |
Add a new element description. | |
ElementPtr | GetElementImpl (const std::string &_name) const |
Get a pointer to the named element. | |
static std::vector< std::string > | NameUniquenessExceptions () |
List of elements to which exceptions are made when checking for name uniqueness. | |
sdf::SDF_VERSION_NAMESPACE::Element::Element | ( | ) |
Constructor.
|
virtual |
Destructor.
void sdf::SDF_VERSION_NAMESPACE::Element::AddAttribute | ( | const std::string & | _key, |
const std::string & | _type, | ||
const std::string & | _defaultvalue, | ||
bool | _required, | ||
const std::string & | _description = "" |
||
) |
Add an attribute value.
[in] | _key | Key value. |
[in] | _type | Type of data the attribute will hold. |
[in] | _defaultValue | Default value for the attribute. |
[in] | _required | Requirement string. \as Element::SetRequired. |
[in] | _description | A text description of the attribute. |
sdf::AssertionInternalError | if an invalid type is given. |
void sdf::SDF_VERSION_NAMESPACE::Element::AddAttribute | ( | const std::string & | _key, |
const std::string & | _type, | ||
const std::string & | _defaultvalue, | ||
bool | _required, | ||
sdf::Errors & | _errors, | ||
const std::string & | _description = "" |
||
) |
Add an attribute value.
[in] | _key | Key value. |
[in] | _type | Type of data the attribute will hold. |
[in] | _defaultValue | Default value for the attribute. |
[in] | _required | Requirement string. \as Element::SetRequired. |
[out] | _errors | Vector of errors. |
[in] | _description | A text description of the attribute. |
sdf::AssertionInternalError | if an invalid type is given. |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::AddElement | ( | const std::string & | _name | ) |
Add a named element.
[in] | _name | the name of the element to add. |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::AddElement | ( | const std::string & | _name, |
sdf::Errors & | _errors | ||
) |
Add a named element.
[in] | _name | the name of the element to add. |
[out] | _errors | Vector of errors. |
void sdf::SDF_VERSION_NAMESPACE::Element::AddElementDescription | ( | ElementPtr | _elem | ) |
Add a new element description.
[in] | _elem | the Element object to add to the descriptions. |
void sdf::SDF_VERSION_NAMESPACE::Element::AddValue | ( | const std::string & | _type, |
const std::string & | _defaultValue, | ||
bool | _required, | ||
const std::string & | _description = "" |
||
) |
Add a value to this Element.
[in] | _type | Type of data the parameter will hold. |
[in] | _defaultValue | Default value for the parameter. |
[in] | _required | Requirement string. \as Element::SetRequired. |
[in] | _description | A text description of the parameter. |
sdf::AssertionInternalError | if an invalid type is given. |
void sdf::SDF_VERSION_NAMESPACE::Element::AddValue | ( | const std::string & | _type, |
const std::string & | _defaultValue, | ||
bool | _required, | ||
const std::string & | _minValue, | ||
const std::string & | _maxValue, | ||
const std::string & | _description = "" |
||
) |
Add a value to this Element.
This override allows passing min and max values of the parameter.
[in] | _type | Type of data the parameter will hold. |
[in] | _defaultValue | Default value for the parameter. |
[in] | _required | Requirement string. \as Element::SetRequired. |
[in] | _minValue | Minimum allowed value for the parameter. |
[in] | _maxValue | Maximum allowed value for the parameter. |
[in] | _description | A text description of the parameter. |
sdf::AssertionInternalError | if an invalid type is given. |
void sdf::SDF_VERSION_NAMESPACE::Element::AddValue | ( | const std::string & | _type, |
const std::string & | _defaultValue, | ||
bool | _required, | ||
const std::string & | _minValue, | ||
const std::string & | _maxValue, | ||
sdf::Errors & | _errors, | ||
const std::string & | _description = "" |
||
) |
Add a value to this Element.
This override allows passing min and max values of the parameter.
[in] | _type | Type of data the parameter will hold. |
[in] | _defaultValue | Default value for the parameter. |
[in] | _required | Requirement string. \as Element::SetRequired. |
[in] | _minValue | Minimum allowed value for the parameter. |
[in] | _maxValue | Maximum allowed value for the parameter. |
[out] | _errors | Vector of errors. |
[in] | _description | A text description of the parameter. |
sdf::AssertionInternalError | if an invalid type is given. |
void sdf::SDF_VERSION_NAMESPACE::Element::AddValue | ( | const std::string & | _type, |
const std::string & | _defaultValue, | ||
bool | _required, | ||
sdf::Errors & | _errors, | ||
const std::string & | _description = "" |
||
) |
Add a value to this Element.
[in] | _type | Type of data the parameter will hold. |
[in] | _defaultValue | Default value for the parameter. |
[in] | _required | Requirement string. \as Element::SetRequired. |
[out] | _errors | Vector of errors. |
[in] | _description | A text description of the parameter. |
sdf::AssertionInternalError | if an invalid type is given. |
void sdf::SDF_VERSION_NAMESPACE::Element::Clear | ( | ) |
Remove all child elements and reset file path and original version.
void sdf::SDF_VERSION_NAMESPACE::Element::ClearElements | ( | ) |
Remove all child elements.
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::Clone | ( | ) | const |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::Clone | ( | sdf::Errors & | _errors | ) | const |
void sdf::SDF_VERSION_NAMESPACE::Element::Copy | ( | const ElementPtr | _elem | ) |
void sdf::SDF_VERSION_NAMESPACE::Element::Copy | ( | const ElementPtr | _elem, |
sdf::Errors & | _errors | ||
) |
std::map< std::string, std::size_t > sdf::SDF_VERSION_NAMESPACE::Element::CountNamedElements | ( | const std::string & | _type, |
const std::vector< std::string > & | _ignoreElements | ||
) | const |
Count the number of child elements of the specified element type that have the same name attribute value with the exception of elements listed in _ignoreElements
.
[in] | _type | The type of Element to check. If empty, count names of all child elements. |
[in] | _ignoreElements | A list of child element types to ignore when checking for uniqueness. |
std::map< std::string, std::size_t > sdf::SDF_VERSION_NAMESPACE::Element::CountNamedElements | ( | const std::string & | _type = "" | ) | const |
Count the number of child elements of the specified element type that have the same name attribute value.
[in] | _type | The type of Element to check. If empty, count names of all child elements. |
std::map< std::string, std::size_t > sdf::SDF_VERSION_NAMESPACE::Element::CountNamedElements | ( | sdf::Errors & | _errors, |
const std::string & | _type, | ||
const std::vector< std::string > & | _ignoreElements | ||
) | const |
Count the number of child elements of the specified element type that have the same name attribute value with the exception of elements listed in _ignoreElements
.
[out] | _errors | Vector of errors. |
[in] | _type | The type of Element to check. If empty, count names of all child elements. |
[in] | _ignoreElements | A list of child element types to ignore when checking for uniqueness. |
std::map< std::string, std::size_t > sdf::SDF_VERSION_NAMESPACE::Element::CountNamedElements | ( | sdf::Errors & | _errors, |
const std::string & | _type = "" |
||
) | const |
Count the number of child elements of the specified element type that have the same name attribute value.
[out] | _errors | Vector of errors. |
[in] | _type | The type of Element to check. If empty, count names of all child elements. |
const std::string & sdf::SDF_VERSION_NAMESPACE::Element::FilePath | ( | ) | const |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::FindElement | ( | const std::string & | _name | ) |
Return a pointer to the child element with the provided name.
Unlike GetElement, this does not create a new child element if it fails to find an existing element.
[in] | _name | Name of the child element to retreive. |
ElementConstPtr sdf::SDF_VERSION_NAMESPACE::Element::FindElement | ( | const std::string & | _name | ) | const |
Return a pointer to the child element with the provided name.
Unlike GetElement, this does not create a new child element if it fails to find an existing element.
[in] | _name | Name of the child element to retreive. |
std::any sdf::SDF_VERSION_NAMESPACE::Element::GetAny | ( | const std::string & | _key = "" | ) | const |
Get the element value/attribute as a std::any.
[in] | _key | The key of the attribute. If empty, get the value of the element. Defaults to empty. |
std::any sdf::SDF_VERSION_NAMESPACE::Element::GetAny | ( | sdf::Errors & | _errors, |
const std::string & | _key = "" |
||
) | const |
Get the element value/attribute as a std::any.
[in] | _key | The key of the attribute. If empty, get the value of the element. Defaults to empty. |
[out] | _errors | Vector of errors. |
ParamPtr sdf::SDF_VERSION_NAMESPACE::Element::GetAttribute | ( | const std::string & | _key | ) | const |
Get the param of an attribute.
[in] | _key | the name of the attribute. |
Referenced by Get().
ParamPtr sdf::SDF_VERSION_NAMESPACE::Element::GetAttribute | ( | unsigned int | _index | ) | const |
Get an attribute using an index.
[in] | _index | the index of the attribute to get. |
size_t sdf::SDF_VERSION_NAMESPACE::Element::GetAttributeCount | ( | ) | const |
Get the number of attributes.
const Param_V & sdf::SDF_VERSION_NAMESPACE::Element::GetAttributes | ( | ) | const |
Get all the attribute params.
bool sdf::SDF_VERSION_NAMESPACE::Element::GetAttributeSet | ( | const std::string & | _key | ) | const |
Return true if the attribute was set (i.e.
not default value)
[in] | _key | the key to use to find the attribute. |
bool sdf::SDF_VERSION_NAMESPACE::Element::GetCopyChildren | ( | ) | const |
Return true if this Element's child elements should be copied during parsing.
std::string sdf::SDF_VERSION_NAMESPACE::Element::GetDescription | ( | ) | const |
Get a text description of the element.
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetElement | ( | const std::string & | _name | ) |
Return a pointer to the child element with the provided name.
A new child element, with the provided name, is added to this element if there is no existing child element. If this is not desired see FindElement
[in] | _name | Name of the child element to retreive. |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetElement | ( | const std::string & | _name, |
sdf::Errors & | _errors | ||
) |
Return a pointer to the child element with the provided name.
A new child element, with the provided name, is added to this element if there is no existing child element. If this is not desired see FindElement
[in] | _name | Name of the child element to retreive. |
[out] | _errors | Vector of errors. |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetElementDescription | ( | const std::string & | _key | ) | const |
Get an element description using a key.
[in] | _key | the key to use to find the element. |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetElementDescription | ( | unsigned int | _index | ) | const |
size_t sdf::SDF_VERSION_NAMESPACE::Element::GetElementDescriptionCount | ( | ) | const |
Get the number of element descriptions.
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetElementImpl | ( | const std::string & | _name | ) | const |
Get a pointer to the named element.
[in] | _name | the name of the element to look for. |
Referenced by Get().
std::set< std::string > sdf::SDF_VERSION_NAMESPACE::Element::GetElementTypeNames | ( | ) | const |
Get set of child element type names.
bool sdf::SDF_VERSION_NAMESPACE::Element::GetExplicitlySetInFile | ( | ) | const |
Return if the element was been explicitly set in the file.
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetFirstElement | ( | ) | const |
Get the first child element.
sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetIncludeElement | ( | ) | const |
Get the element that was used to load this element.
const std::string & sdf::SDF_VERSION_NAMESPACE::Element::GetName | ( | ) | const |
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetNextElement | ( | const std::string & | _name = "" | ) | const |
Get the next sibling of this element.
[in] | _name | if given then filter siblings by their xml tag. |
This can be used in combination with GetFirstElement() to walk the SDF tree. First call parent->GetFirstElement() to get the first child. Call child = child->GetNextElement() to iterate through the children.
ElementPtr sdf::SDF_VERSION_NAMESPACE::Element::GetParent | ( | ) | const |
const std::string & sdf::SDF_VERSION_NAMESPACE::Element::GetRequired | ( | ) | const |
ParamPtr sdf::SDF_VERSION_NAMESPACE::Element::GetValue | ( | ) | const |
Get the param of the elements value return A Param pointer to the value of this element.
bool sdf::SDF_VERSION_NAMESPACE::Element::HasAttribute | ( | const std::string & | _key | ) | const |
Return true if an attribute exists.
[in] | _key | the key to use to find the attribute. |
bool sdf::SDF_VERSION_NAMESPACE::Element::HasElement | ( | const std::string & | _name | ) | const |
Return true if the named element exists.
[in] | _name | the name of the element to look for. |
Referenced by Get().
bool sdf::SDF_VERSION_NAMESPACE::Element::HasElementDescription | ( | const std::string & | _name | ) | const |
Return true if an element description exists.
[in] | _name | the name of the element to find. |
Referenced by Get().
bool sdf::SDF_VERSION_NAMESPACE::Element::HasUniqueChildNames | ( | const std::string & | _type, |
const std::vector< std::string > & | _ignoreElements | ||
) | const |
Checks whether any child elements of the specified element type, except those listed in _ignoreElements
, have identical name attribute values and returns false if so.
[in] | _type | The type of Element to check. If empty, check names of all child elements. |
[in] | _ignoreElements | A list of child element types to ignore when checking for uniqueness. |
bool sdf::SDF_VERSION_NAMESPACE::Element::HasUniqueChildNames | ( | const std::string & | _type = "" | ) | const |
Checks whether any child elements of the specified element type have identical name attribute values and returns false if so.
[in] | _type | The type of Element to check. If empty, check names of all child elements. |
bool sdf::SDF_VERSION_NAMESPACE::Element::HasUniqueChildNames | ( | sdf::Errors & | _errors, |
const std::string & | _type, | ||
const std::vector< std::string > & | _ignoreElements | ||
) | const |
Checks whether any child elements of the specified element type, except those listed in _ignoreElements
, have identical name attribute values and returns false if so.
[out] | _errors | Vector of errors. |
[in] | _type | The type of Element to check. If empty, check names of all child elements. |
[in] | _ignoreElements | A list of child element types to ignore when checking for uniqueness. |
bool sdf::SDF_VERSION_NAMESPACE::Element::HasUniqueChildNames | ( | sdf::Errors & | _errors, |
const std::string & | _type = "" |
||
) | const |
Checks whether any child elements of the specified element type have identical name attribute values and returns false if so.
[out] | _errors | Vector of errors. |
[in] | _type | The type of Element to check. If empty, check names of all child elements. |
void sdf::SDF_VERSION_NAMESPACE::Element::InsertElement | ( | ElementPtr | _elem | ) |
Add an element object.
[in] | _elem | the element object to add. |
void sdf::SDF_VERSION_NAMESPACE::Element::InsertElement | ( | ElementPtr | _elem, |
bool | _setParentToSelf | ||
) |
Add an element object, and optionally set the given element's parent to this object.
[in] | _elem | the element object to add. |
[in] | _setParentToSelf | If true, set the _elem's parent to this object and then insert. |
std::optional< int > sdf::SDF_VERSION_NAMESPACE::Element::LineNumber | ( | ) | const |
Get the line number of this element within the SDF document.
|
static |
List of elements to which exceptions are made when checking for name uniqueness.
const std::string & sdf::SDF_VERSION_NAMESPACE::Element::OriginalVersion | ( | ) | const |
Get the spec version that this was originally parsed from.
void sdf::SDF_VERSION_NAMESPACE::Element::PrintDescription | ( | const std::string & | _prefix | ) | const |
Output Element's description to stdout.
[in] | _prefix | String value to prefix to the output. |
void sdf::SDF_VERSION_NAMESPACE::Element::PrintDescription | ( | sdf::Errors & | _errors, |
const std::string & | _prefix | ||
) | const |
Output Element's description to stdout.
[out] | _errors | Vector of errors. |
[in] | _prefix | String value to prefix to the output. |
void sdf::SDF_VERSION_NAMESPACE::Element::PrintDocLeftPane | ( | std::string & | _html, |
int | _spacing, | ||
int & | _index | ||
) | const |
Helper function for SDF::PrintDoc.
This generates the SDF html documentation.
[out] | _html | Accumulated HTML for output. |
[in] | _spacing | Amount of spacing for this element. |
[in] | _index | Unique index for this element. |
void sdf::SDF_VERSION_NAMESPACE::Element::PrintDocRightPane | ( | std::string & | _html, |
int | _spacing, | ||
int & | _index | ||
) | const |
Helper function for SDF::PrintDoc.
This generates the SDF html documentation.
[out] | _html | Accumulated HTML for output. |
[in] | _spacing | Amount of spacing for this element. |
void sdf::SDF_VERSION_NAMESPACE::Element::PrintValues | ( | const std::string & | _prefix, |
bool | _includeDefaultElements, | ||
bool | _includeDefaultAttributes, | ||
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Output Element's values to stdout.
[in] | _prefix | String value to prefix to the output. |
[in] | _includeDefaultElements | flag to print default elements. |
[in] | _includeDefaultAttributes | flag to print default attributes. |
[in] | _config | Configuration for printing the values. |
void sdf::SDF_VERSION_NAMESPACE::Element::PrintValues | ( | sdf::Errors & | _errors, |
const std::string & | _prefix, | ||
bool | _includeDefaultElements, | ||
bool | _includeDefaultAttributes, | ||
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Output Element's values to stdout.
[out] | _errors | Vector of errors. |
[in] | _prefix | String value to prefix to the output. |
[in] | _includeDefaultElements | flag to print default elements. |
[in] | _includeDefaultAttributes | flag to print default attributes. |
[in] | _config | Configuration for printing the values. |
void sdf::SDF_VERSION_NAMESPACE::Element::PrintValues | ( | sdf::Errors & | _errors, |
std::string | _prefix, | ||
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Output Element's values to stdout.
[out] | _errors | Vector of errors. |
[in] | _prefix | String value to prefix to the output. |
[in] | _config | Configuration for printing the values. |
void sdf::SDF_VERSION_NAMESPACE::Element::PrintValues | ( | std::string | _prefix, |
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Output Element's values to stdout.
[in] | _prefix | String value to prefix to the output. |
[in] | _config | Configuration for printing the values. |
std::string sdf::SDF_VERSION_NAMESPACE::Element::ReferenceSDF | ( | ) | const |
void sdf::SDF_VERSION_NAMESPACE::Element::RemoveAllAttributes | ( | ) |
Removes all attributes.
void sdf::SDF_VERSION_NAMESPACE::Element::RemoveAttribute | ( | const std::string & | _key | ) |
Remove an attribute.
[in] | _key | the key of the attribute. |
void sdf::SDF_VERSION_NAMESPACE::Element::RemoveChild | ( | ElementPtr | _child | ) |
Remove a child element.
[in] | _child | Pointer to the child to remove. |
void sdf::SDF_VERSION_NAMESPACE::Element::RemoveChild | ( | ElementPtr | _child, |
sdf::Errors & | _errors | ||
) |
Remove a child element.
[in] | _child | Pointer to the child to remove. |
[out] | _errors | Vector of errors. |
void sdf::SDF_VERSION_NAMESPACE::Element::RemoveFromParent | ( | ) |
Remove this element from its parent.
void sdf::SDF_VERSION_NAMESPACE::Element::Reset | ( | ) |
Call reset on each element and element description before deleting all of them.
Also clear out the embedded Param.
void sdf::SDF_VERSION_NAMESPACE::Element::SetCopyChildren | ( | bool | _value | ) |
Set whether this element should copy its child elements during parsing.
[in] | _value | True to copy Element's children. |
void sdf::SDF_VERSION_NAMESPACE::Element::SetDescription | ( | const std::string & | _desc | ) |
Set a text description for the element.
[in] | _desc | the text description to set for the element. |
void sdf::SDF_VERSION_NAMESPACE::Element::SetExplicitlySetInFile | ( | const bool | _value | ) |
Set if the element and children where set or default in the original file.
This is meant to be used by the parser to indicate whether the element was set by the user in the original file or added by default during parsing.
[in] | _value | True if the element was set |
void sdf::SDF_VERSION_NAMESPACE::Element::SetFilePath | ( | const std::string & | _path | ) |
void sdf::SDF_VERSION_NAMESPACE::Element::SetIncludeElement | ( | sdf::ElementPtr | _includeElem | ) |
void sdf::SDF_VERSION_NAMESPACE::Element::SetLineNumber | ( | int | _lineNumber | ) |
Set the line number of this element within the SDF document.
[in] | _lineNumber | Line number of element. |
void sdf::SDF_VERSION_NAMESPACE::Element::SetName | ( | const std::string & | _name | ) |
void sdf::SDF_VERSION_NAMESPACE::Element::SetOriginalVersion | ( | const std::string & | _version | ) |
Set the spec version that this was originally parsed from.
[in] | _version | Spec version string. |
void sdf::SDF_VERSION_NAMESPACE::Element::SetParent | ( | const ElementPtr | _parent | ) |
Set the parent of this Element.
[in] | _parent | Parent for this element. |
void sdf::SDF_VERSION_NAMESPACE::Element::SetReferenceSDF | ( | const std::string & | _value | ) |
Set reference SDF element.
[in] | _value | Name of the reference sdf element. |
void sdf::SDF_VERSION_NAMESPACE::Element::SetRequired | ( | const std::string & | _req | ) |
Set the requirement type.
[in] | _req | Requirement type for this element: -1: Deprecated. 0: Not required. 1: Exactly one element is required. +: One or more elements are required. *: Zero or more elements are required. |
void sdf::SDF_VERSION_NAMESPACE::Element::SetXmlPath | ( | const std::string & | _path | ) |
Private data pointer.
std::string sdf::SDF_VERSION_NAMESPACE::Element::ToString | ( | const std::string & | _prefix, |
bool | _includeDefaultElements, | ||
bool | _includeDefaultAttributes, | ||
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Convert the element values to a string representation.
Current behavior of ToString(const std::string &_prefix) can be achieved by calling this function with _includeDefaultElements=true and _includeDefaultAttributes=false
[in] | _prefix | String value to prefix to the output. |
[in] | _includeDefaultElements | flag to include default elements. |
[in] | _includeDefaultAttributes | flag to include default attributes. |
[in] | _config | Configuration for converting to string. |
std::string sdf::SDF_VERSION_NAMESPACE::Element::ToString | ( | const std::string & | _prefix, |
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Convert the element values to a string representation.
[in] | _prefix | String value to prefix to the output. |
[in] | _config | Configuration for printing the values. |
std::string sdf::SDF_VERSION_NAMESPACE::Element::ToString | ( | sdf::Errors & | _errors, |
const std::string & | _prefix, | ||
bool | _includeDefaultElements, | ||
bool | _includeDefaultAttributes, | ||
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Convert the element values to a string representation.
Current behavior of ToString(const std::string &_prefix) can be achieved by calling this function with _includeDefaultElements=true and _includeDefaultAttributes=false
[out] | _errors | Vector of errors. |
[in] | _prefix | String value to prefix to the output. |
[in] | _includeDefaultElements | flag to include default elements. |
[in] | _includeDefaultAttributes | flag to include default attributes. |
[in] | _config | Configuration for converting to string. |
std::string sdf::SDF_VERSION_NAMESPACE::Element::ToString | ( | sdf::Errors & | _errors, |
const std::string & | _prefix, | ||
const PrintConfig & | _config = PrintConfig() |
||
) | const |
Convert the element values to a string representation.
[out] | _errors | Vector of errors. |
[in] | _prefix | String value to prefix to the output. |
[in] | _config | Configuration for printing the values. |
void sdf::SDF_VERSION_NAMESPACE::Element::Update | ( | ) |
void sdf::SDF_VERSION_NAMESPACE::Element::Update | ( | sdf::Errors & | _errors | ) |
const std::string & sdf::SDF_VERSION_NAMESPACE::Element::XmlPath | ( | ) | const |
Get the XML path of this element.