1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html" |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The group class represents an instance of a group as per SN site terminolgy |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef SMFGROUP_H_ |
|
21 #define SMFGROUP_H_ |
|
22 |
|
23 #include <smfcontact.h> |
|
24 #include <qdatastream.h> |
|
25 #include <QSharedData> |
|
26 #include "smfclientglobal.h" |
|
27 #include <QMetaType> |
|
28 #include "smfgroup_p.h" |
|
29 |
|
30 |
|
31 /** |
|
32 * @ingroup smf_common_group |
|
33 * The group class represents an instance of a group as per SN site terminolgy |
|
34 */ |
|
35 |
|
36 //QList<SmfGroup> gives error for serialization if its derived from QObject |
|
37 class SMFCLIENT_EXPORT SmfGroup //: public QObject |
|
38 { |
|
39 //Q_OBJECT |
|
40 public: |
|
41 /** |
|
42 * Constructor with default argument |
|
43 * @param list The list of members in the group |
|
44 */ |
|
45 SmfGroup( QList<SmfContact>* list = 0 ); |
|
46 |
|
47 /** |
|
48 * Copy Constructor |
|
49 * @param aOther The reference object |
|
50 */ |
|
51 SmfGroup( const SmfGroup &aOther ); |
|
52 |
|
53 /** |
|
54 * Overloaded = operator |
|
55 * @param aOther The reference object |
|
56 */ |
|
57 SmfGroup& operator=( const SmfGroup &aOther ); |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 ~SmfGroup( ); |
|
63 |
|
64 public slots: |
|
65 /** |
|
66 * Method to get the list of members in the group |
|
67 * @return The list of members in the group |
|
68 */ |
|
69 QList<SmfContact> members( ) const; |
|
70 |
|
71 /** |
|
72 * Method to set members |
|
73 * |
|
74 */ |
|
75 void setMembers(QList<SmfContact>* mems); |
|
76 /** |
|
77 * Method to get the name of the group |
|
78 * @return The name of the group |
|
79 */ |
|
80 QString name( ) const; |
|
81 |
|
82 /** |
|
83 * Method to set name |
|
84 */ |
|
85 void setName(QString& name); |
|
86 |
|
87 /** |
|
88 * Method to get the id of the group |
|
89 * @return The ID value |
|
90 */ |
|
91 QString id( ) const; |
|
92 |
|
93 /** |
|
94 * Method to set id |
|
95 */ |
|
96 void setId(QString& id); |
|
97 |
|
98 private: |
|
99 QSharedDataPointer<SmfGroupPrivate> d; |
|
100 |
|
101 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
102 const SmfGroup &aGroup ); |
|
103 |
|
104 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
105 SmfGroup &aGroup ); |
|
106 |
|
107 }; |
|
108 |
|
109 |
|
110 /** |
|
111 * Method for Externalization. Writes the SmfGroup object to |
|
112 * the stream and returns a reference to the stream. |
|
113 * @param aDataStream Stream to be written |
|
114 * @param aGroup The SmfGroup object to be externalized |
|
115 * @return reference to the written stream |
|
116 */ |
|
117 SMFCLIENT_EXPORT QDataStream &operator<<( QDataStream &aDataStream, |
|
118 const SmfGroup &aGroup ); |
|
119 |
|
120 /** |
|
121 * Method for Internalization. Reads a SmfGroup object from |
|
122 * the stream and returns a reference to the stream. |
|
123 * @param aDataStream Stream to be read |
|
124 * @param aGroup The SmfGroup object to be internalized |
|
125 * @return reference to the stream |
|
126 */ |
|
127 SMFCLIENT_EXPORT QDataStream &operator>>( QDataStream &aDataStream, |
|
128 SmfGroup &aGroup); |
|
129 |
|
130 typedef QList<SmfGroup> SmfGroupList; |
|
131 |
|
132 // Make the class SmfGroup known to QMetaType, so that as to register it. |
|
133 Q_DECLARE_METATYPE(SmfGroup) |
|
134 Q_DECLARE_METATYPE(QList<SmfGroup>) |
|
135 |
|
136 #endif /* SMFGROUP_H_ */ |
|