Key-value metadata container using typed Variant values. More...
#include <metadata.h>
Public Types | |
| enum | ID { Invalid , Timecode , Gamma , Title , Copyright , Software , Artist , Comment , Date , Album , License , TrackNumber , Genre , EnableBWF , Description , Originator , OriginatorReference , OriginationDateTime , FrameRate , UMID , CodingHistory , CompressionLevel , EnableVBR , VBRQuality , CompressedSize , EndOfStream } |
| using | Ptr = SharedPtr< Metadata > |
| Shared pointer type for Metadata. | |
Public Member Functions | |
| Metadata ()=default | |
| Constructs an empty Metadata object. | |
| template<typename T > | |
| void | set (ID id, const T &value) |
| Sets a metadata value for the given ID. | |
| const Variant & | get (ID id) const |
| Returns the Variant value for the given ID. | |
| bool | contains (ID id) const |
| Returns true if the given ID has been set. | |
| void | remove (ID id) |
| Removes the entry for the given ID. | |
| void | clear () |
| Removes all metadata entries. | |
| size_t | size () const |
| Returns the number of metadata entries. | |
| bool | isEmpty () const |
| Returns true if no metadata entries are stored. | |
| template<typename Func > | |
| void | forEach (Func &&func) const |
| Iterates over all metadata entries, invoking a callback for each. | |
| StringList | dump () const |
| Returns a human-readable dump of all metadata entries. | |
| bool | operator== (const Metadata &other) const |
| Returns true if both Metadata objects contain the same entries. | |
| JsonObject | toJson () const |
| Serializes this Metadata to a JSON object. | |
Static Public Member Functions | |
| static const String & | idToString (ID id) |
| Converts a metadata ID to its string name. | |
| static ID | stringToID (const String &val) |
| Converts a string name to a metadata ID. | |
| static Metadata | fromJson (const JsonObject &json, Error *err=nullptr) |
| Deserializes a Metadata object from a JSON object. | |
Key-value metadata container using typed Variant values.
Stores metadata entries keyed by a well-known ID enum. Each value is stored as a Variant, supporting types such as String, int, double, bool, Timecode, and Rational. Supports JSON serialization
| Enumerator | |
|---|---|
| CompressedSize | Internal: allocation hint for compressed pixel formats. Use Image::compressedSize() instead. |
| EndOfStream | Signals end-of-stream to downstream nodes. |
Returns true if the given ID has been set.
| id | The metadata key. |
| StringList Metadata::dump | ( | ) | const |
Returns a human-readable dump of all metadata entries.
Iterates over all metadata entries, invoking a callback for each.
| Func | Callable type with signature void(ID, const Variant &). |
| func | The callback to invoke for each entry. |
Returns the Variant value for the given ID.
| id | The metadata key. |
Converts a metadata ID to its string name.
| id | The metadata ID. |
|
inline |
Returns true if no metadata entries are stored.
Removes the entry for the given ID.
| id | The metadata key to remove. |
Sets a metadata value for the given ID.
| T | The value type. |
| id | The metadata key. |
| value | The value to store. |
|
inline |
Returns the number of metadata entries.
Converts a string name to a metadata ID.
| val | The name string. |
|
inline |
Serializes this Metadata to a JSON object.