TQTaggable: The TQTaggable class represents a set of tags and introduces a methods to read and write tags from and to it. A tag is a key-value-pair, where the key is a unique string and the value might be a string, a bool, an integer or a double. Tags are set using either of the methods: - TQTaggable::setTagString("<key>", "<value>") - TQTaggable::setTagInteger("<key>", <value>) - TQTaggable::setTagDouble("<key>", <value>) - TQTaggable::setTagBool("<key>", <value>) To retrieve the value of a tag one can use - TQTaggable::getTagStringDefault("<key>", "<default>") - TQTaggable::getTagIntegerDefault("<key>", <default>) - TQTaggable::getTagDoubleDefault("<key>", <default>) - TQTaggable::getTagBoolDefault("<key>", <default>) where the default value <default> is used if the tag is not present or - TQTaggable::getTagString("<key>", <value>) - TQTaggable::getTagInteger("<key>", <value>) - TQTaggable::getTagDouble("<key>", <value>) - TQTaggable::getTagBool("<key>", <value>) where <value> is a variable set to the value of the tag if it is present (return value of corresponding function indicates if tag is present). In each case data types are converted if necessary and possible. The TQTaggable class is prepared to allow for an hierarchical tree-like structure of instances of TQTaggable (if implemented by a descendant class). Some special symbols allow to modify the way in which tags are retrieved: "~tag" search for the first occurence of tag 'tag' upwards the tree "tag~" search for the first occurence of tag 'tag' downwards Some special symbols allow to modify the way in which tags are set: "tag?" only set the tag if it does not exist yet, i.e. don't overwrite Renaming/removing tags can be done using - TQTaggable::removeTag(...) remove one tag - TQTaggable::clearTags() remove all tags - TQTaggable::renameTag(...) rename one tag - TQTaggable::renameTags(...) rename all tags with certain key prefix The presence (or absence) and the validity (in terms of data types and simple numerical requirements) of tags may be tested using - TQTaggable::claimTags(...) test validity of tags Useful string parsing utilities provided by the TQTaggable class are - TQTaggable::importTags(...) parses a string with comma-separated key-value assignments, e.g. "hello = world, x = 5" - TQTaggable::parseParameterList(...) parses a string with (not necessarily comma-) separated values, e.g. "'test', 4, 1" - TQTaggable::parseFlags(...) parses a string with flags and optional parameters, e.g. "abc4" Would be nice to have at some point but has not yet been finalized: "||key" logical OR of all tags 'key' upwards "&&key" logical AND of all tags 'key' upwards "key||" logical OR of all tags 'key' downwards "key&&" logical AND of all tags 'key' downwards "+key" SUM of all tags 'key' upwards "*key" PRODUCT of all tags 'key' upwards "key+" SUM of all tags 'key' downwards "key*" PRODUCT of all tags 'key' downwards "#key" number of occurences of tags 'key' upwards "key#" number of occurences of tags 'key' downwards
virtual | ~TQTaggable() |
bool | allTagsOfTypeBool() |
bool | allTagsOfTypeDouble() |
bool | allTagsOfTypeInteger() |
bool | allTagsOfTypeString() |
bool | allTagsValidBools() |
bool | allTagsValidDoubles() |
bool | allTagsValidIntegers() |
bool | canSetThisTag(const TString& key, bool& treatAsList) |
int | claimTags(const TString& definition, bool printErrMsg = false) |
int | claimTags(const TString& definition, TString& message) |
int | claimTags(const TString& definition, TString& missing, TString& invalid, TString& unexpected) |
static TClass* | Class() |
void | clear() |
int | clearTags() |
int | countMatchingTags(const TString& name) const |
bool | exportConfigFile(bool writeUnreadKeys = true) |
bool | exportConfigFile(const TString& filename, bool writeUnreadKeys = true) |
bool | exportConfigFile(const TString& filename, const TString& prefix, bool writeUnreadKeys = true) |
int | exportTags(TQTaggable* dest, const TString& subDest = "", const TString& filter = "", bool recursive = false) |
TString | exportTagsAsConfigString(const TString& prefix, const TString& filter = "") |
string | exportTagsAsStandardConfigString(const TString& prefix, const TString& filter = "") |
string | exportTagsAsStandardString(const TString& filter = "", bool xmlStyle = false) |
TString | exportTagsAsString(const TString& filter = "", bool xmlStyle = false) |
virtual TQTaggable* | getBaseTaggable() const |
virtual TList* | getDescendantTaggables() |
virtual TString | getFlags() |
int | getFlagsSize() |
bool | getGlobalIgnoreCase() const |
bool | getGlobalOverwrite() const |
static shared_ptr<TQTaggable> | getGlobalTaggable(const char* name) |
static shared_ptr<TQTaggable> | getGlobalTaggable(const TString& name) |
TList* | getListOfKeys(const TString& filter = "") |
virtual TList* | getListOfTaggables(const TString& name) |
TList* | getListOfTagNames() |
virtual TList* | getListOfUnreadKeys(const TString& filter = "") |
int | getNTags() const |
bool | getTag(const TString& key, double& value) |
bool | getTag(const TString& key, int& value) |
bool | getTag(const TString& key, bool& value) |
bool | getTag(const TString& key, TString& value) |
int | getTag(const TString& key, vector<TString>& vec) |
int | getTag(const TString& key, vector<int>& vec) |
int | getTag(const TString& key, vector<double>& vec) |
int | getTag(const TString& key, vector<bool>& vec) |
int | getTag(const TString& key, TList* l) |
bool | getTag(const TString& key, double& value, bool recursive) |
bool | getTag(const TString& key, int& value, bool recursive) |
bool | getTag(const TString& key, bool& value, bool recursive) |
bool | getTag(const TString& key, TString& value, bool recursive) |
bool | getTagAsString(const TString& key, TString& tag) |
bool | getTagBool(const TString& key, bool& value) |
bool | getTagBool(const TString& key, bool& value, bool recursive) |
bool | getTagBoolDefault(const TString& key, bool defaultVal = false) |
double | getTagDefault(const TString& key, double defaultVal) |
int | getTagDefault(const TString& key, int defaultVal) |
bool | getTagDefault(const TString& key, bool defaultVal) |
TString | getTagDefault(const TString& key, const TString& defaultVal) |
TString | getTagDefault(const TString& key, const char* defaultVal) |
bool | getTagDouble(const TString& key, double& value) |
bool | getTagDouble(const TString& key, double& value, bool recursive) |
double | getTagDoubleDefault(const TString& key, double defaultVal = 0.) |
virtual TList* | getTaggablesByName(const TString& name) |
bool | getTagInteger(const TString& key, int& value) |
bool | getTagInteger(const TString& key, int& value, bool recursive) |
int | getTagIntegerDefault(const TString& key, int defaultVal = 0) |
TList* | getTagList(const TString& key) |
int | getTagListLength(const TString& key) |
int | getTagsSize() |
string | getTagStandardStringDefault(const TString& key, const TString& defaultVal = "") |
bool | getTagString(const TString& key, TString& value) |
bool | getTagString(const TString& key, TString& value, bool recursive) |
TString | getTagStringDefault(const TString& key, const TString& defaultVal = "") |
vector<bool> | getTagVBool(const TString& key) |
vector<double> | getTagVDouble(const TString& key) |
vector<int> | getTagVInt(const TString& key) |
vector<int> | getTagVInteger(const TString& key) |
vector<string> | getTagVStandardString(const TString& key) |
vector<TString> | getTagVString(const TString& key) |
bool | getTypeOfTagAsString(const TString& key, TString& type) |
static const TString& | getValidKeyCharacters() |
bool | getValueOfTagAsString(const TString& key, TString& value) |
TString | getValuesOfTags(const TString& keys, const TString& sep = ", ") |
bool | hasEquivalentTag(const TQValue* reference, bool recurseUp = true) |
bool | hasEquivalentTag(const TQValue& reference, bool recurseUp = true) |
bool | hasEquivalentTag(const TString& key, const TString& value) |
bool | hasEquivalentTag(const TString& key, const double value) |
bool | hasEquivalentTag(const TString& key, const int value) |
bool | hasEquivalentTag(const TString& key, const bool value) |
static bool | hasGlobalTaggable(const char* name) |
static bool | hasGlobalTaggable(const TString& name) |
bool | hasMatchingTag(const TString& name) const |
bool | hasTag(const TString& key) |
bool | hasTagBool(const TString& key) |
bool | hasTagDouble(const TString& key) |
bool | hasTagInteger(const TString& key) |
bool | hasTagString(const TString& key) |
bool | hasTagWithIndex(const TString& key) |
bool | hasTagWithoutIndex(const TString& key) |
virtual bool | hasUnreadKeys(const TString& filter = "") |
int | importTag(TString tag, bool overwrite = true, bool keepStringQuotes = false) |
int | importTags(TString tags, bool overwrite = true, bool keepStringQuotes = false) |
int | importTags(const TQTaggable* tags, bool overwrite = true, bool recursive = false) |
int | importTags(shared_ptr<TQTaggable> tags, bool overwrite = true, bool recursive = false) |
int | importTags(const TQTaggable& tags, bool overwrite = true, bool recursive = false) |
int | importTagsWithoutPrefix(const TQTaggable* tags, const TString& prefix, bool overwrite = true, bool recursive = false) |
int | importTagsWithoutPrefix(const TQTaggable& tags, const TString& prefix, bool overwrite = true, bool recursive = false) |
int | importTagsWithPrefix(TString tags, const TString& prefix, bool overwrite = true, bool keepStringQuotes = false, TString fallbackKey = "") |
int | importTagsWithPrefix(const TQTaggable* tags, const TString& prefix, bool overwrite = true, bool recursive = false, TString fallbackKey = "") |
int | importTagsWithPrefix(const TQTaggable& tags, const TString& prefix, bool overwrite = true, bool recursive = false, TString fallbackKey = "") |
int | importTagWithPrefix(const TString& tag, const TString& prefix, bool overwrite = true, TString fallbackKey = "", bool keepStringQuotes = false) |
virtual TClass* | IsA() const |
bool | isTagOverwrittenByDescendants(TString key) |
static bool | isValidKey(const TString& key) |
static TList* | makeListOfTags(TList* unTags) |
virtual void | onAccess(TQValue* tag) |
virtual void | onRead(TQValue* tag) |
virtual void | onWrite(TQValue* tag) |
TQTaggable& | operator=(const TString& s) |
TQTaggable& | operator=(const char* s) |
TQTaggable& | operator=(const TQTaggable& other) |
static TQTaggable* | parseFlags(const TString& flags) |
bool | parseKey(TString key, TString& bareKey, int& opUp, int& opDown) |
static TQTaggable* | parseParameterList(const TString& parameter, const TString& sep = ",", bool trim = true, const TString& blocks = "", const TString& quotes = "") |
int | printClaim(const TString& definition) |
bool | printDiffOfTags(TQTaggable* tags, const TString& options = "") |
bool | printDiffOfTags(TQTaggable* tags, TQTaggable& options) |
void | printTags(TString options = "r") |
static bool | removeGlobalTaggable(const char* name) |
static bool | removeGlobalTaggable(const TString& name) |
int | removeTag(const TString& key) |
int | removeTags(const TString& key) |
bool | renameTag(const TString& oldKey, const TString& newKey) |
int | renameTags(const TString& oldPrefix, const TString& newPrefix) |
string | replaceInStandardString(const TString& in, bool keepQuotes = false) |
string | replaceInStandardString(const TString& in, const char* prefix, bool keepQuotes = false) |
string | replaceInStandardString(const TString& in, const TString& prefix, bool keepQuotes = false) |
string | replaceInStandardStringRecursive(TString in, const TString& prefix = "", bool keepQuotes = false) |
int | replaceInTags(TQTaggable& params, const TString& tagFilter = "*") |
TString | replaceInText(const TString& in, bool keepQuotes = false) |
TString | replaceInText(const TString& in, const char* prefix, bool keepQuotes = false) |
TString | replaceInText(const TString& in, const TString& prefix, bool keepQuotes = false) |
TString | replaceInText(const TString& in, int& nReplaced, int& nFailed, bool keepQuotes = false) |
TString | replaceInText(TString in, int& nReplaced, int& nFailed, const TString& prefix, bool keepQuotes = false) |
TString | replaceInTextRecursive(TString in, const TString& prefix = "", bool keepQuotes = false) |
virtual void | resetReadFlags() |
void | setGlobalIgnoreCase(bool globalIgnoreCase = true) |
void | setGlobalOverwrite(bool globalOverwrite = true) |
int | setTag(const TString& key, double value, const TString& destination = "") |
int | setTag(const TString& key, int value, const TString& destination = "") |
int | setTag(const TString& key, bool value, const TString& destination = "") |
int | setTag(const TString& key, const TString& value, const TString& destination = "") |
int | setTag(const TString& key, const char* value, const TString& destination = "") |
int | setTag(const char* key, double value, const TString& destination = "") |
int | setTag(const char* key, int value, const TString& destination = "") |
int | setTag(const char* key, bool value, const TString& destination = "") |
int | setTag(const char* key, const TString& value, const TString& destination = "") |
int | setTag(const char* key, const char* value, const TString& destination = "") |
int | setTagAuto(const TString& key, TString value, const TString& destination = "") |
int | setTagBool(TString key, bool value, const TString& destination = "") |
int | setTagDouble(TString key, double value, const TString& destination = "") |
int | setTagInteger(TString key, int value, const TString& destination = "") |
int | setTagList(const TString& key, TString value, const TString& destination = "") |
int | setTagString(TString key, const TString& value, const TString& destination = "") |
virtual void | ShowMembers(TMemberInspector& insp) const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
bool | tagIsOfTypeBool(const TString& key) |
bool | tagIsOfTypeDouble(const TString& key) |
bool | tagIsOfTypeInteger(const TString& key) |
bool | tagIsOfTypeString(const TString& key) |
bool | tagsAreEquivalentTo(TQTaggable* tags, const TString& filter = "") |
TQTaggable() | |
TQTaggable(const TString& tags) | |
TQTaggable(const char* tags) | |
TQTaggable(TQTaggable* tags) | |
TQTaggable(const TQTaggable& tags) |
int | countTagDown(const TString& key) |
int | countTagUp(const TString& key) |
TQValue* | findTag(TString name) |
TList* | getListOfTags() |
bool | getOp(const TString& op, int& opCode) |
bool | getTag(const TString& key, TQValue*& tag) |
int | setTag(TQValue* tag, const TString& destination = "") |
int | setTag(TQValue* tag, const TString& destination, bool overwrite) |
virtual Bool_t | CheckTObjectHashConsistency() const |
bool | fGlobalIgnoreCase | ! |
bool | fGlobalOverwrite | ! |
TList* | fReadFlags | ! |
TList* | fTags | |
static TQTaggable::(anonymous) | kOpADD | |
static TQTaggable::(anonymous) | kOpAND | |
static TQTaggable::(anonymous) | kOpCNT | |
static TQTaggable::(anonymous) | kOpMULT | |
static TQTaggable::(anonymous) | kOpNone | |
static TQTaggable::(anonymous) | kOpOR | |
static TQTaggable::(anonymous) | kOpRec | |
static map<TString,shared_ptr<TQTaggable> > | sGlobalTaggables |
Creates a new instance of TQTaggable and tries to interpret the input string <tags> as comma-separated key-value assignments (see TQTaggable::importTags(...)). In case "--" is prepended the following string will be interpreted as flags (see TQTaggable:parseFlags(...)).
Creates a new instance of TQTaggable and tries to interpret the input string <tags> as comma-separated key-value assignments (see TQTaggable::importTags(...)). In case "--" is prepended the following string will be interpreted as flags (see TQTaggable:parseFlags(...)).
Creates a new instance of TQTaggable and imports tags assigned to <tags> to this instance.
Creates a new instance of TQTaggable and imports tags assigned to <tags> to this instance.
Returns a pointer to the base instance of TQTaggable in a tree of TQTaggables. This method is supposed to be overwritten by a descendant class implementing the management of a tree-like structure of TQTaggables.
Reads the input string <flags>, interprets it as a set of flags with optional parameters, and in case of success returns an instance of TQTaggable with tags set corresponding to the flags and its parameters listed in the input string (the user is responsible for deleting the returned instance). Returns a null pointer in case of failure. Please note: this method returns a new instance of TQTaggable even if there are no flags, e.g. if an empty string has been passed, parseFlags(""). A flag is usually represented by a single letter, also allowing for flags with more than one letter. Optionally, the flag might come with an additional parameter, either of type string or integer. "a" occurence of flag "a", resulting in tag "a = true" "a6" flag "a" coming with integer parameter (6), resulting in tag "a = 6" "a[test]" flag "a" coming with string parameter ("test"), resulting in tag "a = 'test'" Boolean flags (simple occurence) can be negated by prepending "!": "!a" negated occurence of flag "a", resulting in tag "a = false" Flags may be made of more than one single letter by enclosing its full name in "<>": "<myFlag>" occurence of flag "myFlag", resulting in tag "myFlag = true" Multiple flags are listed by simple string concatenation: "abc" occurence of flags "a", "b", and "c", resulting in tags "a = true, b = true, c = true" "ab5c[hello]" occurence of flag "a", flag "b" coming with integer parameter (5), and flag "c" coming with string parameter ("hello"), resulting in tags "a = true, b = 5, c = 'hello'" "a-2<flag>5" flag "a" coming with integer parameter (-2) and flag "flag" coming with integer parameter (5), resulting in tags "a = -2, flag = 5" This method is used to parse option flags to several functions of TQx classes. The inverse of TQTaggable::parseFlags(...) is TQTaggable::getFlags().
Creates and returns a string representing the tags associated to this instance of TQTaggable as flags (see TQTaggable::parseFlags(...) for detailed information).
return true if a tag matching the expression exists, false otherwise
check if there is a tag for the given key and if its value is equivalent to the given one
Renames tag with key <oldKey> to key <newKey> and returns true if renaming was successful and false otherwise. Renaming fails if <newKey> is not a valid key or a tag with key <newKey> already exists.
Renames all tags with keys that begin with <oldPrefix> replacing <oldPrefix> by <newPrefix> and returns the number of tags that were successfully renamed.
Removes and deletes all tags of this instance of TQTaggable ansd returns the number of tags that have been removed.
Removes and deletes all tags of this instance of TQTaggable ansd returns the number of tags that have been removed.
Tests the compatibility of the tags associated to this instance of TQTaggable with an expectation encoded in the input string <definition> and returns 1 if tags are compatible and 0 otherwise. Basically, <definition> is a comma-separated list of keys that need to exist as tags. Wildcards "?" and "*" may be used, in which case at least one tag with a key matching the pattern has to exist: - expected tag(s): "key, myTag, style.*" If a "!" is prepended to a key name a corresponding tag is expected to not be present: - unaccepted tag: "!key" Tags may be expected to have a certain data type or to be convertable to certain data types (i = integer, d = double, b = bool, s = string): - expect data type for tag: "key:d!" - expect tag to be convertable to data types: "key:id" Here, the "!" appended to a data type (or a list of data types) indicates that the tag has to have one of the listed data types (logical OR). In case no "!" is appended the tag is required to be convertable to every listed data type (logical AND). Tags may be marked as optional by enclosing the corresponding part in "[]": - optional tags: "[key], [style.color.*:i!]" If "!!" appears as one entry in the comma-separated list <definition> no tag with a key other than the listed ones is expected: - expect only listed keys: "key, myTag, style.*, !!" Numerical tags may be required to fulfill a certain condition, e.g. must be positive (operators "==", "!=", ">=", ">", "<=", and "<" are supported): - Tags must be positive: "myKeys*:d:>0" - Tags must not be zero: "myKeys*:d:!=0" The value -1 is returned in case the definition string could not be parsed properly. taggable fulfills claim? (will be set to zero in the course of this function once there is a tag not fulfilling the definition)
Tries to interpret the input string <parameter> as a comma-separated list of values and returns a new instance of TQTaggable with the parameter values represented as tags with the keys corresponding to the index of occurence of the value in the list (the user is responsible for deleting the returned instance). Returns a null pointer in case of failure. "1, 6, 4" results in tags "0 = 1, 1 = 6, 2 = 4", "1, 'hello', 4" results in tags "0 = 1, 1 = 'hello', 2 = 4".
the number of tags imported
import all tags from another TQTaggable object, appending a certain prefix
import all tags from another TQTaggable object, appending a certain prefix
import all tags from another TQTaggable object, filtering and removing a certain prefix
import all tags from another TQTaggable object, filtering and removing a certain prefix
convert a list of objects into a list of TQValue objects -- legacy converter function
import a list of tags
import a list of tags
import a list of tags
import a tag with a prefix
set a single string tag
set a single string tag
set a single double-precision floating point tag
set a single string tag
set a single string tag
set a single double-precision floating point tag
Takes a tag name and returns true if this key already exists with an index. Example: argument is "keyName". If "keyName."<integer> exists, return true, otherwise false.
Takes a tag name and returns true if this key already exists without an index. Example: argument is "keyName.3". If "keyName" exists, return true, otherwise false.
returns if the tag should be set (only relevant if globalOverwrite is false) the input treatAsList is ignored. It returned as true if the tag already exists with an index
set a tag, automatically picking the type
set a list of tags
set a single double-precision floating point number tag
set a single string tag
export the tags to another taggable object
export the tags as a string
export the tags to a config string
replace all placeholders $(xyz) by their respective tagged values "xyz = abc"
replace all placeholders $(xyz) by their respective tagged values "xyz = abc"
this version of the function recursively replaces the string until no resolvable tag is left
replace all placeholders $(xyz) by their respective tagged values "xyz = abc"
replace all placeholders $(xyz) by their respective tagged values "xyz = abc"
replace all placeholders $(xyz) by their respective tagged values "xyz = abc"
replace all placeholders $(xyz) by their respective tagged values "xyz = abc"
replace keys by values in a comma-separated string list
retrieve a list of tags as a vector of strings
retrieve a list of tags as a vector of integers
retrieve a list of tags as a vector of doubles
get a list of double-precision floating point tags
get a single double-precision floating point tag
get a single double-precision floating point tag
get a single double-precision floating point tag
get a single string tag
get a single double-precision floating point tag
get a single double-precision floating point tag
export the tags to a config file
@tag:[.configname] This object tag determines the prefix when exporting to a configuration file. Default: "Config"
@tag:[.filename] This object tag determines the filename when exporting to a configuration file. Default: "config.cfg"
Replace tag placeholders in tags set on this instance of TQTaggable according to the tags set on the TQTaggable object provided. A tag filter can be specified to only perform the replacement where the key of a tag matches the filter expression.
wrapper for the TString variant of this function
wrapper for the TString variant of this function
wrapper for the TString variant of this function
wrapper for the TString variant of this function
wrapper for the TString variant of this function
wrapper for the TString variant of this function
wrapper for the TString variant of this function
wrapper for the TString variant of this function