|
HDK
|
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... | |
| bool | loadEncoded (const UT_JSONValue &jvalue) |
| void | dump () const |
| Debug print. More... | |
| void | fill (UT_Options &opts) const |
| 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 |
| UT_StringHolder | saveEncoded () const |
| bool | saveEncoded (UT_JSONWriter &os) const |
| using | const_iterator = UT_StringMap< IMG_MetadataItem >::const_iterator |
| const_iterator | begin () const |
| const_iterator | end () const |
Map of metadata items.
Definition at line 217 of file IMG_Metadata.h.
Iteration interface
Definition at line 334 of file IMG_Metadata.h.
Definition at line 220 of file IMG_Metadata.h.
Definition at line 221 of file IMG_Metadata.h.
| bool IMG_Metadata::add | ( | const UT_StringHolder & | key, |
| const IMG_MetadataItem & | item | ||
| ) |
Add named metadata.
| 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:
But, alternatively, the string could be encoded with type information. For example:
The possible encoding type information was:
If there is no type information encoded in the string, the string will be added verbatim.
|
inline |
Iteration interface
Definition at line 335 of file IMG_Metadata.h.
|
inline |
Clear the table.
Definition at line 224 of file IMG_Metadata.h.
|
inline |
Test if a key exists in the metadata.
Definition at line 318 of file IMG_Metadata.h.
| void IMG_Metadata::dump | ( | ) | const |
Debug print.
|
inline |
Iteration interface
Definition at line 336 of file IMG_Metadata.h.
|
inline |
Remove metadata.
Definition at line 327 of file IMG_Metadata.h.
| void IMG_Metadata::fill | ( | UT_Options & | opts | ) | const |
Fill a UT_Options the best we can. IMG_Metadata is much more expressive and flexible than a UT_Options, but this method does the best. The method exists for older interfaces which expect a UT_Options.
If a piece of metadata isn't representable in a UT_Options, the string representation of the value will be saved.
| 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
| bool IMG_Metadata::loadEncoded | ( | const UT_JSONValue & | jvalue | ) |
Load from an encoded JSON object
| 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.
| UT_StringHolder IMG_Metadata::saveEncoded | ( | ) | const |
Save encoded data to a JSON writer
| bool IMG_Metadata::saveEncoded | ( | UT_JSONWriter & | os | ) | const |
Save encoded data to a JSON writer
Number of items.
Definition at line 330 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: