Seamly2D
Code documentation
vserializedproperty.cpp
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file vserializedproperty.cpp
4  ** @author hedgeware <internal(at)hedgeware.net>
5  ** @date
6  **
7  ** @brief
8  ** @copyright
9  ** All rights reserved. This program and the accompanying materials
10  ** are made available under the terms of the GNU Lesser General Public License
11  ** (LGPL) version 2.1 which accompanies this distribution, and is available at
12  ** http://www.gnu.org/licenses/lgpl-2.1.html
13  **
14  ** This library is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  ** Lesser General Public License for more details.
18  **
19  *************************************************************************/
20 
21 #include "vserializedproperty.h"
22 
23 #include <QtGlobal>
24 
25 #include "vproperty.h"
26 #include "vpropertyset.h"
27 
29  : ID(), Type(), Value(), Children()
30 {}
31 
32 /*! Creates a new VSerializedProperty from an existing property
33 
34 */
36  : ID(), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()),
37  Children()
38 {
39  if (set)
40  {
41  ID = set->getPropertyID(property);
42 
43  initChildren(property, set);
44  }
45 }
46 
47 VPE::VSerializedProperty::VSerializedProperty(const VProperty *property, const QString &id, const VPropertySet *set)
48  : ID(id), Type(property ? property->type() : QString()), Value(property ? property->getValue() : QVariant()),
49  Children()
50 {
51  initChildren(property, set);
52 }
53 
54 VPE::VSerializedProperty::VSerializedProperty(const QString &id, const QString &type, const QVariant &value)
55  : ID(id), Type(type), Value(value), Children()
56 {
57 }
58 
60 {
61  if (property && set)
62  {
63  const QList<VProperty*>& tmpChildren = property->getChildren();
64  foreach(const VProperty* tmpChild, tmpChildren)
65  {
66  QString tmpChildID = set->getPropertyID(property);
67  Children.append(VSerializedProperty(tmpChild, tmpChildID, set));
68  }
69  }
70 }
VPropertySet is a simple class for managing a set of properties. If you don't need all the Model-func...
Definition: vpropertyset.h:48
virtual QString getPropertyID(const VProperty *prop, bool look_for_parent_id=true) const
Returns the ID of the property within the set The concept of property IDs is, that the object that ma...
QString ID
The property type.
void initChildren(const VProperty *property, const VPropertySet *set)