8#include "vcardline_p.h"
10#include "parametermap_p.h"
12using namespace KContacts;
18VCardLine::VCardLine(
const QString &identifier)
19 : VCardLine(identifier, {})
24 : mIdentifier(identifier)
29VCardLine::VCardLine(
const VCardLine &line)
30 : mParamMap(line.mParamMap)
31 , mIdentifier(line.mIdentifier)
37VCardLine::~VCardLine()
41VCardLine &VCardLine::operator=(
const VCardLine &line)
47 mParamMap = line.mParamMap;
49 mIdentifier = line.mIdentifier;
55bool VCardLine::operator==(
const VCardLine &other)
const
58 return (mParamMap == other.parameterMap())
59 && (mValue == other.value())
60 && (mIdentifier == other.identifier())
61 && (mGroup == other.group());
65void VCardLine::setIdentifier(
const QString &identifier)
67 mIdentifier = identifier;
70QString VCardLine::identifier()
const
75void VCardLine::setValue(
const QVariant &value)
85void VCardLine::setGroup(
const QString &group)
95bool VCardLine::hasGroup()
const
104 for (
const auto &[param, values] : mParamMap) {
111void VCardLine::addParameters(
const ParameterMap ¶ms)
113 for (
const auto &[param, list] : params) {
118void VCardLine::addParameter(
const QString ¶m,
const QString &value)
120 auto it = mParamMap.findParam(param);
121 if (it != mParamMap.end()) {
122 if (!it->paramValues.contains(value)) {
123 it->paramValues.push_back(value);
126 mParamMap.insertParam({param,
QStringList{value}});
132 auto it = mParamMap.findParam(param);
138 auto it = mParamMap.findParam(param);
139 return it != mParamMap.
cend() && !it->paramValues.isEmpty() ? it->paramValues.at(0) :
QString{};
142ParameterMap VCardLine::parameterMap()
const
KIOCORE_EXPORT QStringList list(const QString &fileClass)
void append(QList< T > &&value)
const_iterator cend() const const
void reserve(qsizetype size)
const_iterator cend() const const
bool isEmpty() const const
QString join(QChar separator) const const