|
1 /* |
|
2 * Copyright (c) 2007, 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: BPAS information holder |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include "bpasinfo.h" |
|
22 #include "bpasheaders.h" |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CBPASInfo::NewL |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CBPASInfo* CBPASInfo::NewL(const TDesC& aIdentity) |
|
32 { |
|
33 CBPASInfo* self = NewLC(aIdentity); |
|
34 CleanupStack::Pop( self ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CBPASInfo::NewLC |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 CBPASInfo* CBPASInfo::NewLC(const TDesC& aIdentity) |
|
43 { |
|
44 CBPASInfo* self = new(ELeave) CBPASInfo(); |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL(aIdentity); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CBPASInfo::CBPASInfo |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CBPASInfo::CBPASInfo( ): |
|
55 iPresenceInfo( NULL ), |
|
56 iServiceInfo( NULL ), |
|
57 iIconInfo( NULL ) |
|
58 { |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CBPASInfo::~CBPASInfo |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CBPASInfo::~CBPASInfo() |
|
66 { |
|
67 if(iPresenceInfo) |
|
68 delete iPresenceInfo; |
|
69 if(iServiceInfo) |
|
70 delete iServiceInfo; |
|
71 if(iIconInfo) |
|
72 delete iIconInfo; |
|
73 if(iIdentity) |
|
74 delete iIdentity; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CBPASInfo::ConstructL |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CBPASInfo::ConstructL(const TDesC& aIdentity ) |
|
82 { |
|
83 iIdentity = aIdentity.AllocL(); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CBPASInfo::PresenceInfo |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C CBPASPresenceInfo* CBPASInfo::PresenceInfo() const |
|
91 { |
|
92 return iPresenceInfo; |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CBPASInfo::ServiceInfo |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C CBPASServiceInfo* CBPASInfo::ServiceInfo() const |
|
100 { |
|
101 return iServiceInfo; |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CBPASInfo::IconInfo |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 EXPORT_C CBPASIconInfo* CBPASInfo::IconInfo() |
|
109 { |
|
110 return iIconInfo; |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CBPASInfo::Identity |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 EXPORT_C const TPtrC CBPASInfo::Identity() const |
|
118 { |
|
119 return iIdentity ? *iIdentity : TPtrC(); |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CBPASInfo::HasPresence |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
|
126 EXPORT_C TBool CBPASInfo::HasPresence() const |
|
127 { |
|
128 if(iPresenceInfo) |
|
129 return ETrue; |
|
130 return EFalse; |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CBPASInfo::SetPresenceInfoL |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CBPASInfo::SetPresenceInfoL( CBPASPresenceInfo* aPresenceInfo ) |
|
138 { |
|
139 if(iPresenceInfo) |
|
140 delete iPresenceInfo; |
|
141 iPresenceInfo = aPresenceInfo; |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // CBPASInfo::SetServiceInfoL |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 void CBPASInfo::SetServiceInfoL( CBPASServiceInfo* aServiceInfo ) |
|
149 { |
|
150 if(iServiceInfo) |
|
151 delete iServiceInfo; |
|
152 iServiceInfo = aServiceInfo; |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CBPASInfo::SetIconInfoL |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 void CBPASInfo::SetIconInfoL( CBPASIconInfo* aIconInfo ) |
|
160 { |
|
161 if(iIconInfo) |
|
162 delete iIconInfo; |
|
163 iIconInfo = aIconInfo; |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CBPASInfo::SetIdentityL |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 void CBPASInfo::SetIdentityL(const TDesC& aIdentity) |
|
171 { |
|
172 if (iIdentity) |
|
173 { |
|
174 delete iIdentity; |
|
175 iIdentity = NULL; |
|
176 } |
|
177 iIdentity = aIdentity.AllocL(); |
|
178 } |