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 #include "smfgroup.h" |
|
20 //private impl |
|
21 #include "smfgroup_p.h" |
|
22 |
|
23 /** |
|
24 * Constructor with default argument |
|
25 * @param list The list of members in the group |
|
26 */ |
|
27 SmfGroup::SmfGroup( QList<SmfContact>* list ) |
|
28 { |
|
29 d = new SmfGroupPrivate; |
|
30 if(list) |
|
31 d->m_members = list; |
|
32 } |
|
33 |
|
34 /** |
|
35 * Copy Constructor |
|
36 * @param aOther The reference object |
|
37 */ |
|
38 SmfGroup::SmfGroup( const SmfGroup &aOther ): d(aOther.d) |
|
39 { |
|
40 |
|
41 } |
|
42 |
|
43 /** |
|
44 * Overloaded = operator |
|
45 * @param aOther The reference object |
|
46 * @return The target reference value |
|
47 */ |
|
48 SmfGroup& SmfGroup::operator=( const SmfGroup &aOther ) |
|
49 { |
|
50 d->m_members = aOther.d->m_members; |
|
51 d->m_groupName = aOther.d->m_groupName; |
|
52 d->m_groupId = aOther.d->m_groupId; |
|
53 return *this; |
|
54 } |
|
55 |
|
56 /** |
|
57 * Destructor |
|
58 */ |
|
59 SmfGroup::~SmfGroup( ) |
|
60 { |
|
61 |
|
62 } |
|
63 |
|
64 /** |
|
65 * Method to get the list of members in the group |
|
66 * @return The list of members in the group |
|
67 */ |
|
68 QList<SmfContact> SmfGroup::members( ) const |
|
69 { |
|
70 return *(d->m_members) ; |
|
71 } |
|
72 |
|
73 /** |
|
74 * Method to set members |
|
75 * |
|
76 */ |
|
77 void SmfGroup::setMembers(QList<SmfContact>* mems) |
|
78 { |
|
79 d->m_members = mems; |
|
80 } |
|
81 /** |
|
82 * Method to get the name of the group |
|
83 * @return The name of the group |
|
84 */ |
|
85 QString SmfGroup::name( ) const |
|
86 { |
|
87 return d->m_groupName; |
|
88 } |
|
89 |
|
90 /** |
|
91 * Method to set name |
|
92 */ |
|
93 void SmfGroup::setName(QString& name) |
|
94 { |
|
95 d->m_groupName = name; |
|
96 } |
|
97 |
|
98 /** |
|
99 * Method to get the id of the group |
|
100 * @return The ID value |
|
101 */ |
|
102 QString SmfGroup::id( ) const |
|
103 { |
|
104 return d->m_groupId; |
|
105 } |
|
106 |
|
107 /** |
|
108 * Method to set id |
|
109 */ |
|
110 void SmfGroup::setId(QString& id) |
|
111 { |
|
112 d->m_groupId = id; |
|
113 |
|
114 } |
|
115 /** |
|
116 * Method for Externalization. Writes the SmfGroup object to |
|
117 * the stream and returns a reference to the stream. |
|
118 * @param aDataStream Stream to be written |
|
119 * @param aGroup The SmfGroup object to be externalized |
|
120 * @return reference to the written stream |
|
121 */ |
|
122 //TODO:- implement |
|
123 QDataStream &operator<<( QDataStream &aDataStream, |
|
124 const SmfGroup &aGroup ) |
|
125 { |
|
126 //aDataStream<<aGroup.members(); |
|
127 aDataStream<<aGroup.name(); |
|
128 aDataStream<<aGroup.id(); |
|
129 return aDataStream; |
|
130 } |
|
131 |
|
132 /** |
|
133 * Method for Internalization. Reads a SmfGroup object from |
|
134 * the stream and returns a reference to the stream. |
|
135 * @param aDataStream Stream to be read |
|
136 * @param aGroup The SmfGroup object to be internalized |
|
137 * @return reference to the stream |
|
138 */ |
|
139 //TODO:- implement |
|
140 QDataStream &operator>>( QDataStream &aDataStream, |
|
141 SmfGroup &aGroup) |
|
142 { |
|
143 |
|
144 //aDataStream>>aGroup.d->m_members; |
|
145 QString grpname; |
|
146 aDataStream>>grpname; |
|
147 aGroup.d->m_groupName = grpname; |
|
148 QString grpId; |
|
149 aDataStream>>grpId; |
|
150 aGroup.d->m_groupId = grpId; |
|
151 return aDataStream; |
|
152 } |
|