#include <rutz/value.h>
Public Member Functions | |
value () | |
Default constructor. | |
virtual | ~value () |
Virtual destructor ensures proper destruction of base classes. | |
virtual rutz::fstring | value_typename () const =0 |
Return a string giving the name of the native type. | |
virtual void | print_to (std::ostream &os) const =0 |
Write the value to a std::ostream . | |
virtual void | scan_from (std::istream &is)=0 |
Read the value from a std::istream . | |
rutz::fstring | get_string () const |
Get an rutz::fstring representation of the value. | |
void | set_string (rutz::fstring val) |
Set the value from an rutz::fstring. |
rutz::value
defines an interface for variant-type value objects that can be converted to+from a string representation. Subclasses may allow conversion among types so that a value of any basic type can be retrieved, or they may allow only one basic type to be retrieved.
Definition at line 57 of file value.h.
rutz::fstring rutz::value::get_string | ( | ) | const |
Get an rutz::fstring
representation of the value.
Builds a string stream, calls print_to(), and returns its value.
Definition at line 58 of file value.cc.
References print_to().
void rutz::value::set_string | ( | rutz::fstring | val | ) |
Set the value from an rutz::fstring.
Builds a string stream from val and calling scan_from() with it.
Definition at line 66 of file value.cc.
References rutz::fstring::c_str(), and scan_from().
Referenced by GbVec2< double >::GbVec2(), and GbVec3< double >::GbVec3().