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