A generic, discriminated value, whose type may be queried dynamically.
More...
#include <Value.h>
|
enum | FloatFormat { FloatFormatDefault = 0
, FloatFormatFixed = 1
, FloatFormatScientific = 2
} |
| Float formats to use when converting values to strings.
|
|
|
template<class T > |
static ValuePtr | createValue (const T &data) |
| Create a new value from an object of any valid MaterialX type.
|
|
static ValuePtr | createValue (const char *data) |
|
static ValuePtr | createValueFromStrings (const string &value, const string &type) |
| Create a new value instance from value and type strings. More...
|
|
|
using | CreatorFunction = ValuePtr(*)(const string &) |
|
using | CreatorMap = std::unordered_map< string, CreatorFunction > |
|
template<class T > |
class | ValueRegistry |
|
template<class T > |
bool | isA () const |
| Return true if this value is of the given type.
|
|
template<class T > |
const T & | asA () const |
| Return our underlying data as an object of the given type. More...
|
|
virtual const string & | getTypeString () const =0 |
| Return the type string for this value. More...
|
|
virtual string | getValueString () const =0 |
| Return the value string for this value. More...
|
|
static void | setFloatFormat (FloatFormat format) |
| Set float formatting for converting values to strings. More...
|
|
static void | setFloatPrecision (int precision) |
| Set float precision for converting values to strings.
|
|
static FloatFormat | getFloatFormat () |
| Return the current float format.
|
|
static int | getFloatPrecision () |
| Return the current float precision.
|
|
A generic, discriminated value, whose type may be queried dynamically.
◆ asA()
Return our underlying data as an object of the given type.
If the given type doesn't match our own data type, then an exception is thrown.
◆ copy()
◆ createValueFromStrings()
static ValuePtr createValueFromStrings |
( |
const string & |
value, |
|
|
const string & |
type |
|
) |
| |
|
static |
Create a new value instance from value and type strings.
- Returns
- A shared pointer to a typed value, or an empty shared pointer if the conversion to the given data type cannot be performed.
◆ getTypeString()
virtual const string & getTypeString |
( |
| ) |
const |
|
pure virtual |
◆ getValueString()
virtual string getValueString |
( |
| ) |
const |
|
pure virtual |
◆ setFloatFormat()
Set float formatting for converting values to strings.
Formats to use are FloatFormatFixed, FloatFormatScientific or FloatFormatDefault to set default format.
The documentation for this class was generated from the following file: