Hydra 0.20
hydra::Tags Class Reference

#include <Records.h>

Inheritance diagram for hydra::Tags:

List of all members.

Public Types

typedef std::set< QString > parent_t
typedef std::set< QString > set_t

Public Member Functions

void debugPrint (void) const
 debugPrint function
bool insertTag (const QString &newtag, bool *imageChanged=0)
bool eraseTag (const QString &newtag, bool *imageChanged=0)
bool clearTags (bool *imageChanged=0)
bool containsKey (const QString &key) const
bool insertKey (const QString &key, const QString &value, bool *imageChanged=0)
bool eraseKey (const QString &key, bool *imageChanged=0)
QString keyValue (const QString &key) const

Static Public Member Functions

static int indexOfKeyValue (const QString &s)

Static Public Attributes

static const char SEP_CHAR = '='

Detailed Description

A set or tags (strings).

A std::set derived class that provides additional useful functions for dealing with tag sets.

Author:
Aleksander Demko

Member Function Documentation

bool hydra::Tags::clearTags ( bool *  imageChanged = 0)

Erases all the tags. See insertTag for API info.

Author:
Aleksander Demko
bool hydra::Tags::containsKey ( const QString &  key) const

Check if this tag set has the given key. Key-values look like: key=value Note that if there is no =, then it is not a valid key-value. Therefore basic tags will return false for this test.

TODO in the future, switch the hole Tags concept to a std::map, which would be optimized for empty-values (as 99% of the tags wont have any values)... or not

Author:
Aleksander Demko
bool hydra::Tags::eraseKey ( const QString &  key,
bool *  imageChanged = 0 
)

Erase the given key, no matter what's its value. Returns true if anything was erased, false otherwise.

Author:
Aleksander Demko
bool hydra::Tags::eraseTag ( const QString &  newtag,
bool *  imageChanged = 0 
)

Erases a tag. See insertTag for API info.

Author:
Aleksander Demko
static int hydra::Tags::indexOfKeyValue ( const QString &  s) [inline, static]

Returns the index of the keyvalue seperator, or -1 for not found.

Author:
Aleksander Demko
bool hydra::Tags::insertKey ( const QString &  key,
const QString &  value,
bool *  imageChanged = 0 
)

Sets the current value for the given key. Returns true if anything was done.

Author:
Aleksander Demko
bool hydra::Tags::insertTag ( const QString &  newtag,
bool *  imageChanged = 0 
)

Sets the given tag, while maintaining some consistancy (for example, = key values). This is prefered over direct write access to the std::set class. In the future, direct access may be eliminated (or the whole thing replaced with a map?)

If imageChanged is non-null AND this operation changes the image (rotate tags), then *imageChanged will be set to true. It will be untouched otherwise.

Parameters:
tagthe tag to insert/set.
imageChangedwas the image "changed"
Returns:
true if the tags where modified (and probably need to be commited)
Author:
Aleksander Demko
QString hydra::Tags::keyValue ( const QString &  key) const

Return the given value for the given key. Returns "" if this key doesnt exist. Key-values look like: key=value Note that if there is no =, then it is not a valid key-value. Therefore basic tags will return false for this test.

TODO in the future, switch the hole Tags concept to a std::map, which would be optimized for empty-values (as 99% of the tags wont have any values)... or not

Author:
Aleksander Demko

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables