HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_OptionEntry Class Reference

#include <UT_OptionEntry.h>

+ Inheritance diagram for UT_OptionEntry:

Public Types

enum  UT_OptionTypeStorage {
  UT_OPTION_STORE_INVALID =-1, UT_OPTION_STORE_BOOL, UT_OPTION_STORE_INT, UT_OPTION_STORE_REAL,
  UT_OPTION_STORE_STRING
}
 

Public Member Functions

 UT_OptionEntry ()
 
virtual ~UT_OptionEntry ()
 
virtual UT_OptionType getType () const
 
virtual UT_OptionEntryclone () const
 
virtual int64 getMemoryUsage (bool inclusive) const
 
unsigned hash () const
 Hash a single option entry. More...
 
unsigned isEqual (const UT_OptionEntry &cmp, fpreal64 tolerance=0.0) const
 Compute equivalence for a given option entry. More...
 
bool getOptionString (UT_OptionFormat format, UT_WorkBuffer &result) const
 
bool getOptionString (UT_OptionFormat format, UT_String &result) const
 
UT_OptionTypeStorage optionStorage () const
 
exint optionSize () const
 
bool importOption (int64 &value) const
 
bool importOption (bool &value) const
 
bool importOption (fpreal64 &value) const
 
bool importOption (UT_StringHolder &value) const
 
bool importOption (UT_Vector2D &value) const
 
bool importOption (UT_Vector3D &value) const
 
bool importOption (UT_Vector4D &value) const
 
bool importOption (UT_QuaternionD &value) const
 
bool importOption (UT_Matrix2D &value) const
 
bool importOption (UT_Matrix3D &value) const
 
bool importOption (UT_Matrix4D &value) const
 
bool importOption (UT_Array< int32 > &value) const
 
bool importOption (UT_Array< int64 > &value) const
 
bool importOption (UT_Array< fpreal32 > &value) const
 
bool importOption (UT_Array< fpreal64 > &value) const
 
bool importOption (UT_StringArray &value) const
 
int64 getOptionI () const
 
bool getOptionB () const
 
fpreal64 getOptionF () const
 
const UT_Vector2DgetOptionV2 () const
 
const UT_Vector3DgetOptionV3 () const
 
const UT_Vector4DgetOptionV4 () const
 
const UT_QuaternionDgetOptionQ () const
 
const UT_Matrix2DgetOptionM2 () const
 
const UT_Matrix3DgetOptionM3 () const
 
const UT_Matrix4DgetOptionM4 () const
 
const UT_Vector2DgetOptionUV () const
 
const UT_Vector3DgetOptionUVW () const
 
UT_StringHolder getOptionS () const
 
const UT_Int64ArraygetOptionIArray () const
 
const UT_Fpreal64ArraygetOptionFArray () const
 
const UT_StringArraygetOptionSArray () const
 
bool saveJSON (UT_JSONWriter &w, bool compact) const
 
void saveJSON (UT_JSONValue &v, bool compact) const
 

Static Public Member Functions

static UT_OptionTypeStorage optionStorage (UT_OptionType t)
 Return the underlying storage type for the option. More...
 
static exint optionSize (UT_OptionType t)
 Returns the tuple size, or 0 if the option is variadic (i.e. INTARRAY) More...
 
static UT_OptionEntrycreateEntry (const UT_JSONValue &v)
 
static UT_OptionEntrycreateEntry (const UT_JSONValueMap &map, UT_String &error_str)
 
static UT_OptionType getOptionTypeFromString (const char *optiontypestr)
 Convert string to and from UT_OptionType values. More...
 
static const char * getStringFromOptionType (UT_OptionType optiontype)
 
- Static Public Member Functions inherited from UT_SmallObject< UT_OptionEntry, UT_SMALLOBJECT_CLEANPAGES_DEFAULT, UT_SMALLOBJECT_PAGESIZE_DEFAULT, UT_SMALLOBJECT_THREADSAFE_ON >
static voidoperator new (size_t size)
 Regular new/delete operators. More...
 
static void operator delete (void *p, size_t size)
 Regular new/delete operators. More...
 
static voidoperator new (size_t, void *p)
 
static void operator delete (void *, void *)
 

Detailed Description

Definition at line 64 of file UT_OptionEntry.h.

Member Enumeration Documentation

Enumerator
UT_OPTION_STORE_INVALID 
UT_OPTION_STORE_BOOL 
UT_OPTION_STORE_INT 
UT_OPTION_STORE_REAL 
UT_OPTION_STORE_STRING 

Definition at line 94 of file UT_OptionEntry.h.

Constructor & Destructor Documentation

UT_OptionEntry::UT_OptionEntry ( )
inline

Definition at line 70 of file UT_OptionEntry.h.

virtual UT_OptionEntry::~UT_OptionEntry ( )
inlinevirtual

Definition at line 72 of file UT_OptionEntry.h.

Member Function Documentation

static UT_OptionEntry* UT_OptionEntry::createEntry ( const UT_JSONValue v)
static

Create a UT_OptionEntry from a simple JSON value. This is not a dictionary with type information. It is a single value which may be an int, float, string, etc. The UT_OptionEntry type is inferred from the JSON type.

static UT_OptionEntry* UT_OptionEntry::createEntry ( const UT_JSONValueMap map,
UT_String error_str 
)
static
bool UT_OptionEntry::getOptionB ( ) const
fpreal64 UT_OptionEntry::getOptionF ( ) const
const UT_Fpreal64Array& UT_OptionEntry::getOptionFArray ( ) const
int64 UT_OptionEntry::getOptionI ( ) const
const UT_Int64Array& UT_OptionEntry::getOptionIArray ( ) const
const UT_Matrix2D& UT_OptionEntry::getOptionM2 ( ) const
const UT_Matrix3D& UT_OptionEntry::getOptionM3 ( ) const
const UT_Matrix4D& UT_OptionEntry::getOptionM4 ( ) const
const UT_QuaternionD& UT_OptionEntry::getOptionQ ( ) const
UT_StringHolder UT_OptionEntry::getOptionS ( ) const
const UT_StringArray& UT_OptionEntry::getOptionSArray ( ) const
bool UT_OptionEntry::getOptionString ( UT_OptionFormat  format,
UT_WorkBuffer result 
) const
bool UT_OptionEntry::getOptionString ( UT_OptionFormat  format,
UT_String result 
) const
static UT_OptionType UT_OptionEntry::getOptionTypeFromString ( const char *  optiontypestr)
static

Convert string to and from UT_OptionType values.

const UT_Vector2D& UT_OptionEntry::getOptionUV ( ) const
const UT_Vector3D& UT_OptionEntry::getOptionUVW ( ) const
const UT_Vector2D& UT_OptionEntry::getOptionV2 ( ) const
const UT_Vector3D& UT_OptionEntry::getOptionV3 ( ) const
const UT_Vector4D& UT_OptionEntry::getOptionV4 ( ) const
static const char* UT_OptionEntry::getStringFromOptionType ( UT_OptionType  optiontype)
static
unsigned UT_OptionEntry::hash ( ) const

Hash a single option entry.

bool UT_OptionEntry::importOption ( int64 value) const
bool UT_OptionEntry::importOption ( bool &  value) const
bool UT_OptionEntry::importOption ( fpreal64 value) const
bool UT_OptionEntry::importOption ( UT_StringHolder value) const
bool UT_OptionEntry::importOption ( UT_Vector2D value) const
bool UT_OptionEntry::importOption ( UT_Vector3D value) const
bool UT_OptionEntry::importOption ( UT_Vector4D value) const
bool UT_OptionEntry::importOption ( UT_QuaternionD value) const
bool UT_OptionEntry::importOption ( UT_Matrix2D value) const
bool UT_OptionEntry::importOption ( UT_Matrix3D value) const
bool UT_OptionEntry::importOption ( UT_Matrix4D value) const
bool UT_OptionEntry::importOption ( UT_Array< int32 > &  value) const
bool UT_OptionEntry::importOption ( UT_Array< int64 > &  value) const
bool UT_OptionEntry::importOption ( UT_Array< fpreal32 > &  value) const
bool UT_OptionEntry::importOption ( UT_Array< fpreal64 > &  value) const
bool UT_OptionEntry::importOption ( UT_StringArray value) const
unsigned UT_OptionEntry::isEqual ( const UT_OptionEntry cmp,
fpreal64  tolerance = 0.0 
) const

Compute equivalence for a given option entry.

static exint UT_OptionEntry::optionSize ( UT_OptionType  t)
inlinestatic

Returns the tuple size, or 0 if the option is variadic (i.e. INTARRAY)

Definition at line 141 of file UT_OptionEntry.h.

exint UT_OptionEntry::optionSize ( ) const
inline

Definition at line 183 of file UT_OptionEntry.h.

static UT_OptionTypeStorage UT_OptionEntry::optionStorage ( UT_OptionType  t)
inlinestatic

Return the underlying storage type for the option.

Definition at line 104 of file UT_OptionEntry.h.

UT_OptionTypeStorage UT_OptionEntry::optionStorage ( ) const
inline

Definition at line 181 of file UT_OptionEntry.h.

bool UT_OptionEntry::saveJSON ( UT_JSONWriter w,
bool  compact 
) const

Save a single option to a JSON stream. This is saved with the schema

{
"name":"UT_OptionEntry",
"type":"object",
"properties": {
"type":{
"type":"string",
"enum":{ UT_Options::getStringFromOptionType() },
},
"value":{
"type":["bool", "integer", "float", "string", "array"],
"items":{"type":"float"},
"description":"Basic type or an array.
Arrays must be 2,3,4,9 or 16 floats.
Data should match given type",
},
},
}
void UT_OptionEntry::saveJSON ( UT_JSONValue v,
bool  compact 
) const

As above, except save to a UT_JSONValue instead of requiring the value go directly to a stream.


The documentation for this class was generated from the following file: