FormatMetadata¶
- class PyOpenColorIO.FormatMetadata¶
The FormatMetadata class is intended to be a generic container to hold metadata from various file formats.
This class provides a hierarchical metadata container. A metadata object is similar to an element in XML. The top level element is named “ROOT” and can’t be renamed. Several transforms have a FormatMetadata. The root element and all of the sub-elements may contain: - A name string (e.g. “ROOT”, “Description”…). Name can’t be empty. - A value string (e.g. “updated viewing LUT”). Value can be empty. - A list of attributes (name, value) string pairs (e.g. “version”, “1.5”). There are helper functions to get and set “id” and “name” attributes. Attribute names are unique. - And a list of child sub-elements, which are also objects implementing FormatMetadata. There can be several sub-elements with the same name.
- name: str in self bool ¶
- self[name: str] str ¶
Get the value of a attribute (”” if attribute does not exist).
- FormatMetadata(*args, **kwargs)¶
- len(self) int ¶
- self[name: str] = value: str None ¶
Add an attribute with a given name and value. If an attribute with the same name already exists, its value is replaced. Throw if name is NULL or empty.
- addChildElement(name: str, value: str) None ¶
Add a child element with a given name and value.
Name has to be non-empty. Value may be empty, particularly if this element will have children. Element is added after all existing children. Use getChildElement(getNumChildrenElements()-1) to access the added element.
- clear() None ¶
Remove all children, all attributes and the value.
- getAttributes() PyOpenColorIO.FormatMetadata.AttributeIterator ¶
- getChildElements() PyOpenColorIO.FormatMetadata.ChildElementIterator ¶
- getElementName() str ¶
- getElementValue() str ¶
- getID() str ¶
Convenience method to easily get/set the ‘id’ attribute. This corresponds to the ProcessNode id attribute from a CLF/CTF file or the ColorCorrection id attribute from a CC/CCC/CDL file.
- getName() str ¶
Convenience method to easily get/set the ‘name’ attribute. This corresponds to the ProcessNode name attribute from a CLF / CTF file or the name key of a transform in the config YAML.
- setElementName(name: str) None ¶
Name has to be a non-empty string. Top-level element can’t be renamed. ‘ROOT’ is reserved.
- setElementValue(value: str) None ¶
- setID(id: str) None ¶
- setName(name: str) None ¶
- class PyOpenColorIO.FormatMetadata.AttributeNameIterator¶
- self[arg0: int] str ¶
- len(self) int ¶
- next(self) str ¶
- class PyOpenColorIO.FormatMetadata.AttributeIterator¶
- self[arg0: int] tuple ¶
- iter(self) PyOpenColorIO.FormatMetadata.AttributeIterator ¶
- len(self) int ¶
- next(self) tuple ¶
- class PyOpenColorIO.FormatMetadata.ConstChildElementIterator¶
- self[arg0: int] PyOpenColorIO.FormatMetadata ¶
- len(self) int ¶
- next(self) PyOpenColorIO.FormatMetadata ¶
- class PyOpenColorIO.FormatMetadata.ChildElementIterator¶
- self[arg0: int] PyOpenColorIO.FormatMetadata ¶
- len(self) int ¶
- next(self) PyOpenColorIO.FormatMetadata ¶
-
class FormatMetadata¶
The FormatMetadata class is intended to be a generic container to hold metadata from various file formats.
This class provides a hierarchical metadata container. A metadata object is similar to an element in XML. The top level element is named “ROOT” and can’t be renamed. Several transforms have a FormatMetadata. The root element and all of the sub-elements may contain:
A name string (e.g. “ROOT”, “Description”…). Name can’t be empty.
A value string (e.g. “updated viewing LUT”). Value can be empty.
A list of attributes (name, value) string pairs (e.g. “version”, “1.5”). There are helper functions to get and set “id” and “name” attributes. Attribute names are unique.
And a list of child sub-elements, which are also objects implementing FormatMetadata. There can be several sub-elements with the same name.
Public Functions
-
virtual const char *getElementName() const noexcept = 0¶
-
virtual void setElementName(const char*) = 0¶
Name has to be a non-empty string. Top-level element can’t be renamed. ‘ROOT’ is reserved.
-
virtual const char *getElementValue() const noexcept = 0¶
-
virtual void setElementValue(const char*) = 0¶
-
virtual int getNumAttributes() const noexcept = 0¶
-
virtual const char *getAttributeName(int i) const noexcept = 0¶
Get the name of a attribute (”” if attribute does not exist).
-
virtual const char *getAttributeValue(int i) const noexcept = 0¶
Get the value of a attribute (”” if attribute does not exist).
-
virtual const char *getAttributeValue(const char *name) const noexcept = 0¶
Get the value of a attribute of a given name (”” if attribute does not exist).
-
virtual void addAttribute(const char *name, const char *value) = 0¶
Add an attribute with a given name and value. If an attribute with the same name already exists, its value is replaced. Throw if name is NULL or empty.
-
virtual int getNumChildrenElements() const noexcept = 0¶
-
virtual const FormatMetadata &getChildElement(int i) const = 0¶
Access a child element.
Note
Adding siblings might cause a reallocation of the container and thus might make the reference unusable. Index i has to be positive and less than getNumChildrenElements() or the function will throw.
-
virtual FormatMetadata &getChildElement(int i) = 0¶
-
virtual void addChildElement(const char *name, const char *value) = 0¶
Add a child element with a given name and value.
Name has to be non-empty. Value may be empty, particularly if this element will have children. Element is added after all existing children. Use getChildElement(getNumChildrenElements()-1) to access the added element.
-
virtual void clear() noexcept = 0¶
Remove all children, all attributes and the value.
-
virtual FormatMetadata &operator=(const FormatMetadata &rhs) = 0¶
-
virtual const char *getName() const noexcept = 0¶
Convenience method to easily get/set the ‘name’ attribute. This corresponds to the ProcessNode name attribute from a CLF / CTF file or the name key of a transform in the config YAML.
-
virtual void setName(const char *name) noexcept = 0¶
-
virtual const char *getID() const noexcept = 0¶
Convenience method to easily get/set the ‘id’ attribute. This corresponds to the ProcessNode id attribute from a CLF/CTF file or the ColorCorrection id attribute from a CC/CCC/CDL file.
-
virtual void setID(const char *id) noexcept = 0¶
-
FormatMetadata(const FormatMetadata &rhs) = delete¶
-
virtual ~FormatMetadata() = default¶
Do not use (needed only for pybind11).
-
std::ostream &OpenColorIO_v2_2::operator<<(std::ostream&, const FormatMetadata&)¶
Constants: FormatMetadata