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)¶ Initialize self. See help(type(self)) for accurate signature.
-
iter
(self) → PyOpenColorIO.FormatMetadata.AttributeNameIterator¶
-
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¶
-
name: str
-
class
PyOpenColorIO.FormatMetadata.
AttributeNameIterator
¶ -
self
[
arg0: int]
→ str¶
-
iter
(self) → PyOpenColorIO.FormatMetadata.AttributeNameIterator¶
-
len
(self) → int¶
-
next
(self) → str¶
-
self
-
class
PyOpenColorIO.FormatMetadata.
AttributeIterator
¶ -
self
[
arg0: int]
→ tuple¶
-
iter
(self) → PyOpenColorIO.FormatMetadata.AttributeIterator¶
-
len
(self) → int¶
-
next
(self) → tuple¶
-
self
-
class
PyOpenColorIO.FormatMetadata.
ConstChildElementIterator
¶ -
self
[
arg0: int]
→ PyOpenColorIO.FormatMetadata¶
-
len
(self) → int¶
-
next
(self) → PyOpenColorIO.FormatMetadata¶
-
self
-
class
PyOpenColorIO.FormatMetadata.
ChildElementIterator
¶ -
self
[
arg0: int]
→ PyOpenColorIO.FormatMetadata¶
-
iter
(self) → PyOpenColorIO.FormatMetadata.ChildElementIterator¶
-
len
(self) → int¶
-
next
(self) → PyOpenColorIO.FormatMetadata¶
-
self
-
class
OpenColorIO_v2_0
::
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
-
const char *
getElementName
() const noexcept = 0¶
-
void
setElementName
(const char*) = 0¶ Name has to be a non-empty string. Top-level element can’t be renamed. ‘ROOT’ is reserved.
-
const char *
getElementValue
() const noexcept = 0¶
-
void
setElementValue
(const char*) = 0¶
-
int
getNumAttributes
() const noexcept = 0¶
-
const char *
getAttributeName
(int i) const noexcept = 0¶ Get the name of a attribute (“” if attribute does not exist).
-
const char *
getAttributeValue
(int i) const noexcept = 0¶ Get the value of a attribute (“” if attribute does not exist).
-
const char *
getAttributeValue
(const char *name) const noexcept = 0¶ Get the value of a attribute of a given name (“” if attribute does not exist).
-
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.
-
int
getNumChildrenElements
() const noexcept = 0¶
-
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.
-
FormatMetadata &
getChildElement
(int i) = 0¶
-
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.
-
void
clear
() noexcept = 0¶ Remove all children, all attributes and the value.
-
FormatMetadata &
operator=
(const FormatMetadata &rhs) = 0¶
-
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.
-
void
setName
(const char *name) noexcept = 0¶
-
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.
-
void
setID
(const char *id) noexcept = 0¶
-
FormatMetadata
(const FormatMetadata &rhs) = delete¶
-
~FormatMetadata
() = default¶ Do not use (needed only for pybind11).
-
std::ostream &
OpenColorIO_v2_0
::
operator<<
(std::ostream&, const FormatMetadata&)¶
Constants: FormatMetadata