![]() |
Ember
|
XML serializer using libxml2 for behavior tree files. More...
#include <LibXMLBehaviorTreeSerializer.h>
Classes | |
| struct | SerializeError |
| Error information for serialization failures. More... | |
Public Member Functions | |
| LibXMLBehaviorTreeSerializer (const ParserConfig &config) | |
| Constructor with parser configuration. | |
| ~LibXMLBehaviorTreeSerializer () | |
| Destructor. | |
| bool | SerializeToFile (std::shared_ptr< BehaviorTree > tree, const EmberCore::String &filepath) |
| Serialize behavior tree to file. | |
| EmberCore::String | SerializeToString (std::shared_ptr< BehaviorTree > tree) |
| Serialize behavior tree to string. | |
| bool | HasErrors () const |
| Error handling. | |
| const std::vector< SerializeError > & | GetErrors () const |
| void | ClearErrors () |
| const ParserConfig & | GetConfig () const |
| Configuration management. | |
| void | SetConfig (const ParserConfig &config) |
Private Member Functions | |
| xmlDocPtr | CreateXMLDocument (std::shared_ptr< BehaviorTree > tree) |
| Create XML document from behavior tree. | |
| xmlNodePtr | SerializeBehaviorTree (std::shared_ptr< BehaviorTree > tree, xmlNodePtr parent) |
| Serialize a single behavior tree to XML node. | |
| xmlNodePtr | SerializeNode (Node *node, xmlNodePtr parent) |
| Recursively serialize a node and its children. | |
| void | SerializeAttributes (Node *node, xmlNodePtr xml_node) |
| Serialize node attributes. | |
| xmlNodePtr | SerializeBlackboard (Blackboard *blackboard, xmlNodePtr parent) |
| Serialize blackboard. | |
| void | AddError (SerializeError::Type type, const EmberCore::String &message) |
| Error handling. | |
| EmberCore::String | GetElementNameForNode (Node *node) const |
| Get node element name based on node type and config. | |
Private Attributes | |
| ParserConfig | config_ |
| std::vector< SerializeError > | errors_ |
XML serializer using libxml2 for behavior tree files.
This serializer mirrors the LibXMLBehaviorTreeParser, converting behavior trees back to XML format while preserving comments, formatting, and respecting the active parser profile configuration.
Features:
Definition at line 32 of file LibXMLBehaviorTreeSerializer.h.
|
explicit |
Constructor with parser configuration.
| config | Parser configuration to respect for element/attribute naming |
Definition at line 10 of file LibXMLBehaviorTreeSerializer.cpp.
| EmberCore::LibXMLBehaviorTreeSerializer::~LibXMLBehaviorTreeSerializer | ( | ) |
Destructor.
Definition at line 12 of file LibXMLBehaviorTreeSerializer.cpp.
|
private |
Error handling.
Definition at line 283 of file LibXMLBehaviorTreeSerializer.cpp.
|
inline |
Definition at line 78 of file LibXMLBehaviorTreeSerializer.h.
|
private |
Create XML document from behavior tree.
| tree | Behavior tree to serialize |
Definition at line 92 of file LibXMLBehaviorTreeSerializer.cpp.
|
inline |
Configuration management.
Definition at line 83 of file LibXMLBehaviorTreeSerializer.h.
|
private |
Get node element name based on node type and config.
Definition at line 288 of file LibXMLBehaviorTreeSerializer.cpp.
|
inline |
Definition at line 77 of file LibXMLBehaviorTreeSerializer.h.
|
inline |
Error handling.
Definition at line 76 of file LibXMLBehaviorTreeSerializer.h.
|
private |
Serialize node attributes.
| node | Source node |
| xml_node | Target XML node |
Definition at line 226 of file LibXMLBehaviorTreeSerializer.cpp.
|
private |
Serialize a single behavior tree to XML node.
| tree | Behavior tree to serialize |
| parent | Parent XML node |
Definition at line 130 of file LibXMLBehaviorTreeSerializer.cpp.
|
private |
Serialize blackboard.
| blackboard | Blackboard to serialize |
| parent | Parent XML node |
Definition at line 248 of file LibXMLBehaviorTreeSerializer.cpp.
|
private |
Recursively serialize a node and its children.
| node | Node to serialize |
| parent | Parent XML node |
Definition at line 172 of file LibXMLBehaviorTreeSerializer.cpp.
| bool EmberCore::LibXMLBehaviorTreeSerializer::SerializeToFile | ( | std::shared_ptr< BehaviorTree > | tree, |
| const EmberCore::String & | filepath ) |
Serialize behavior tree to file.
| tree | Behavior tree to serialize |
| filepath | Output file path |
Definition at line 16 of file LibXMLBehaviorTreeSerializer.cpp.
| EmberCore::String EmberCore::LibXMLBehaviorTreeSerializer::SerializeToString | ( | std::shared_ptr< BehaviorTree > | tree | ) |
Serialize behavior tree to string.
| tree | Behavior tree to serialize |
Definition at line 55 of file LibXMLBehaviorTreeSerializer.cpp.
|
inline |
Definition at line 84 of file LibXMLBehaviorTreeSerializer.h.
|
private |
Definition at line 136 of file LibXMLBehaviorTreeSerializer.h.
|
private |
Definition at line 137 of file LibXMLBehaviorTreeSerializer.h.