Accessors for Xml_node utility

This patch adds accessors to obtain the buffer of an attribute value,
which is useful to avoid the copying-out of such information by
maintaining pointers into the XML string as meta data.
This commit is contained in:
Norman Feske 2014-01-21 22:32:18 +01:00
parent c265cfa593
commit 276a1775f1

View File

@ -123,7 +123,8 @@ namespace Genode {
/**
* Return size of value
*/
size_t value_size() const { return _value.len(); }
size_t value_size() const { return _value.len() - 2; }
char const *value_base() const { return _value.start() + 1; }
/**
* Return attribute value as null-terminated string
@ -550,9 +551,16 @@ namespace Genode {
* Note that the returned string is not null-terminated as it
* points directly into a sub range of the unmodified Xml_node
* address range.
*
* XXX This function is deprecated. Use 'content_base()' instead.
*/
char *content_addr() const { return _start_tag.next_token().start(); }
/**
* Return pointer to start of content
*/
char const *content_base() const { return content_addr(); }
/**
* Return size of node content
*/