digiKam
|
Public Member Functions | |
void | finish () |
void | finishField () |
void | finishGroup () |
SearchXmlWriter () | |
void | setDefaultFieldOperator (SearchXml::Operator op) |
void | setFieldOperator (SearchXml::Operator op) |
void | setGroupCaption (const QString &caption) |
void | setGroupOperator (SearchXml::Operator op) |
void | writeField (const QString &name, SearchXml::Relation relation) |
void | writeGroup () |
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) |
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 |
Static Public Member Functions | |
static QString | keywordSearch (const QString &keyword) |
Protected Member Functions | |
void | writeOperator (const QString &, SearchXml::Operator) |
void | writeRelation (const QString &, SearchXml::Relation) |
Protected Attributes | |
QString | m_xml |
|
explicit |
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 Digikam::SearchXmlWriter::finish | ( | ) |
Finish the XML. No further group can be added after calling this. You need to call this before you can get the resulting XML from xml().
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), Digikam::SearchModificationHelper::createFuzzySearchFromDropped(), Digikam::SearchModificationHelper::createFuzzySearchFromImage(), Digikam::SearchModificationHelper::createFuzzySearchFromSketch(), keywordSearch(), Digikam::SearchModificationHelper::slotCreateTimeLineSearch(), Digikam::SearchView::write(), and Digikam::KeywordSearchWriter::xml().
void Digikam::SearchXmlWriter::finishField | ( | ) |
Finish writing the current field. You shall call this method before adding another field, or closing the group.
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), Digikam::SearchModificationHelper::createFuzzySearchFromDropped(), Digikam::SearchModificationHelper::createFuzzySearchFromImage(), Digikam::SearchModificationHelper::createFuzzySearchFromSketch(), keywordSearch(), Digikam::SearchModificationHelper::slotCreateTimeLineSearch(), Digikam::ItemLister::tagSearchXml(), Digikam::SearchFieldText::write(), Digikam::SearchFieldKeyword::write(), Digikam::SearchFieldRangeInt::write(), Digikam::SearchFieldRangeDouble::write(), Digikam::SearchFieldRangeDate::write(), Digikam::SearchFieldChoice::write(), Digikam::SearchFieldAlbum::write(), Digikam::SearchFieldRating::write(), Digikam::SearchFieldComboBox::write(), Digikam::SearchFieldCheckBox::write(), Digikam::SearchFieldLabels::write(), Digikam::SearchFieldMonthDay::write(), and Digikam::KeywordSearchWriter::xml().
void Digikam::SearchXmlWriter::finishGroup | ( | ) |
Finish the current group. 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.
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), Digikam::SearchModificationHelper::createFuzzySearchFromDropped(), Digikam::SearchModificationHelper::createFuzzySearchFromImage(), Digikam::SearchModificationHelper::createFuzzySearchFromSketch(), keywordSearch(), Digikam::SearchModificationHelper::slotCreateTimeLineSearch(), Digikam::ItemLister::tagSearchXml(), Digikam::SearchGroup::write(), and Digikam::KeywordSearchWriter::xml().
|
static |
Returns ready-made XML for a query of type "keyword" with the specified text as keyword.
References finish(), finishField(), finishGroup(), Digikam::SearchXml::Like, writeField(), writeGroup(), writeValue(), and xml().
void Digikam::SearchXmlWriter::setDefaultFieldOperator | ( | SearchXml::Operator | op | ) |
Sets the default operator for fields in this group "(field1 AND field2 AND ... fieldn)". The default operator can in each field be overridden. Default value is AND.
References Digikam::SearchXml::And, and writeOperator().
Referenced by Digikam::ItemLister::tagSearchXml(), and Digikam::SearchGroup::write().
void Digikam::SearchXmlWriter::setFieldOperator | ( | SearchXml::Operator | op | ) |
Adds an optional operator overriding the default field operator of the group.
References writeOperator().
void Digikam::SearchXmlWriter::setGroupCaption | ( | const QString & | caption | ) |
Sets an optional caption.
void Digikam::SearchXmlWriter::setGroupOperator | ( | SearchXml::Operator | op | ) |
Sets the operator applied to the group as a whole "OR (field1 ... fieldn)". Default value is OR.
References Digikam::SearchXml::Or, and writeOperator().
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), and Digikam::SearchGroup::write().
void Digikam::SearchXmlWriter::writeField | ( | const QString & | name, |
SearchXml::Relation | relation | ||
) |
Adds a new field with the given name (entity) and relation, "Rating less than ...". 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.
References writeRelation().
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), Digikam::SearchModificationHelper::createFuzzySearchFromDropped(), Digikam::SearchModificationHelper::createFuzzySearchFromImage(), Digikam::SearchModificationHelper::createFuzzySearchFromSketch(), keywordSearch(), Digikam::SearchModificationHelper::slotCreateTimeLineSearch(), Digikam::ItemLister::tagSearchXml(), Digikam::SearchFieldText::write(), Digikam::SearchFieldKeyword::write(), Digikam::SearchFieldRangeInt::write(), Digikam::SearchFieldRangeDouble::write(), Digikam::SearchFieldRangeDate::write(), Digikam::SearchFieldChoice::write(), Digikam::SearchFieldAlbum::write(), Digikam::SearchFieldRating::write(), Digikam::SearchFieldComboBox::write(), Digikam::SearchFieldCheckBox::write(), Digikam::SearchFieldLabels::write(), Digikam::SearchFieldMonthDay::write(), and Digikam::KeywordSearchWriter::xml().
void Digikam::SearchXmlWriter::writeGroup | ( | ) |
Adds a group. Use the returned group writer to add fields.
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), Digikam::SearchModificationHelper::createFuzzySearchFromDropped(), Digikam::SearchModificationHelper::createFuzzySearchFromImage(), Digikam::SearchModificationHelper::createFuzzySearchFromSketch(), keywordSearch(), Digikam::SearchModificationHelper::slotCreateTimeLineSearch(), Digikam::ItemLister::tagSearchXml(), Digikam::SearchGroup::write(), and Digikam::KeywordSearchWriter::xml().
|
protected |
References Digikam::SearchXml::And, Digikam::SearchXml::AndNot, Digikam::SearchXml::Or, and Digikam::SearchXml::OrNot.
Referenced by setDefaultFieldOperator(), setFieldOperator(), and setGroupOperator().
|
protected |
References Digikam::SearchXml::AllOf, Digikam::SearchXml::Equal, Digikam::SearchXml::GreaterThan, Digikam::SearchXml::GreaterThanOrEqual, Digikam::SearchXml::Inside, Digikam::SearchXml::Interval, Digikam::SearchXml::IntervalOpen, Digikam::SearchXml::InTree, Digikam::SearchXml::LessThan, Digikam::SearchXml::LessThanOrEqual, Digikam::SearchXml::Like, Digikam::SearchXml::Near, Digikam::SearchXml::NotInTree, Digikam::SearchXml::NotLike, Digikam::SearchXml::OneOf, and Digikam::SearchXml::Unequal.
Referenced by writeField().
void Digikam::SearchXmlWriter::writeValue | ( | const QDateTime & | dateTime | ) |
void Digikam::SearchXmlWriter::writeValue | ( | const QList< double > & | valueList, |
int | precision = 8 |
||
) |
void Digikam::SearchXmlWriter::writeValue | ( | const QList< float > & | valueList, |
int | precision = 6 |
||
) |
void Digikam::SearchXmlWriter::writeValue | ( | const QList< int > & | valueList | ) |
void Digikam::SearchXmlWriter::writeValue | ( | const QList< QDateTime > & | valueList | ) |
void Digikam::SearchXmlWriter::writeValue | ( | const QList< qlonglong > & | valueList | ) |
void Digikam::SearchXmlWriter::writeValue | ( | const QString & | value | ) |
Adds the value, "4" in the case of "Rating less than 4".
References value.
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), Digikam::SearchModificationHelper::createFuzzySearchFromDropped(), Digikam::SearchModificationHelper::createFuzzySearchFromImage(), Digikam::SearchModificationHelper::createFuzzySearchFromSketch(), keywordSearch(), Digikam::SearchModificationHelper::slotCreateTimeLineSearch(), Digikam::ItemLister::tagSearchXml(), Digikam::SearchFieldText::write(), Digikam::SearchFieldKeyword::write(), Digikam::SearchFieldRangeInt::write(), Digikam::SearchFieldRangeDouble::write(), Digikam::SearchFieldRangeDate::write(), Digikam::SearchFieldChoice::write(), Digikam::SearchFieldAlbum::write(), Digikam::SearchFieldRating::write(), Digikam::SearchFieldComboBox::write(), Digikam::SearchFieldLabels::write(), Digikam::SearchFieldMonthDay::write(), and Digikam::KeywordSearchWriter::xml().
void Digikam::SearchXmlWriter::writeValue | ( | const QStringList & | valueList | ) |
void Digikam::SearchXmlWriter::writeValue | ( | double | value, |
int | precision = 8 |
||
) |
References value.
void Digikam::SearchXmlWriter::writeValue | ( | float | value, |
int | precision = 6 |
||
) |
References value.
void Digikam::SearchXmlWriter::writeValue | ( | int | value | ) |
References value.
void Digikam::SearchXmlWriter::writeValue | ( | qlonglong | value | ) |
References value.
QString Digikam::SearchXmlWriter::xml | ( | ) | const |
Get the created XML. The value is only valid if finish() has been called.
References m_xml.
Referenced by Digikam::ItemQueryBuilder::convertFromUrlToXml(), Digikam::SearchModificationHelper::createFuzzySearchFromDropped(), Digikam::SearchModificationHelper::createFuzzySearchFromImage(), Digikam::SearchModificationHelper::createFuzzySearchFromSketch(), keywordSearch(), Digikam::SearchModificationHelper::slotCreateTimeLineSearch(), Digikam::ItemLister::tagSearchXml(), Digikam::SearchView::write(), and Digikam::KeywordSearchWriter::xml().
|
protected |
Referenced by xml().