XML node type and attribute name string accessors

Issue #1786
This commit is contained in:
Emery Hemingway
2015-11-23 13:34:17 +01:00
committed by Christian Helmuth
parent d891016632
commit 4aafa882d8

View File

@ -21,6 +21,7 @@ namespace Genode {
class Xml_attribute; class Xml_attribute;
class Xml_node; class Xml_node;
} }
@ -104,6 +105,10 @@ class Genode::Xml_attribute
strncpy(dst, _name.start(), max_len); strncpy(dst, _name.start(), max_len);
} }
typedef String<64> Name;
Name name() const {
return Name(_name.start(), _name.len()); }
/** /**
* Return true if attribute has specified type * Return true if attribute has specified type
*/ */
@ -607,6 +612,13 @@ class Genode::Xml_node
void type_name(char *dst, size_t max_len) const { void type_name(char *dst, size_t max_len) const {
_start_tag.name().string(dst, max_len); } _start_tag.name().string(dst, max_len); }
typedef String<64> Type;
Type type() const
{
Token name = _start_tag.name();
return Type(name.start(), name.len());
}
/** /**
* Return true if tag is of specified type * Return true if tag is of specified type
*/ */