2014-09-10 17:27:45 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vserializedproperty.cpp
|
|
|
|
** @author hedgeware <internal(at)hedgeware.net>
|
|
|
|
** @date
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** All rights reserved. This program and the accompanying materials
|
|
|
|
** are made available under the terms of the GNU Lesser General Public License
|
|
|
|
** (LGPL) version 2.1 which accompanies this distribution, and is available at
|
|
|
|
** http://www.gnu.org/licenses/lgpl-2.1.html
|
|
|
|
**
|
|
|
|
** This library is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
** Lesser General Public License for more details.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vserializedproperty.h"
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
#include "vproperty.h"
|
|
|
|
#include "vpropertyset.h"
|
|
|
|
|
2016-12-21 13:02:55 +01:00
|
|
|
VPE::VSerializedProperty::VSerializedProperty()
|
2014-09-20 18:05:21 +02:00
|
|
|
: ID(), Type(), Value(), Children()
|
|
|
|
{}
|
2014-09-10 17:27:45 +02:00
|
|
|
|
|
|
|
/*! Creates a new VSerializedProperty from an existing property
|
|
|
|
|
|
|
|
*/
|
2016-12-21 13:02:55 +01:00
|
|
|
VPE::VSerializedProperty::VSerializedProperty(const VProperty* property, const VPropertySet* set)
|
2014-09-20 18:05:21 +02:00
|
|
|
: ID(), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()),
|
|
|
|
Children()
|
2014-09-10 17:27:45 +02:00
|
|
|
{
|
2014-09-10 19:57:08 +02:00
|
|
|
if (set)
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
ID = set->getPropertyID(property);
|
|
|
|
|
|
|
|
initChildren(property, set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-21 13:02:55 +01:00
|
|
|
VPE::VSerializedProperty::VSerializedProperty(const VProperty *property, const QString &id, const VPropertySet *set)
|
2014-09-20 18:05:21 +02:00
|
|
|
: ID(id), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()),
|
|
|
|
Children()
|
2014-09-10 17:27:45 +02:00
|
|
|
{
|
|
|
|
initChildren(property, set);
|
|
|
|
}
|
|
|
|
|
2016-12-21 13:02:55 +01:00
|
|
|
VPE::VSerializedProperty::VSerializedProperty(const QString &id, const QString &type, const QVariant &value)
|
2014-09-20 18:05:21 +02:00
|
|
|
: ID(id), Type(type), Value(value), Children()
|
2014-09-10 17:27:45 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-12-21 13:02:55 +01:00
|
|
|
void VPE::VSerializedProperty::initChildren(const VProperty *property, const VPropertySet *set)
|
2014-09-10 17:27:45 +02:00
|
|
|
{
|
2014-09-10 19:57:08 +02:00
|
|
|
if (property && set)
|
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
const QList<VProperty*>& tmpChildren = property->getChildren();
|
2023-05-03 13:07:02 +02:00
|
|
|
for (auto *tmpChild : tmpChildren)
|
2014-09-10 19:57:08 +02:00
|
|
|
{
|
2014-09-10 17:27:45 +02:00
|
|
|
QString tmpChildID = set->getPropertyID(property);
|
|
|
|
Children.append(VSerializedProperty(tmpChild, tmpChildID, set));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|