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 * Max number of members per group |
|
32 */ |
|
33 const int MaxMemberPerGroup = 1000; |
|
34 /** |
|
35 * Max size for one SmfGroup |
|
36 */ |
|
37 const int MaxSmfGroupSize = MaxSmfContactSize*MaxMemberPerGroup; |
|
38 /** |
|
39 * @ingroup smf_common_group |
|
40 * The group class represents an instance of a group as per SN site terminolgy |
|
41 */ |
|
42 |
|
43 class SMFCLIENT_EXPORT SmfGroup //: public QObject |
|
44 { |
|
45 //Q_OBJECT |
|
46 public: |
|
47 /** |
|
48 * Constructor with default argument |
|
49 * @param list The list of members in the group |
|
50 */ |
|
51 SmfGroup( QList<SmfContact>* list = 0 ); |
|
52 |
|
53 /** |
|
54 * Copy Constructor |
|
55 * @param aOther The reference object |
|
56 */ |
|
57 SmfGroup( const SmfGroup &aOther ); |
|
58 |
|
59 /** |
|
60 * Overloaded = operator |
|
61 * @param aOther The reference object |
|
62 */ |
|
63 SmfGroup& operator=( const SmfGroup &aOther ); |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 */ |
|
68 ~SmfGroup( ); |
|
69 |
|
70 public slots: |
|
71 /** |
|
72 * Method to get the list of members in the group |
|
73 * @return The list of members in the group |
|
74 */ |
|
75 QList<SmfContact> members( ) const; |
|
76 |
|
77 /** |
|
78 * Method to set members |
|
79 * |
|
80 */ |
|
81 void setMembers(QList<SmfContact>* mems); |
|
82 /** |
|
83 * Method to get the name of the group |
|
84 * @return The name of the group |
|
85 */ |
|
86 QString name( ) const; |
|
87 |
|
88 /** |
|
89 * Method to set name |
|
90 */ |
|
91 void setName(QString& name); |
|
92 |
|
93 /** |
|
94 * Method to get the id of the group |
|
95 * @return The ID value |
|
96 */ |
|
97 QString id( ) const; |
|
98 |
|
99 /** |
|
100 * Method to set id |
|
101 */ |
|
102 void setId(QString& id); |
|
103 |
|
104 private: |
|
105 QSharedDataPointer<SmfGroupPrivate> d; |
|
106 |
|
107 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
108 const SmfGroup &aGroup ); |
|
109 |
|
110 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
111 SmfGroup &aGroup ); |
|
112 |
|
113 }; |
|
114 |
|
115 |
|
116 /** |
|
117 * Method for Externalization. Writes the SmfGroup object to |
|
118 * the stream and returns a reference to the stream. |
|
119 * @param aDataStream Stream to be written |
|
120 * @param aGroup The SmfGroup object to be externalized |
|
121 * @return reference to the written stream |
|
122 */ |
|
123 SMFCLIENT_EXPORT QDataStream &operator<<( QDataStream &aDataStream, |
|
124 const SmfGroup &aGroup ); |
|
125 |
|
126 /** |
|
127 * Method for Internalization. Reads a SmfGroup object from |
|
128 * the stream and returns a reference to the stream. |
|
129 * @param aDataStream Stream to be read |
|
130 * @param aGroup The SmfGroup object to be internalized |
|
131 * @return reference to the stream |
|
132 */ |
|
133 SMFCLIENT_EXPORT QDataStream &operator>>( QDataStream &aDataStream, |
|
134 SmfGroup &aGroup); |
|
135 |
|
136 typedef QList<SmfGroup> SmfGroupList; |
|
137 |
|
138 // Make the class SmfGroup known to QMetaType, so that as to register it. |
|
139 Q_DECLARE_METATYPE(SmfGroup) |
|
140 Q_DECLARE_METATYPE(QList<SmfGroup>) |
|
141 |
|
142 #endif /* SMFGROUP_H_ */ |
|