aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/baremetal/debugservers/uvsc/xmlproperty.cpp
blob: b1221f615603a460a3329141357b6971cbccc408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "xmlnodevisitor.h"
#include "xmlproperty.h"

namespace BareMetal {
namespace Gen {
namespace Xml {

Property::Property(QByteArray name, QVariant value)
{
    setName(std::move(name));
    setValue(std::move(value));
}

void Property::appendProperty(QByteArray name, QVariant value)
{
    appendChild<Property>(std::move(name), std::move(value));
}

void Property::appendMultiLineProperty(QByteArray key, QStringList values, QChar sep)
{
    const QString line = values.join(std::move(sep));
    appendProperty(std::move(key), QVariant::fromValue(line));
}

void Property::accept(INodeVisitor *visitor) const
{
    visitor->visitPropertyStart(this);

    for (const auto &child : children())
        child->accept(visitor);

    visitor->visitPropertyEnd(this);
}

} // namespace Xml
} // namespace Gen
} // namespace BareMetal