include line number information in wxXmlNode (based on patch #1803492 by Heikki Linnakangas)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-09-30 11:09:54 +00:00
parent 43de415736
commit 6e26d6b78c
3 changed files with 47 additions and 14 deletions

View File

@@ -103,10 +103,16 @@ class WXDLLIMPEXP_XML wxXmlNode
{
public:
wxXmlNode()
: m_attrs(NULL), m_parent(NULL), m_children(NULL), m_next(NULL) {}
: m_attrs(NULL), m_parent(NULL), m_children(NULL), m_next(NULL),
m_lineNo(-1)
{
}
wxXmlNode(wxXmlNode *parent, wxXmlNodeType type,
const wxString& name, const wxString& content = wxEmptyString,
wxXmlAttribute *attrs = NULL, wxXmlNode *next = NULL);
wxXmlAttribute *attrs = NULL, wxXmlNode *next = NULL,
int lineNo = -1);
virtual ~wxXmlNode();
// copy ctor & operator=. Note that this does NOT copy syblings
@@ -118,7 +124,8 @@ public:
// user-friendly creation:
wxXmlNode(wxXmlNodeType type, const wxString& name,
const wxString& content = wxEmptyString);
const wxString& content = wxEmptyString,
int lineNo = -1);
virtual void AddChild(wxXmlNode *child);
virtual bool InsertChild(wxXmlNode *child, wxXmlNode *before_node);
virtual bool RemoveChild(wxXmlNode *child);
@@ -152,6 +159,8 @@ public:
const wxString& defaultVal) const;
bool HasAttribute(const wxString& attrName) const;
int GetLineNumber() const { return m_lineNo; }
void SetType(wxXmlNodeType type) { m_type = type; }
void SetName(const wxString& name) { m_name = name; }
void SetContent(const wxString& con) { m_content = con; }
@@ -202,6 +211,7 @@ private:
wxString m_content;
wxXmlAttribute *m_attrs;
wxXmlNode *m_parent, *m_children, *m_next;
int m_lineNo; // line number in original file, or -1
void DoCopy(const wxXmlNode& node);
};