HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_XMLNode.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_XMLNode.h ( Library, C++)
7  *
8  * COMMENTS:
9  * The XML node uses the libxml2 API documented at:
10  * http://xmlsoft.org/html/libxml-tree.html#xmlNode
11  *
12  */
13 
14 #ifndef __UT_XMLNode__
15 #define __UT_XMLNode__
16 
17 #include "UT_API.h"
18 #include "UT_Array.h"
19 #include "UT_StringHolder.h"
20 
21 // When compiling a library as static, we need to define LIBXML_STATIC
22 #if !defined(LIBXML_STATIC) && defined(MAKING_STATIC)
23 #define LIBXML_STATIC
24 #endif
25 #include <libxml/tree.h>
26 
27 struct _xmlNode;
28 typedef struct _xmlNode *xmlNodePtr;
29 
30 class UT_XMLNode;
32 
33 // Enumeration of different XML node types.
34 // http://xmlsoft.org/html/libxml-tree.html#xmlElementType
35 typedef xmlElementType UT_XMLNodeType;
36 #define UT_XML_NO_NODETYPE 0
37 
39 {
40 public:
41  /// Constructor.
42  explicit UT_XMLNode(xmlNodePtr node);
43 
44  /// Destructor.
45  ~UT_XMLNode();
46 
47  UT_XMLNode(const UT_XMLNode &) = delete;
48  UT_XMLNode &operator=(const UT_XMLNode &) = delete;
49 
50  /// Return the node name.
51  const UT_StringHolder &getName();
52 
53  /// Return the list of children
54  /// @warning Not threadsafe
55  const UT_XMLNodeList &getChildren();
56 
57  /// Return the contents of the node.
58  /// Return an empty string if this is not a contents node.
59  /// @warning Not threadsafe
60  const UT_StringHolder &getContents();
61 
62  /// Return the line number that this node appears in
63  /// in the file or in memory.
64  int getLineNumber() const;
65 
66 private:
67  xmlNodePtr myNode;
68  UT_StringHolder myName;
69  UT_StringHolder myContents;
70  UT_XMLNodeList myChildren;
71 };
72 
73 #endif
74 
struct _xmlNode * xmlNodePtr
Definition: UT_XMLNode.h:28
#define UT_API
Definition: UT_API.h:14
UT_Array< UT_XMLNode * > UT_XMLNodeList
Definition: UT_XMLNode.h:30
GU_API GA_OffsetArray getChildren(const GU_Detail *gdp, const GA_Offset &node, bool recurse=false)
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
xmlElementType UT_XMLNodeType
Definition: UT_XMLNode.h:35
LeafData & operator=(const LeafData &)=delete