HDK
|
The File Rules are a set of filepath to color space mappings that are evaluated from first to last. The first rule to match is what determines which color space is returned. There are four types of rules available. Each rule type has a name key that may be used by applications to refer to that rule. Name values must be unique i.e. using a case insensitive comparison. The other keys depend on the rule type: More...
#include <OpenColorIO.h>
Public Member Functions | |
FileRulesRcPtr | createEditableCopy () const |
The method clones the content decoupling the two instances. More... | |
size_t | getNumEntries () const noexcept |
Does include default rule. Result will be at least 1. More... | |
size_t | getIndexForRule (const char *ruleName) const |
Get the index from the rule name. More... | |
const char * | getName (size_t ruleIndex) const |
Get name of the rule. More... | |
const char * | getPattern (size_t ruleIndex) const |
Setting pattern will erase regex. More... | |
void | setPattern (size_t ruleIndex, const char *pattern) |
const char * | getExtension (size_t ruleIndex) const |
Setting extension will erase regex. More... | |
void | setExtension (size_t ruleIndex, const char *extension) |
const char * | getRegex (size_t ruleIndex) const |
Setting a regex will erase pattern & extension. More... | |
void | setRegex (size_t ruleIndex, const char *regex) |
const char * | getColorSpace (size_t ruleIndex) const |
Set the rule's color space (may also be a role). More... | |
void | setColorSpace (size_t ruleIndex, const char *colorSpace) |
size_t | getNumCustomKeys (size_t ruleIndex) const |
Get number of key/value pairs. More... | |
const char * | getCustomKeyName (size_t ruleIndex, size_t key) const |
Get name of key. More... | |
const char * | getCustomKeyValue (size_t ruleIndex, size_t key) const |
Get value for the key. More... | |
void | setCustomKey (size_t ruleIndex, const char *key, const char *value) |
void | insertRule (size_t ruleIndex, const char *name, const char *colorSpace, const char *pattern, const char *extension) |
Insert a rule at a given ruleIndex. More... | |
void | insertRule (size_t ruleIndex, const char *name, const char *colorSpace, const char *regex) |
void | insertPathSearchRule (size_t ruleIndex) |
Helper function to insert a rule. More... | |
void | setDefaultRuleColorSpace (const char *colorSpace) |
Helper function to set the color space for the default rule. More... | |
void | removeRule (size_t ruleIndex) |
void | increaseRulePriority (size_t ruleIndex) |
Move a rule closer to the start of the list by one position. More... | |
void | decreaseRulePriority (size_t ruleIndex) |
Move a rule closer to the end of the list by one position. More... | |
bool | isDefault () const noexcept |
FileRules (const FileRules &)=delete | |
FileRules & | operator= (const FileRules &)=delete |
virtual | ~FileRules () |
Do not use (needed only for pybind11). More... | |
Static Public Member Functions | |
static FileRulesRcPtr | Create () |
Static Public Attributes | |
static const char * | DefaultRuleName |
Reserved rule name for the default rule. More... | |
static const char * | FilePathSearchRuleName |
Reserved rule name for the file path search rule. More... | |
Friends | |
class | Config |
The File Rules are a set of filepath to color space mappings that are evaluated from first to last. The first rule to match is what determines which color space is returned. There are four types of rules available. Each rule type has a name key that may be used by applications to refer to that rule. Name values must be unique i.e. using a case insensitive comparison. The other keys depend on the rule type:
Custom string keys and associated string values may be used to convey app or workflow-specific information, e.g. whether the color space should be left as is or converted into a working space.
Getters and setters are using the rule position, they will throw if the position is not valid. If the rule at the specified position does not implement the requested property getter will return NULL and setter will throw.
When loading a v1 config, a set of FileRules are created with ColorSpaceNamePathSearch followed by the Default rule pointing to the default role. This allows getColorSpaceFromFilepath to emulate OCIO v1 code that used parseColorSpaceFromString with strictparsing set to false.
Definition at line 1454 of file OpenColorIO.h.
|
virtual |
Do not use (needed only for pybind11).
|
static |
FileRulesRcPtr OCIO_NAMESPACE::FileRules::createEditableCopy | ( | ) | const |
The method clones the content decoupling the two instances.
void OCIO_NAMESPACE::FileRules::decreaseRulePriority | ( | size_t | ruleIndex | ) |
Move a rule closer to the end of the list by one position.
const char* OCIO_NAMESPACE::FileRules::getColorSpace | ( | size_t | ruleIndex | ) | const |
Set the rule's color space (may also be a role).
const char* OCIO_NAMESPACE::FileRules::getCustomKeyName | ( | size_t | ruleIndex, |
size_t | key | ||
) | const |
Get name of key.
const char* OCIO_NAMESPACE::FileRules::getCustomKeyValue | ( | size_t | ruleIndex, |
size_t | key | ||
) | const |
Get value for the key.
const char* OCIO_NAMESPACE::FileRules::getExtension | ( | size_t | ruleIndex | ) | const |
Setting extension will erase regex.
size_t OCIO_NAMESPACE::FileRules::getIndexForRule | ( | const char * | ruleName | ) | const |
Get the index from the rule name.
const char* OCIO_NAMESPACE::FileRules::getName | ( | size_t | ruleIndex | ) | const |
Get name of the rule.
size_t OCIO_NAMESPACE::FileRules::getNumCustomKeys | ( | size_t | ruleIndex | ) | const |
Get number of key/value pairs.
|
noexcept |
Does include default rule. Result will be at least 1.
const char* OCIO_NAMESPACE::FileRules::getPattern | ( | size_t | ruleIndex | ) | const |
Setting pattern will erase regex.
const char* OCIO_NAMESPACE::FileRules::getRegex | ( | size_t | ruleIndex | ) | const |
Setting a regex will erase pattern & extension.
void OCIO_NAMESPACE::FileRules::increaseRulePriority | ( | size_t | ruleIndex | ) |
Move a rule closer to the start of the list by one position.
void OCIO_NAMESPACE::FileRules::insertPathSearchRule | ( | size_t | ruleIndex | ) |
Helper function to insert a rule.
Uses Config:parseColorSpaceFromString to search the path for any of the color spaces named in the config (as per OCIO v1).
void OCIO_NAMESPACE::FileRules::insertRule | ( | size_t | ruleIndex, |
const char * | name, | ||
const char * | colorSpace, | ||
const char * | pattern, | ||
const char * | extension | ||
) |
Insert a rule at a given ruleIndex.
Rule currently at ruleIndex will be pushed to index: ruleIndex + 1. Name must be unique.
Will throw if pattern, extension or regex is a null or empty string.
Will throw if ruleIndex is not less than FileRules::getNumEntries .
void OCIO_NAMESPACE::FileRules::insertRule | ( | size_t | ruleIndex, |
const char * | name, | ||
const char * | colorSpace, | ||
const char * | regex | ||
) |
|
noexcept |
Check if there is only the default rule using default role and no custom key. This is the default FileRules state when creating a new config.
void OCIO_NAMESPACE::FileRules::removeRule | ( | size_t | ruleIndex | ) |
void OCIO_NAMESPACE::FileRules::setCustomKey | ( | size_t | ruleIndex, |
const char * | key, | ||
const char * | value | ||
) |
Adds a key/value or replace value if key exists. Setting a NULL or an empty value will erase the key.
Helper function to set the color space for the default rule.
Definition at line 1569 of file OpenColorIO.h.
|
static |
Reserved rule name for the default rule.
Definition at line 1459 of file OpenColorIO.h.
|
static |
Reserved rule name for the file path search rule.
Definition at line 1461 of file OpenColorIO.h.