PLaSK library
|
Base class for callbacks used by save() method to get names of objects and paths. More...
#include <plask/geometry/object.hpp>
Public Member Functions | |
WriteXMLCallback () | |
void | prerareToAutonaming (const GeometryObject &subtree_root) |
Calling of this method allows for automatic name generation when saving some subtrees using this. | |
virtual std::string | getName (const GeometryObject &object, AxisNames &axesNames) const |
Get name of given object . | |
virtual std::vector< std::string > | getPathNames (const GeometryObject &parent, const GeometryObject &child, std::size_t index_of_child_in_parent) const |
Get names of path fragment from parent to child . | |
XMLWriter::Element | makeTag (XMLElement &parent_tag, const GeometryObject &object, AxisNames &axesNames) |
Append to XML tag, with optional name (obtain by getName), and axes attribute. | |
XMLElement | makeChildTag (XMLElement &container_tag, const GeometryObject &container, std::size_t index_of_child_in_parent) const |
Static Public Member Functions | |
static bool | isRef (const XMLElement &el) |
Check if given XML object represents a reference to another geometry object. | |
Base class for callbacks used by save() method to get names of objects and paths.
Default implementation just returns empty names and list of names. It is enough to save geometry tree without any names or with all names auto-generated (see prerareToAutonaming).
Example (save vector of objects to dest XML in "geometry" section):
Definition at line 479 of file object.hpp.
|
inline |
Definition at line 492 of file object.hpp.
|
virtual |
Get name of given object
.
[in] | object | |
[in,out] | axesNames | axes names which was used when saved parent of object , this can assign to it new value to use in branch rooted by object |
object
or empty string if object
has no name Definition at line 67 of file object.cpp.
|
virtual |
Get names of path fragment from parent
to child
.
[in] | parent | container which contains child |
[in] | child | object from a parent container |
[in] | index_of_child_in_parent | index of child in parent real childrent list |
parent
to child
(can be empty) Definition at line 71 of file object.cpp.
|
inlinestatic |
Check if given XML object represents a reference to another geometry object.
el | XML object |
true
only if el
represents a reference Definition at line 544 of file object.hpp.
XMLElement plask::GeometryObject::WriteXMLCallback::makeChildTag | ( | XMLElement & | container_tag, |
const GeometryObject & | container, | ||
std::size_t | index_of_child_in_parent | ||
) | const |
Definition at line 107 of file object.cpp.
XMLWriter::Element plask::GeometryObject::WriteXMLCallback::makeTag | ( | XMLElement & | parent_tag, |
const GeometryObject & | object, | ||
AxisNames & | axesNames | ||
) |
Append to XML tag, with optional name (obtain by getName), and axes attribute.
It is also possible that this creates a reference tag, and this case should be checked by isRef method.
parent_tag | parent XML tag | |
object | object to write | |
[in,out] | axesNames | axis names which was used when saved parent of object , this can assign to it new value to use in branch rooted by object (assigned pointer must be valid while branch will be saved, typically it is a pointer to object in register) |
object
or reference tag. Definition at line 75 of file object.cpp.
void plask::GeometryObject::WriteXMLCallback::prerareToAutonaming | ( | const GeometryObject & | subtree_root | ) |
Calling of this method allows for automatic name generation when saving some subtrees using this.
This method must be called exactly once for root of each subtree which will be write to XML before any writes.
Definition at line 63 of file object.cpp.