HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_MetadataItem Struct Reference

#include <IMG_Metadata.h>

Public Types

enum  Scope {
  Scope::MD_Read = 0x01, Scope::MD_Write = 0x02, Scope::MD_RGBA = 0x04, Scope::MD_ReadWrite = MD_Read|MD_Write,
  Scope::MD_ReadRGBA = MD_Read|MD_RGBA, Scope::MD_Default = MD_Write
}
 
enum  Storage {
  Storage::MD_Unknown = -1, Storage::MD_Bool, Storage::MD_Int8, Storage::MD_Int16,
  Storage::MD_Int32, Storage::MD_Int64, Storage::MD_UInt8, Storage::MD_UInt16,
  Storage::MD_UInt32, Storage::MD_UInt64, Storage::MD_Real16, Storage::MD_Real32,
  Storage::MD_Real64, Storage::MD_String
}
 
enum  TypeInfo {
  TypeInfo::MD_None, TypeInfo::MD_Color, TypeInfo::MD_Point, TypeInfo::MD_Vector,
  TypeInfo::MD_Normal, TypeInfo::MD_Quaternion, TypeInfo::MD_Matrix, TypeInfo::MD_Box,
  TypeInfo::MD_Memory, TypeInfo::MD_Time, TypeInfo::MD_Timecode, TypeInfo::MD_Rational,
  TypeInfo::MD_Keycode
}
 

Public Member Functions

 IMG_MetadataItem ()=default
 
 IMG_MetadataItem (const UT_JSONValue &value, Storage store=Storage::MD_Unknown, TypeInfo type=TypeInfo::MD_None)
 
UT_JSONValue encode () const
 Encode into a UT_JSONValue as a dict. More...
 
bool decode (const UT_JSONValue &dict)
 Decode from a UT_JSONValue dictionary. More...
 
void setFromTypedString (const UT_StringHolder &typed_key, const char *value, UT_StringHolder &new_key)
 
UT_StringHolder toString (bool pretty_print) const
 
void clear ()
 
UT_JSONValue::Type jsonType () const
 
bool intStorage () const
 
bool floatStorage () const
 
bool stringStorage () const
 
bool save (UT_JSONWriter &os) const
 Save the value to a JSON writer. More...
 
void dump () const
 Debug print. More...
 
void setLabel (const UT_StringHolder &label)
 
void setMenu (const UT_StringArray &tokens, const UT_StringArray &labels, bool strict)
 
void setRange (fpreal64 min, bool strict_min, fpreal64 max, bool strict_max)
 
void setScope (Scope scope)
 
bool getLabel (UT_StringHolder &label) const
 
bool hasMenu () const
 
bool getMenu (UT_StringArray &tokens, UT_StringArray &labels, bool &strict) const
 
bool hasRange () const
 
bool getRange (fpreal64 &min, bool &strict_min, fpreal64 &max, bool &strict_max) const
 
Scope getScope () const
 
int menuSize () const
 
int menuIndex (const UT_StringRef &token) const
 
UT_StringHolder menuToken (int index) const
 
UT_StringHolder menuLabel (int index) const
 
UT_StringHolder menuLabel (const UT_StringRef &token) const
 

Static Public Member Functions

static constexpr bool isInteger (Storage s)
 
static constexpr bool isFloat (Storage s)
 
static constexpr bool isString (Storage s)
 
static const char * scope (Scope s)
 
static Scope scope (const char *s)
 
static bool isWriteOnly (Scope s)
 
static bool isReadOnly (Scope s)
 
static const char * storage (Storage s)
 
static Storage storage (const char *s)
 
static const char * typeInfo (TypeInfo t)
 
static TypeInfo typeInfo (const char *t)
 

Public Attributes

UT_JSONValue myValue
 
UT_JSONValue myUI
 
Storage myStorage
 
TypeInfo myTypeInfo
 

Detailed Description

Definition at line 18 of file IMG_Metadata.h.

Member Enumeration Documentation

Enumerator
MD_Read 
MD_Write 
MD_RGBA 
MD_ReadWrite 
MD_ReadRGBA 
MD_Default 

Definition at line 20 of file IMG_Metadata.h.

Enumerator
MD_Unknown 
MD_Bool 
MD_Int8 
MD_Int16 
MD_Int32 
MD_Int64 
MD_UInt8 
MD_UInt16 
MD_UInt32 
MD_UInt64 
MD_Real16 
MD_Real32 
MD_Real64 
MD_String 

Definition at line 44 of file IMG_Metadata.h.

Enumerator
MD_None 
MD_Color 
MD_Point 
MD_Vector 
MD_Normal 
MD_Quaternion 
MD_Matrix 
MD_Box 
MD_Memory 
MD_Time 
MD_Timecode 
MD_Rational 
MD_Keycode 

Definition at line 89 of file IMG_Metadata.h.

Constructor & Destructor Documentation

IMG_MetadataItem::IMG_MetadataItem ( )
default
IMG_MetadataItem::IMG_MetadataItem ( const UT_JSONValue value,
Storage  store = Storage::MD_Unknown,
TypeInfo  type = TypeInfo::MD_None 
)
inline

Definition at line 114 of file IMG_Metadata.h.

Member Function Documentation

void IMG_MetadataItem::clear ( )
inline

Definition at line 170 of file IMG_Metadata.h.

bool IMG_MetadataItem::decode ( const UT_JSONValue dict)

Decode from a UT_JSONValue dictionary.

void IMG_MetadataItem::dump ( ) const

Debug print.

UT_JSONValue IMG_MetadataItem::encode ( ) const

Encode into a UT_JSONValue as a dict.

bool IMG_MetadataItem::floatStorage ( ) const
inline

Definition at line 183 of file IMG_Metadata.h.

bool IMG_MetadataItem::getLabel ( UT_StringHolder label) const

Query UI elements - returns true of the UI element is defined

bool IMG_MetadataItem::getMenu ( UT_StringArray tokens,
UT_StringArray labels,
bool &  strict 
) const

Query UI elements - returns true of the UI element is defined

bool IMG_MetadataItem::getRange ( fpreal64 min,
bool &  strict_min,
fpreal64 max,
bool &  strict_max 
) const

Query UI elements - returns true of the UI element is defined

Scope IMG_MetadataItem::getScope ( ) const

Query UI elements - returns true of the UI element is defined

bool IMG_MetadataItem::hasMenu ( ) const

Query UI elements - returns true of the UI element is defined

bool IMG_MetadataItem::hasRange ( ) const

Query UI elements - returns true of the UI element is defined

bool IMG_MetadataItem::intStorage ( ) const
inline

Definition at line 182 of file IMG_Metadata.h.

static constexpr bool IMG_MetadataItem::isFloat ( Storage  s)
inlinestatic

Definition at line 73 of file IMG_Metadata.h.

static constexpr bool IMG_MetadataItem::isInteger ( Storage  s)
inlinestatic

Definition at line 61 of file IMG_Metadata.h.

static bool IMG_MetadataItem::isReadOnly ( Scope  s)
inlinestatic

Map enum to text string

Definition at line 39 of file IMG_Metadata.h.

static constexpr bool IMG_MetadataItem::isString ( Storage  s)
inlinestatic

Definition at line 79 of file IMG_Metadata.h.

static bool IMG_MetadataItem::isWriteOnly ( Scope  s)
inlinestatic

Map enum to text string

Definition at line 35 of file IMG_Metadata.h.

UT_JSONValue::Type IMG_MetadataItem::jsonType ( ) const

Get the JSON value type. This uses the storage type first, but then will fall back to the type of myValue.

int IMG_MetadataItem::menuIndex ( const UT_StringRef token) const

Query UI elements - returns true of the UI element is defined

UT_StringHolder IMG_MetadataItem::menuLabel ( int  index) const

Query UI elements - returns true of the UI element is defined

UT_StringHolder IMG_MetadataItem::menuLabel ( const UT_StringRef token) const

Query UI elements - returns true of the UI element is defined

int IMG_MetadataItem::menuSize ( ) const

Query UI elements - returns true of the UI element is defined

UT_StringHolder IMG_MetadataItem::menuToken ( int  index) const

Query UI elements - returns true of the UI element is defined

bool IMG_MetadataItem::save ( UT_JSONWriter os) const

Save the value to a JSON writer.

static const char* IMG_MetadataItem::scope ( Scope  s)
static

Map enum to text string

static Scope IMG_MetadataItem::scope ( const char *  s)
static

Map enum to text string

void IMG_MetadataItem::setFromTypedString ( const UT_StringHolder typed_key,
const char *  value,
UT_StringHolder new_key 
)

Set value from an encoded "typed" string (see IMG_Metadata for more info) The new_key will be the key name stripped of the type information

void IMG_MetadataItem::setLabel ( const UT_StringHolder label)

Set UI elements

void IMG_MetadataItem::setMenu ( const UT_StringArray tokens,
const UT_StringArray labels,
bool  strict 
)

Set UI elements

void IMG_MetadataItem::setRange ( fpreal64  min,
bool  strict_min,
fpreal64  max,
bool  strict_max 
)

Set UI elements

void IMG_MetadataItem::setScope ( Scope  scope)

Set UI elements

static const char* IMG_MetadataItem::storage ( Storage  s)
static

Map enum to text string

static Storage IMG_MetadataItem::storage ( const char *  s)
static

Map enum to text string

bool IMG_MetadataItem::stringStorage ( ) const
inline

Definition at line 184 of file IMG_Metadata.h.

UT_StringHolder IMG_MetadataItem::toString ( bool  pretty_print) const

Convert metadata to a string value. When pretty_print is true:

  • If there's a menu, the corresponding label will be returned
  • If there's type information, it will be used (i.e. printing a time or memory)
static const char* IMG_MetadataItem::typeInfo ( TypeInfo  t)
static

Map enum to text string

static TypeInfo IMG_MetadataItem::typeInfo ( const char *  t)
static

Map enum to text string

Member Data Documentation

Storage IMG_MetadataItem::myStorage

Definition at line 194 of file IMG_Metadata.h.

TypeInfo IMG_MetadataItem::myTypeInfo

Definition at line 195 of file IMG_Metadata.h.

UT_JSONValue IMG_MetadataItem::myUI

Definition at line 193 of file IMG_Metadata.h.

UT_JSONValue IMG_MetadataItem::myValue

Definition at line 192 of file IMG_Metadata.h.


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