Add wxXmlResourceHandler::GetNodeAttribute()
Add another helper function that can be used in XRC handlers without using wxXmlNode directly.
This commit is contained in:
parent
921018cfc8
commit
fe599e4757
4 changed files with 34 additions and 0 deletions
|
|
@ -511,6 +511,11 @@ public:
|
|||
// Returns the name of the node, e.g. "object" or "sizeritem".
|
||||
wxString GetNodeName(const wxXmlNode *node) const override;
|
||||
|
||||
// Returns the value of the given attribute under the node.
|
||||
wxString GetNodeAttribute(const wxXmlNode *node,
|
||||
const wxString& attrName,
|
||||
const wxString& defaultValue) const override;
|
||||
|
||||
// Gets node content from wxXML_ENTITY_NODE
|
||||
// The problem is, <tag>content<tag> is represented as
|
||||
// wxXML_ENTITY_NODE name="tag", content=""
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ public:
|
|||
virtual bool IsOfClass(wxXmlNode *node, const wxString& classname) const = 0;
|
||||
virtual bool IsObjectNode(const wxXmlNode *node) const = 0;
|
||||
virtual wxString GetNodeName(const wxXmlNode *node) const = 0;
|
||||
virtual wxString GetNodeAttribute(const wxXmlNode *node,
|
||||
const wxString& attrName,
|
||||
const wxString& defaultValue) const = 0;
|
||||
virtual wxString GetNodeContent(const wxXmlNode *node) const = 0;
|
||||
virtual wxXmlNode *GetNodeParent(const wxXmlNode *node) const = 0;
|
||||
virtual wxXmlNode *GetNodeNext(const wxXmlNode *node) const = 0;
|
||||
|
|
@ -247,6 +250,13 @@ protected:
|
|||
return GetImpl()->GetNodeName(node);
|
||||
}
|
||||
|
||||
wxString GetNodeAttribute(const wxXmlNode *node,
|
||||
const wxString& attrName,
|
||||
const wxString& defaultValue = {}) const
|
||||
{
|
||||
return GetImpl()->GetNodeAttribute(node, attrName, defaultValue);
|
||||
}
|
||||
|
||||
wxString GetNodeContent(const wxXmlNode *node) const
|
||||
{
|
||||
return GetImpl()->GetNodeContent(node);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue