swift
Loading...
Searching...
No Matches
fgswiftbussettings.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2023 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6SWIFT_DEFINE_VALUEOBJECT_MIXINS(swift::misc::simulation::settings, CFGSwiftBusSettings)
7
8namespace swift::misc::simulation::settings
9{
11 {
12 if (index.isMyself())
13 {
14 return QVariant::fromValue(*this);
15 }
16 const auto i = index.frontCasted<ColumnIndex>();
17 switch (i)
18 {
19 case IndexDBusServerAddress: return QVariant::fromValue(m_dBusServerAddress);
20 default: break;
21 }
23 }
24
26 {
27 if (index.isMyself())
28 {
29 (*this) = variant.value<CFGSwiftBusSettings>();
30 return;
31 }
32
33 const auto i = index.frontCasted<ColumnIndex>();
34 switch (i)
35 {
36 case IndexDBusServerAddress: m_dBusServerAddress = variant.toString(); break;
37 default: CValueObject::setPropertyByIndex(index, variant); break;
38 }
39 }
40
42 {
43 Q_UNUSED(i18n);
44 return "DBusServer: " + m_dBusServerAddress;
45 }
46
47} // namespace swift::misc::simulation::settings
Non-owning reference to a CPropertyIndex with a subset of its features.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
Definition mixinindex.h:167
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Definition mixinindex.h:180
QString convertToQString(bool i18n=false) const
Cast as QString.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant fromValue(T &&value)
QString toString() const const
T value() const &const
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.
Definition valueobject.h:67