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

Map of metadata items. More...

#include <IMG_Metadata.h>

Public Types

using Storage = IMG_MetadataItem::Storage
 
using TypeInfo = IMG_MetadataItem::TypeInfo
 

Public Member Functions

void clear ()
 Clear the table. More...
 
void merge (const IMG_Metadata &src, bool overwrite=true)
 
bool add (const UT_StringHolder &key, const IMG_MetadataItem &item)
 
bool addTypedString (const UT_StringHolder &name, const char *val)
 
bool find (const UT_StringRef &name, IMG_MetadataItem &value, const char *format_prefix=nullptr) const
 Find an item in the map and return it's representation. More...
 
bool contains (const UT_StringRef &key) const
 Test if a key exists in the metadata. More...
 
bool getOption (const UT_StringRef &name, UT_StringHolder &val, const char *prefix=nullptr) const
 Old style getOption() call that gets the value as a string. More...
 
void erase (const UT_StringRef &name)
 Remove metadata. More...
 
exint size () const
 Number of items. More...
 
bool toString (const UT_StringRef &name, UT_StringHolder &value, const char *format=nullptr, bool pretty_print=true) const
 
bool save (UT_JSONWriter &os) const
 Save the value to a JSON writer. More...
 
void dump () const
 Debug print. More...
 
bool import (const UT_StringRef &name, bool &value, const char *format=nullptr) const
 
bool import (const UT_StringRef &n, UT_StringHolder &v, const char *format=nullptr) const
 
bool import (const UT_StringRef &name, int32 &val, const char *format=nullptr) const
 
bool import (const UT_StringRef &name, int64 &val, const char *format=nullptr) const
 
bool import (const UT_StringRef &name, fpreal32 &val, const char *format=nullptr) const
 
bool import (const UT_StringRef &name, fpreal64 &val, const char *format=nullptr) const
 
bool import (const UT_StringRef &name, UT_Matrix4F &m, const char *format=nullptr) const
 
bool import (const UT_StringRef &name, UT_Matrix4D &m, const char *format=nullptr) const
 
using const_iterator = UT_StringMap< IMG_MetadataItem >::const_iterator
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

Map of metadata items.

Definition at line 208 of file IMG_Metadata.h.

Member Typedef Documentation

Iteration interface

Definition at line 325 of file IMG_Metadata.h.

Member Function Documentation

bool IMG_Metadata::add ( const UT_StringHolder key,
const IMG_MetadataItem item 
)

Add named metadata.

Note
this will overwrite existing keys
bool IMG_Metadata::addTypedString ( const UT_StringHolder name,
const char *  val 
)

Set value from old-style metadata. This mimics the interface before H20 (see IMG_File::setOption). Normally when calling IMG_File::setOption, the value would be passed directly as a string. For example:

fp->setOption("artist", "Van Gough");
fp->setOption("compression", "75");
fp->setOption("worldToCamera", "[1,0,0,0,0,1,0,0,...]");

But, alternatively, the string could be encoded with type information. For example:

fp->setOption("string artist", "Van Gough");
fp->setOption("int32 compression", "75");
fp->setOption("matrix4d worldToCamera", "[1,0,0...");

The possible encoding type information was:

  • bool Bool
  • int8 Int8
  • int16 Int16
  • int32 Int32
  • int64 Int64
  • vec2i Int32[2] (no type info)
  • vec3i Int32[3] (no type info)
  • vec4i Int32[4] (no type info)
  • uint8 UInt8
  • uint16 UInt16
  • uint32 UInt32
  • uint64 UInt64
  • vec2i UInt32[2] (no type info)
  • vec3i UInt32[3] (no type info)
  • vec4i UInt32[4] (no type info)
  • half Real16
  • vec2h Real16[2] (no type info)
  • vec3h Real16[3] (no type info)
  • vec4h Real16[4] (no type info)
  • float Real32
  • vec2f Real32[2] (no type info)
  • vec3f Real32[3] (no type info)
  • vec4f Real32[4] (no type info)
  • mat3f <MATRIX> Real32[9]
  • mat4f <MATRIX> Real32[16]
  • matrix3f <MATRIX> Real32[9]
  • matrix4f <MATRIX> Real32[16]
  • double Real64
  • vec2d Real64[2]
  • vec3d Real64[3]
  • vec4d Real64[4]
  • mat3d <MATRIX> Real64[9]
  • mat4d <MATRIX> Real64[16]
  • matrix3d <MATRIX> Real64[9]
  • matrix4d <MATRIX> Real64[16]
  • string String
  • clr3u8 <Color> UInt8[3]
  • clr4u8 <Color> UInt8[4]
  • clr3f <Color> Real32[3]
  • clr4f <Color> Real32[4]
  • clr3d <Color> Real64[3]
  • clr4d <Color> Real64[4]
  • point3f <Point> Real32[3]
  • point3d <Point> Real64[3]
  • normal3f <Normal> Real32[3]
  • normal3d <Normal> Real64[3]
  • vector3f <Vector> Real32[3]
  • vector3d <Vector> Real64[3]
  • timecode <Timecode> Int32[2]
  • keycode <Keycode> Int32[7]
  • rational <Rational> Int32[2]
  • box2i <Box> Int32[4]
  • box2f <Box> Real32[4]
  • box3i <Box> Int32[6]
  • box3f <Box> Real32[6]
  • memory <Memory> Int64
  • time <Time> Real64
  • seconds <Time> Real64

If there is no type information encoded in the string, the string will be added verbatim.

const_iterator IMG_Metadata::begin ( void  ) const
inline

Iteration interface

Definition at line 326 of file IMG_Metadata.h.

void IMG_Metadata::clear ( )
inline

Clear the table.

Definition at line 215 of file IMG_Metadata.h.

bool IMG_Metadata::contains ( const UT_StringRef key) const
inline

Test if a key exists in the metadata.

Definition at line 309 of file IMG_Metadata.h.

void IMG_Metadata::dump ( ) const

Debug print.

const_iterator IMG_Metadata::end ( void  ) const
inline

Iteration interface

Definition at line 327 of file IMG_Metadata.h.

void IMG_Metadata::erase ( const UT_StringRef name)
inline

Remove metadata.

Definition at line 318 of file IMG_Metadata.h.

bool IMG_Metadata::find ( const UT_StringRef name,
IMG_MetadataItem value,
const char *  format_prefix = nullptr 
) const

Find an item in the map and return it's representation.

bool IMG_Metadata::getOption ( const UT_StringRef name,
UT_StringHolder val,
const char *  prefix = nullptr 
) const

Old style getOption() call that gets the value as a string.

bool IMG_Metadata::import ( const UT_StringRef name,
bool &  value,
const char *  format = nullptr 
) const

Import items

bool IMG_Metadata::import ( const UT_StringRef n,
UT_StringHolder v,
const char *  format = nullptr 
) const

Import items

bool IMG_Metadata::import ( const UT_StringRef name,
int32 val,
const char *  format = nullptr 
) const

Import items

bool IMG_Metadata::import ( const UT_StringRef name,
int64 val,
const char *  format = nullptr 
) const

Import items

bool IMG_Metadata::import ( const UT_StringRef name,
fpreal32 val,
const char *  format = nullptr 
) const

Import items

bool IMG_Metadata::import ( const UT_StringRef name,
fpreal64 val,
const char *  format = nullptr 
) const

Import items

bool IMG_Metadata::import ( const UT_StringRef name,
UT_Matrix4F m,
const char *  format = nullptr 
) const

Import items

bool IMG_Metadata::import ( const UT_StringRef name,
UT_Matrix4D m,
const char *  format = nullptr 
) const

Import items

void IMG_Metadata::merge ( const IMG_Metadata src,
bool  overwrite = true 
)

Merge from other metadata. If overwrite is enabled, any data in the source will overwrite existing keys.

bool IMG_Metadata::save ( UT_JSONWriter os) const

Save the value to a JSON writer.

exint IMG_Metadata::size ( void  ) const
inline

Number of items.

Definition at line 321 of file IMG_Metadata.h.

bool IMG_Metadata::toString ( const UT_StringRef name,
UT_StringHolder value,
const char *  format = nullptr,
bool  pretty_print = true 
) 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)

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