Xml_node: replace value(T *out) by value(T &out)

Promote the use of references instead of pointers.

Issue #1987
This commit is contained in:
Norman Feske 2019-01-21 09:34:42 +01:00
parent 98a75b1a78
commit fdbf30fc4c
1 changed files with 19 additions and 4 deletions

View File

@ -152,7 +152,7 @@ class Genode::Xml_attribute
* conversion failed
*/
template <typename T>
bool value(T *out) const
bool value(T &out) const
{
/*
* The '_value' token starts with a quote, which we
@ -160,9 +160,17 @@ class Genode::Xml_attribute
* the length, we have to consider both the starting
* and the trailing quote character.
*/
return ascii_to(_value.start() + 1, *out) == _value.len() - 2;
return ascii_to(_value.start() + 1, out) == _value.len() - 2;
}
/**
* Return attribute value as typed value
*
* \deprecated use 'value(T &out)' instead
*/
template <typename T>
bool value(T *out) const { return value(*out); }
/**
* Return attribute value as Genode::String
*/
@ -625,8 +633,15 @@ class Genode::Xml_node
* \return true on success
*/
template <typename T>
bool value(T *out) const {
return ascii_to(content_addr(), *out) == content_size(); }
bool value(T &out) const {
return ascii_to(content_addr(), out) == content_size(); }
/**
* Read content as typed value from XML node
*
* \deprecated use 'value(T &out)' instead
*/
template <typename T> bool value(T *out) const { return value(*out); }
/**
* Return begin of node including the start tag