#include <XmlReader.hpp>
Public Member Functions | |
default_value (data_t &object, const data_t &default_object) | |
Friends | |
class | XmlReader |
Assume that the user wants to read an object from an XML input stream but she is not sure if it can actually be found in the stream. Assume further that in case the object can not be read the user just wants to set it to a default value. Then she can use a default_value to accomplish this task in a compact way.
The alternate way to handle this situation would be to try to read the object and to explicitly handle XmlNoTagException exceptions.
imaging::XmlReader::default_value< data_t >::default_value | ( | data_t & | object, | |
const data_t & | default_object | |||
) | [inline] |
Passing this command to an XML input stream reads object from the stream if it is present at the current stream path. If not, it sets object to default_object.