Buteo Synchronization Framework: Profile_p.h Source File

Buteo Synchronization Framework

Profile_p.h
1 /*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23 #ifndef PROFILE_P_H
24 #define PROFILE_P_H
25
26 #include <QList>
27 #include <QMap>
28 #include <QString>
29 #include "ProfileField.h"
30
31 namespace Buteo {
32
34 class ProfilePrivate
35 {
36 public:
38 ProfilePrivate();
39
41 ProfilePrivate(const ProfilePrivate &aSource);
42
44 ~ProfilePrivate();
45
47 QString iName;
48
50 QString iType;
51
53 bool iLoaded;
54
56 bool iMerged;
57
59 QMap<QString, QString> iLocalKeys;
60
62 QMap<QString, QString> iMergedKeys;
63
65 QList<const ProfileField *> iLocalFields;
66
68 QList<const ProfileField *> iMergedFields;
69
71 QList<Profile *> iSubProfiles;
72 };
73 }
74
75
76
77
78 Buteo::ProfilePrivate::ProfilePrivate()
79 : iLoaded(false),
80 iMerged(false)
81 {
82 }
83
84 Buteo::ProfilePrivate::ProfilePrivate(const ProfilePrivate &aSource)
85 : iName(aSource.iName),
86 iType(aSource.iType),
87 iLoaded(aSource.iLoaded),
88 iMerged(aSource.iMerged),
89 iLocalKeys(aSource.iLocalKeys),
90 iMergedKeys(aSource.iMergedKeys)
91 {
92 foreach (const ProfileField *localField, aSource.iLocalFields) {
93 iLocalFields.append(new ProfileField(*localField));
94 }
95 foreach (const ProfileField *mergedField, aSource.iMergedFields) {
96 iMergedFields.append(new ProfileField(*mergedField));
97 }
98
99 foreach (Profile *p, aSource.iSubProfiles) {
100 iSubProfiles.append(p->clone());
101 }
102 }
103
104 Buteo::ProfilePrivate::~ProfilePrivate()
105 {
106 qDeleteAll(iLocalFields);
107 iLocalFields.clear();
108 qDeleteAll(iMergedFields);
109 iMergedFields.clear();
110
111 qDeleteAll(iSubProfiles);
112 iSubProfiles.clear();
113 }
114
115
116
117 #endif // PROFILE_P_H
Buteo::ProfileField
This class represents a profile field.
Definition: ProfileField.h:49
Buteo::ProfilePrivate
Private implementation class for Profile class.
Definition: Profile_p.h:35
Buteo::ProfilePrivate::iLocalFields
QList< const ProfileField * > iLocalFields
Local fields, that are not merged from sub-profiles.
Definition: Profile_p.h:65
Buteo::ProfilePrivate::iMergedFields
QList< const ProfileField * > iMergedFields
Fields that are merged from sub-profiles.
Definition: Profile_p.h:68
Buteo::ProfilePrivate::iMergedKeys
QMap< QString, QString > iMergedKeys
Keys that are merged from sub-profile files.
Definition: Profile_p.h:62
Buteo::ProfilePrivate::iLocalKeys
QMap< QString, QString > iLocalKeys
Local keys, that are not merged from sub-profiles.
Definition: Profile_p.h:59
Buteo::ProfilePrivate::ProfilePrivate
ProfilePrivate()
Constructor.
Definition: Profile_p.h:78
Buteo::ProfilePrivate::~ProfilePrivate
~ProfilePrivate()
Destructor.
Definition: Profile_p.h:104
Buteo::ProfilePrivate::iMerged
bool iMerged
Is the profile merged created by merging from sub-profile.
Definition: Profile_p.h:56
Buteo::ProfilePrivate::iName
QString iName
Profile name.
Definition: Profile_p.h:47
Buteo::ProfilePrivate::iLoaded
bool iLoaded
Is the profile fully loaded and constructed.
Definition: Profile_p.h:53
Buteo::ProfilePrivate::iSubProfiles
QList< Profile * > iSubProfiles
List of sub-profiles.
Definition: Profile_p.h:71
Buteo::ProfilePrivate::iType
QString iType
Profile type.
Definition: Profile_p.h:50
Buteo::Profile
This class represents a single profile, a collection of settings or data releated to some entity.
Definition: Profile.h:53
Buteo::Profile::clone
virtual Profile * clone() const
Creates a clone of the profile.
Definition: Profile.cpp:97
QList
Definition: SyncBackupAdaptor.h:40
QMap< QString, QString >