X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b5cc5cbd6670e0e9ac9e22d02157c6e9502ab1b3..de536319f16406adf967003637b2655c61f6cb09:/interface/xml/xml.h diff --git a/interface/xml/xml.h b/interface/xml/xml.h index c584e3e5ea..bbc63c62ed 100644 --- a/interface/xml/xml.h +++ b/interface/xml/xml.h @@ -58,9 +58,16 @@ public: //@} /** - Adds the given node as child of this node. To attach a second children to this - node, use the - SetNext() function of the @a child node. + Adds node @a child as the last child of this node. + + @note + Note that this function works in O(n) time where @e n is the number + of existing children. Consequently, adding large number of child + nodes using this method can be expensive, because it has O(n^2) time + complexity in number of nodes to be added. Use InsertChildAfter() to + populate XML tree in linear time. + + @see InsertChild(), InsertChildAfter() */ void AddChild(wxXmlNode* child); @@ -157,14 +164,39 @@ public: bool HasAttribute(const wxString& attrName) const; /** - Inserts the @a child node after @a before_node in the children list. - If @a before_node is @NULL, then @a child is prepended to the list of - children and - becomes the first child of this node. - Returns @true if @a before_node has been found and the @a child node has been - inserted. + Inserts the @a child node immediately before @a followingNode in the + children list. + + @return @true if @a followingNode has been found and the @a child + node has been inserted. + + @note + For historical reasons, @a followingNode may be @NULL. In that case, + then @a child is prepended to the list of children and becomes the + first child of this node, i.e. it behaves identically to using the + first children (as returned by GetChildren()) for @a followingNode). + + @see AddChild(), InsertChildAfter() + */ + bool InsertChild(wxXmlNode* child, wxXmlNode* followingNode); + + /** + Inserts the @a child node immediately after @a precedingNode in the + children list. + + @return @true if @a precedingNode has been found and the @a child + node has been inserted. + + @param precedingNode + The node to insert @a child after. As a special case, this can be + @NULL if this node has no children yet -- in that case, @a child + will become this node's only child node. + + @since 2.8.8 + + @see InsertChild(), AddChild() */ - bool InsertChild(wxXmlNode* child, wxXmlNode* before_node); + bool InsertChildAfter(wxXmlNode* child, wxXmlNode* precedingNode); /** Returns @true if the content of this node is a string containing only @@ -350,7 +382,7 @@ public: } @endcode - @b Note: if you want to preserve the original formatting of the loaded file + @note if you want to preserve the original formatting of the loaded file including whitespaces and indentation, you need to turn off whitespace-only textnode removal and automatic indentation: @@ -408,7 +440,7 @@ public: /** Returns encoding of in-memory representation of the document (same as passed to Load() or constructor, defaults to UTF-8). - NB: this is meaningless in Unicode build where data are stored as @c wchar_t*. + @note this is meaningless in Unicode build where data are stored as @c wchar_t*. */ wxString GetEncoding() const;