Add hasKey() convenience methods.

This commit is contained in:
Felix Geyer 2014-12-03 23:36:24 +01:00
parent 876a75b572
commit 3ea0592b53
4 changed files with 12 additions and 0 deletions

View file

@ -27,6 +27,11 @@ QList<QString> EntryAttachments::keys() const
return m_attachments.keys(); return m_attachments.keys();
} }
bool EntryAttachments::hasKey(const QString& key) const
{
return m_attachments.keys().contains(key);
}
QList<QByteArray> EntryAttachments::values() const QList<QByteArray> EntryAttachments::values() const
{ {
return m_attachments.values(); return m_attachments.values();

View file

@ -30,6 +30,7 @@ class EntryAttachments : public QObject
public: public:
explicit EntryAttachments(QObject* parent = Q_NULLPTR); explicit EntryAttachments(QObject* parent = Q_NULLPTR);
QList<QString> keys() const; QList<QString> keys() const;
bool hasKey(const QString& key) const;
QList<QByteArray> values() const; QList<QByteArray> values() const;
QByteArray value(const QString& key) const; QByteArray value(const QString& key) const;
void set(const QString& key, const QByteArray& value); void set(const QString& key, const QByteArray& value);

View file

@ -36,6 +36,11 @@ QList<QString> EntryAttributes::keys() const
return m_attributes.keys(); return m_attributes.keys();
} }
bool EntryAttributes::hasKey(const QString& key) const
{
return m_attributes.keys().contains(key);
}
QList<QString> EntryAttributes::customKeys() QList<QString> EntryAttributes::customKeys()
{ {
QList<QString> customKeys; QList<QString> customKeys;

View file

@ -32,6 +32,7 @@ class EntryAttributes : public QObject
public: public:
explicit EntryAttributes(QObject* parent = Q_NULLPTR); explicit EntryAttributes(QObject* parent = Q_NULLPTR);
QList<QString> keys() const; QList<QString> keys() const;
bool hasKey(const QString& key) const;
QList<QString> customKeys(); QList<QString> customKeys();
QString value(const QString& key) const; QString value(const QString& key) const;
bool isProtected(const QString& key) const; bool isProtected(const QString& key) const;