![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Public Member Functions | |
SearchXmlWriter () | |
Note that SearchXmlWriter and SearchXmlGroupWriter rely on you calling the methods following the restrictions set by the documentation; Otherwise you will not produce the desired output. | |
void | finish () |
Finish the XML. | |
void | finishField () |
Finish writing the current field. | |
void | finishGroup () |
Finish the current group. | |
void | setDefaultFieldOperator (SearchXml::Operator op) |
Sets the default operator for fields in this group "(field1 AND field2 AND ... fieldn)". | |
void | setFieldOperator (SearchXml::Operator op) |
Adds an optional operator overriding the default field operator of the group. | |
void | setGroupCaption (const QString &caption) |
Sets an optional caption. | |
void | setGroupOperator (SearchXml::Operator op) |
Sets the operator applied to the group as a whole "OR (field1 ... fieldn)". | |
void | writeField (const QString &name, SearchXml::Relation relation) |
Adds a new field with the given name (entity) and relation, "Rating less than ...". | |
void | writeGroup () |
Adds a group. | |
void | writeValue (const QDateTime &dateTime) |
void | writeValue (const QList< double > &valueList, int precision=8) |
void | writeValue (const QList< float > &valueList, int precision=6) |
void | writeValue (const QList< int > &valueList) |
void | writeValue (const QList< QDateTime > &valueList) |
void | writeValue (const QList< qlonglong > &valueList) |
void | writeValue (const QString &value) |
Adds the value, "4" in the case of "Rating less than 4". | |
void | writeValue (const QStringList &valueList) |
void | writeValue (double value, int precision=8) |
void | writeValue (float value, int precision=6) |
void | writeValue (int value) |
void | writeValue (qlonglong value) |
QString | xml () const |
Get the created XML. | |
Static Public Member Functions | |
static QString | keywordSearch (const QString &keyword) |
Returns ready-made XML for a query of type "keyword" with the specified text as keyword. | |
Protected Member Functions | |
void | writeOperator (const QString &, SearchXml::Operator) |
void | writeRelation (const QString &, SearchXml::Relation) |
Protected Attributes | |
QString | m_xml |
void Digikam::SearchXmlWriter::finish | ( | ) |
No further group can be added after calling this. You need to call this before you can get the resulting XML from xml().
void Digikam::SearchXmlWriter::finishField | ( | ) |
You shall call this method before adding another field, or closing the group.
void Digikam::SearchXmlWriter::finishGroup | ( | ) |
You cannot add anymore fields after calling this. Note that you will want to call this before writing another group if you want the group on the same level. You can as well add nested groups and call this to close the group afterwards.
void Digikam::SearchXmlWriter::setDefaultFieldOperator | ( | SearchXml::Operator | op | ) |
The default operator can in each field be overridden. Default value is AND.
void Digikam::SearchXmlWriter::setGroupOperator | ( | SearchXml::Operator | op | ) |
Default value is OR.
void Digikam::SearchXmlWriter::writeField | ( | const QString & | name, |
SearchXml::Relation | relation | ||
) |
Ensure that you closed the previous field with finishField(). For a reference of valid field names, look into ItemQueryBuilder. The general rule is that names are like the database fields, but all lower-case.
void Digikam::SearchXmlWriter::writeGroup | ( | ) |
Use the returned group writer to add fields.
QString Digikam::SearchXmlWriter::xml | ( | ) | const |
The value is only valid if finish() has been called.