00001
00002
00003
00004
00005
00006
00007
00008
00014 #ifndef _FU_XML_WRITER_H_
00015 #define _FU_XML_WRITER_H_
00016
00017 #ifdef HAS_LIBXML
00018
00027 namespace FUXmlWriter
00028 {
00032 FCOLLADA_EXPORT xmlNode* CreateNode(const char* name);
00033
00038 FCOLLADA_EXPORT void AddChild(xmlNode* parent, xmlNode* child);
00039
00043 FCOLLADA_EXPORT void RenameNode(xmlNode* node, const char* newName);
00044
00050 FCOLLADA_EXPORT xmlNode* AddChild(xmlNode* parent, const char* name);
00051
00059 FCOLLADA_EXPORT xmlNode* AddChild(xmlNode* parent, const char* name, const char* content);
00060 #ifdef UNICODE
00061 FCOLLADA_EXPORT xmlNode* AddChild(xmlNode* parent, const char* name, const fstring& content);
00062 #endif
00063 inline xmlNode* AddChild(xmlNode* parent, const char* name, const fm::string& content) { return AddChild(parent, name, content.c_str()); }
00064 inline xmlNode* AddChild(xmlNode* parent, const char* name, FUSStringBuilder& content) { return AddChild(parent, name, content.ToCharPtr()); }
00070 FCOLLADA_EXPORT void AddContentUnprocessed(xmlNode* node, const char* content);
00071 inline void AddContentUnprocessed(xmlNode* node, const fm::string& content) { return AddContentUnprocessed(node, content.c_str()); }
00072 inline void AddContentUnprocessed(xmlNode* node, FUSStringBuilder& content) { return AddContentUnprocessed(node, content.ToCharPtr()); }
00081 template <typename T> inline xmlNode* AddChild(xmlNode* parent, const char* name, const T& value) { xmlNode* child = AddChild(parent, name); FUSStringBuilder builder; builder.set(value); AddContentUnprocessed(child, builder.ToCharPtr()); return child; }
00082
00088 FCOLLADA_EXPORT void AddSibling(xmlNode* sibling, xmlNode* dangling);
00089
00096 FCOLLADA_EXPORT xmlNode* AddSibling(xmlNode* sibling, const char* name);
00097
00103 FCOLLADA_EXPORT xmlNode* InsertChild(xmlNode* parent, xmlNode* sibling, const char* name);
00104
00112 FCOLLADA_EXPORT xmlNode* AddChildOnce(xmlNode* parent, const char* name, const char* content=NULL);
00113 inline xmlNode* AddChildOnce(xmlNode* parent, const char* name, const fm::string& content) { return AddChildOnce(parent, name, content.c_str()); }
00114 inline xmlNode* AddChildOnce(xmlNode* parent, const char* name, FUSStringBuilder& content) { return AddChildOnce(parent, name, content.ToCharPtr()); }
00123 template <typename T> inline xmlNode* AddChildOnce(xmlNode* parent, const char* name, const T& value) { xmlNode* child = AddChildOnce(parent, name); FUSStringBuilder builder(value); AddContentUnprocessed(child, builder.ToCharPtr()); return child; }
00124
00130 FCOLLADA_EXPORT void AddContent(xmlNode* node, const char* content);
00131 #ifdef UNICODE
00132 FCOLLADA_EXPORT void AddContent(xmlNode* node, const fstring& content);
00133 #endif
00134 inline void AddContent(xmlNode* node, const fm::string& content) { AddContent(node, content.c_str()); }
00135 inline void AddContent(xmlNode* node, FUSStringBuilder& content) { AddContent(node, content.ToCharPtr()); }
00140 FCOLLADA_EXPORT void ConvertFilename(fstring& str);
00141
00146 template <typename T> inline void AddContent(xmlNode* node, const T& value) { FUSStringBuilder builder(value); return AddContentUnprocessed(node, builder.ToCharPtr()); }
00147
00153 FCOLLADA_EXPORT void AddAttribute(xmlNode* node, const char* attributeName, const char* attributeValue);
00154 #ifdef UNICODE
00155 FCOLLADA_EXPORT void AddAttribute(xmlNode* node, const char* attributeName, const fstring& attributeValue);
00156 #endif
00157 inline void AddAttribute(xmlNode* node, const char* attributeName, FUSStringBuilder& attributeValue) { AddAttribute(node, attributeName, attributeValue.ToCharPtr()); }
00158 inline void AddAttribute(xmlNode* node, const char* attributeName, const fm::string& attributeValue) { AddAttribute(node, attributeName, attributeValue.c_str()); }
00165 template <typename T> inline void AddAttribute(xmlNode* node, const char* attributeName, const T& attributeValue) { FUSStringBuilder builder; builder.set(attributeValue); AddAttribute(node, attributeName, builder.ToCharPtr()); }
00166
00170 FCOLLADA_EXPORT void RemoveAttribute(xmlNode* node, const char* attributeName);
00171
00177 FCOLLADA_EXPORT void AddChildSorted(xmlNode* parent, xmlNode* child);
00178
00186 FCOLLADA_EXPORT xmlNode* AddChildSorted(xmlNode* parent, const char* name, const char* content=NULL);
00187
00192 FCOLLADA_EXPORT void ReParentNode(xmlNode* node, xmlNode* newParent);
00193 };
00194
00195 #endif // HAS_LIBXML
00196
00197 #endif // _FU_XML_WRITER_H_