From ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 30 Apr 2009 13:04:20 -0500 Subject: Second Life viewer sources 1.23.0-RC --- linden/indra/llxml/llxmlnode.h | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'linden/indra/llxml/llxmlnode.h') 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 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -87,12 +88,13 @@ class LLVector3d; class LLVector4; class LLVector4U; -struct LLXMLChildren +struct LLXMLChildren : public LLThreadSafeRefCount { LLXMLChildList map; // Map of children names->pointers LLXMLNodePtr head; // Head of the double-linked list LLXMLNodePtr tail; // Tail of the double-linked list }; +typedef LLPointer LLXMLChildrenPtr; class LLXMLNode : public LLThreadSafeRefCount { @@ -124,11 +126,13 @@ public: LLXMLNode(); LLXMLNode(const char* name, BOOL is_attribute); LLXMLNode(LLStringTableEntry* name, BOOL is_attribute); + LLXMLNode(const LLXMLNode& rhs); + LLXMLNodePtr deepCopy(); BOOL isNull(); BOOL deleteChild(LLXMLNode* child); - void addChild(LLXMLNodePtr new_parent); + void addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child = LLXMLNodePtr(NULL)); void setParent(LLXMLNodePtr new_parent); // reparent if necessary // Serialization @@ -146,8 +150,9 @@ public: LLXMLNodePtr& node, LLXMLNode* defaults); static bool updateNode( - LLXMLNodePtr& node, - LLXMLNodePtr& update_node); + LLXMLNodePtr& node, + LLXMLNodePtr& update_node); + static LLXMLNodePtr replaceNode(LLXMLNodePtr node, LLXMLNodePtr replacement_node); static void writeHeaderToFile(LLFILE *fOut); void writeToFile(LLFILE *fOut, const std::string& indent = std::string()); void writeToOstream(std::ostream& output_stream, const std::string& indent = std::string()); @@ -176,6 +181,10 @@ public: BOOL hasAttribute(const char* name ); + // these are designed to be more generic versions of the functions + // rather than relying on LL-types + bool getAttribute_bool(const char* name, bool& value ); + BOOL getAttributeBOOL(const char* name, BOOL& value ); BOOL getAttributeU8(const char* name, U8& value ); BOOL getAttributeS8(const char* name, S8& value ); @@ -211,13 +220,16 @@ public: bool getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); void getChildren(const char* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const; void getChildren(const LLStringTableEntry* name, LLXMLNodeList &children, BOOL use_default_if_missing = TRUE) const; + + // recursively finds all children at any level matching name + void getDescendants(const LLStringTableEntry* name, LLXMLNodeList &children) const; bool getAttribute(const char* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); bool getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, BOOL use_default_if_missing = TRUE); // The following skip over attributes - LLXMLNodePtr getFirstChild(); - LLXMLNodePtr getNextSibling(); + LLXMLNodePtr getFirstChild() const; + LLXMLNodePtr getNextSibling() const; LLXMLNodePtr getRoot(); @@ -251,7 +263,6 @@ public: void setName(LLStringTableEntry* name); // Escapes " (quot) ' (apos) & (amp) < (lt) > (gt) - // TomY TODO: Make this private static std::string escapeXML(const std::string& xml); // Set the default node corresponding to this default node @@ -291,7 +302,7 @@ public: Encoding mEncoding; // The value encoding LLXMLNode* mParent; // The parent node - LLXMLChildren* mChildren; // The child nodes + LLXMLChildrenPtr mChildren; // The child nodes LLXMLAttribList mAttributes; // The attribute nodes LLXMLNodePtr mPrev; // Double-linked list previous node LLXMLNodePtr mNext; // Double-linked list next node -- cgit v1.1