aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llxml/llxmlnode.h
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llxml/llxmlnode.h
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llxml/llxmlnode.h')
-rw-r--r--linden/indra/llxml/llxmlnode.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/linden/indra/llxml/llxmlnode.h b/linden/indra/llxml/llxmlnode.h
index e73b4b1..d4e127b 100644
--- a/linden/indra/llxml/llxmlnode.h
+++ b/linden/indra/llxml/llxmlnode.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -87,12 +88,13 @@ class LLVector3d;
87class LLVector4; 88class LLVector4;
88class LLVector4U; 89class LLVector4U;
89 90
90struct LLXMLChildren 91struct LLXMLChildren : public LLThreadSafeRefCount
91{ 92{
92 LLXMLChildList map; // Map of children names->pointers 93 LLXMLChildList map; // Map of children names->pointers
93 LLXMLNodePtr head; // Head of the double-linked list 94 LLXMLNodePtr head; // Head of the double-linked list
94 LLXMLNodePtr tail; // Tail of the double-linked list 95 LLXMLNodePtr tail; // Tail of the double-linked list
95}; 96};
97typedef LLPointer<LLXMLChildren> LLXMLChildrenPtr;
96 98
97class LLXMLNode : public LLThreadSafeRefCount 99class LLXMLNode : public LLThreadSafeRefCount
98{ 100{
@@ -124,11 +126,13 @@ public:
124 LLXMLNode(); 126 LLXMLNode();
125 LLXMLNode(const char* name, BOOL is_attribute); 127 LLXMLNode(const char* name, BOOL is_attribute);
126 LLXMLNode(LLStringTableEntry* name, BOOL is_attribute); 128 LLXMLNode(LLStringTableEntry* name, BOOL is_attribute);
129 LLXMLNode(const LLXMLNode& rhs);
130 LLXMLNodePtr deepCopy();
127 131
128 BOOL isNull(); 132 BOOL isNull();
129 133
130 BOOL deleteChild(LLXMLNode* child); 134 BOOL deleteChild(LLXMLNode* child);
131 void addChild(LLXMLNodePtr new_parent); 135 void addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child = LLXMLNodePtr(NULL));
132 void setParent(LLXMLNodePtr new_parent); // reparent if necessary 136 void setParent(LLXMLNodePtr new_parent); // reparent if necessary
133 137
134 // Serialization 138 // Serialization
@@ -146,8 +150,9 @@ public:
146 LLXMLNodePtr& node, 150 LLXMLNodePtr& node,
147 LLXMLNode* defaults); 151 LLXMLNode* defaults);
148 static bool updateNode( 152 static bool updateNode(
149 LLXMLNodePtr& node, 153 LLXMLNodePtr& node,
150 LLXMLNodePtr& update_node); 154 LLXMLNodePtr& update_node);
155 static LLXMLNodePtr replaceNode(LLXMLNodePtr node, LLXMLNodePtr replacement_node);
151 static void writeHeaderToFile(LLFILE *fOut); 156 static void writeHeaderToFile(LLFILE *fOut);
152 void writeToFile(LLFILE *fOut, const std::string& indent = std::string()); 157 void writeToFile(LLFILE *fOut, const std::string& indent = std::string());
153 void writeToOstream(std::ostream& output_stream, const std::string& indent = std::string()); 158 void writeToOstream(std::ostream& output_stream, const std::string& indent = std::string());
@@ -176,6 +181,10 @@ public:
176 181
177 BOOL hasAttribute(const char* name ); 182 BOOL hasAttribute(const char* name );
178 183
184 // these are designed to be more generic versions of the functions
185 // rather than relying on LL-types
186 bool getAttribute_bool(const char* name, bool& value );
187
179 BOOL getAttributeBOOL(const char* name, BOOL& value ); 188 BOOL getAttributeBOOL(const char* name, BOOL& value );
180 BOOL getAttributeU8(const char* name, U8& value ); 189 BOOL getAttributeU8(const char* name, U8& value );
181 BOOL getAttributeS8(const char* name, S8& value ); 190 BOOL getAttributeS8(const char* name, S8& value );
@@ -211,13 +220,16 @@ public:
211 bool getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); 220 bool getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
212 void getChildren(const char* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const; 221 void getChildren(const char* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const;
213 void getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const; 222 void getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const;
223
224 // recursively finds all children at any level matching name
225 void getDescendants(const LLStringTableEntry* name, LLXMLNodeList &children) const;
214 226
215 bool getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); 227 bool getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
216 bool getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); 228 bool getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE);
217 229
218 // The following skip over attributes 230 // The following skip over attributes
219 LLXMLNodePtr getFirstChild(); 231 LLXMLNodePtr getFirstChild() const;
220 LLXMLNodePtr getNextSibling(); 232 LLXMLNodePtr getNextSibling() const;
221 233
222 LLXMLNodePtr getRoot(); 234 LLXMLNodePtr getRoot();
223 235
@@ -251,7 +263,6 @@ public:
251 void setName(LLStringTableEntry* name); 263 void setName(LLStringTableEntry* name);
252 264
253 // Escapes " (quot) ' (apos) & (amp) < (lt) > (gt) 265 // Escapes " (quot) ' (apos) & (amp) < (lt) > (gt)
254 // TomY TODO: Make this private
255 static std::string escapeXML(const std::string& xml); 266 static std::string escapeXML(const std::string& xml);
256 267
257 // Set the default node corresponding to this default node 268 // Set the default node corresponding to this default node
@@ -291,7 +302,7 @@ public:
291 Encoding mEncoding; // The value encoding 302 Encoding mEncoding; // The value encoding
292 303
293 LLXMLNode* mParent; // The parent node 304 LLXMLNode* mParent; // The parent node
294 LLXMLChildren* mChildren; // The child nodes 305 LLXMLChildrenPtr mChildren; // The child nodes
295 LLXMLAttribList mAttributes; // The attribute nodes 306 LLXMLAttribList mAttributes; // The attribute nodes
296 LLXMLNodePtr mPrev; // Double-linked list previous node 307 LLXMLNodePtr mPrev; // Double-linked list previous node
297 LLXMLNodePtr mNext; // Double-linked list next node 308 LLXMLNodePtr mNext; // Double-linked list next node