| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Digikam::SearchXmlWriter Class Reference
Inheritance diagram for Digikam::SearchXmlWriter:

## 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

## Member Function Documentation

## ◆ finish()

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().

## ◆ finishField()

void Digikam::SearchXmlWriter::finishField | ( |  | ) |

You shall call this method before adding another field, or closing the group.

## ◆ finishGroup()

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.

## ◆ setDefaultFieldOperator()

void Digikam::SearchXmlWriter::setDefaultFieldOperator | ( | SearchXml::Operator | op | ) |

The default operator can in each field be overridden. Default value is AND.

## ◆ setGroupOperator()

void Digikam::SearchXmlWriter::setGroupOperator | ( | SearchXml::Operator | op | ) |

Default value is OR.

## ◆ writeField()

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.

## ◆ writeGroup()

void Digikam::SearchXmlWriter::writeGroup | ( |  | ) |

Use the returned group writer to add fields.

## ◆ xml()

QString Digikam::SearchXmlWriter::xml | ( |  | ) | const

The value is only valid if finish() has been called.