akonadi
21 #include "entityannotationsattribute.h"
28 EntityAnnotationsAttribute::EntityAnnotationsAttribute()
32 EntityAnnotationsAttribute::EntityAnnotationsAttribute(
const QMap<QByteArray, QByteArray> &annotations)
33 : mAnnotations(annotations)
37 void EntityAnnotationsAttribute::setAnnotations(
const QMap<QByteArray, QByteArray> &annotations)
39 mAnnotations = annotations;
42 QMap<QByteArray, QByteArray> EntityAnnotationsAttribute::annotations()
const
47 void EntityAnnotationsAttribute::insert(
const QByteArray &key,
const QString &value)
49 mAnnotations.insert(key, value.toUtf8());
52 QString EntityAnnotationsAttribute::value(
const QByteArray &key)
54 return QString::fromUtf8(mAnnotations.value(key).data());
57 bool EntityAnnotationsAttribute::contains(
const QByteArray &key)
const
59 return mAnnotations.contains(key);
64 static const QByteArray sType(
"entityannotations" );
75 QByteArray result =
"";
77 Q_FOREACH (
const QByteArray &key, mAnnotations.keys()) {
80 result += mAnnotations[key];
91 const QList<QByteArray> lines = data.split(
'%');
93 for (
int i = 0; i < lines.size(); ++i) {
94 QByteArray line = lines[i];
95 if (i != 0 && line.startsWith(
' ')) {
98 if (i != lines.size() - 1 && line.endsWith(
' ')) {
101 if (line.trimmed().isEmpty()) {
104 int wsIndex = line.indexOf(
' ');
106 const QByteArray key = line.mid(0, wsIndex);
107 const QByteArray value = line.mid(wsIndex + 1);
108 mAnnotations[key] = value;
110 mAnnotations.insert(line, QByteArray());
QByteArray type() const
Returns the type of the attribute.
void deserialize(const QByteArray &data)
Sets the data of this attribute, using the same encoding as returned by toByteArray().
Attribute * clone() const
Creates a copy of this attribute.
Provides interface for custom attributes for Entity.
An attribute for annotations.
QByteArray serialized() const
Returns a QByteArray representation of the attribute which will be storaged.
FreeBusyManager::Singleton.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Jul 28 2020 00:00:00 by
doxygen 1.8.18 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.