51
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: MXIMPProtocolInfo API object implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "ximpprotocolinfoimp.h"
|
|
19 |
#include "ximpobjecthelpers.h"
|
|
20 |
#include "ximpfeatureinfoimp.h"
|
|
21 |
#include "ximprbufhelpers.h"
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
// ============================ MEMBER FUNCTIONS =============================
|
|
26 |
|
|
27 |
// ---------------------------------------------------------------------------
|
|
28 |
// CXIMPProtocolInfoImp::NewLC()
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
//
|
|
31 |
EXPORT_C CXIMPProtocolInfoImp* CXIMPProtocolInfoImp::NewLC()
|
|
32 |
{
|
|
33 |
CXIMPProtocolInfoImp* self = new( ELeave ) CXIMPProtocolInfoImp;
|
|
34 |
CleanupStack::PushL( self );
|
|
35 |
self->ConstructL();
|
|
36 |
return self;
|
|
37 |
}
|
|
38 |
|
|
39 |
|
|
40 |
// ---------------------------------------------------------------------------
|
|
41 |
// CXIMPProtocolInfoImp::NewLC()
|
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
EXPORT_C CXIMPProtocolInfoImp* CXIMPProtocolInfoImp::NewLC(
|
|
45 |
const TDesC16& aDisplayName,
|
|
46 |
TUid aImplementationUid,
|
|
47 |
const CXIMPFeatureInfoImp& aFeatures )
|
|
48 |
{
|
|
49 |
CXIMPProtocolInfoImp* self = new( ELeave ) CXIMPProtocolInfoImp;
|
|
50 |
CleanupStack::PushL( self );
|
|
51 |
self->ConstructL( aDisplayName, aImplementationUid, aFeatures );
|
|
52 |
return self;
|
|
53 |
}
|
|
54 |
|
|
55 |
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
// CXIMPProtocolInfoImp::~CXIMPProtocolInfoImp()
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
CXIMPProtocolInfoImp::~CXIMPProtocolInfoImp()
|
|
61 |
{
|
|
62 |
iDisplayName.Close();
|
|
63 |
delete iFeatures;
|
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
// CXIMPProtocolInfoImp::CXIMPProtocolInfoImp()
|
|
69 |
// ---------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
CXIMPProtocolInfoImp::CXIMPProtocolInfoImp()
|
|
72 |
{
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CXIMPProtocolInfoImp::ConstructL()
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
void CXIMPProtocolInfoImp::ConstructL( const TDesC16& aDisplayName,
|
|
81 |
TUid aImplementationUid,
|
|
82 |
const CXIMPFeatureInfoImp& aFeatures )
|
|
83 |
{
|
|
84 |
iDisplayName.CreateL( aDisplayName );
|
|
85 |
iImplementationUid = aImplementationUid;
|
|
86 |
iFeatures = TXIMPObjectCloner< CXIMPFeatureInfoImp >::CloneL( aFeatures );
|
|
87 |
}
|
|
88 |
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// CXIMPProtocolInfoImp::ConstructL()
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
void CXIMPProtocolInfoImp::ConstructL()
|
|
95 |
{
|
|
96 |
// Initialize the RBufs to zero size. Later on realloc as needed.
|
|
97 |
iDisplayName.CreateL( 0 );
|
|
98 |
iFeatures = CXIMPFeatureInfoImp::NewL();
|
|
99 |
}
|
|
100 |
|
|
101 |
// ---------------------------------------------------------------------------
|
|
102 |
// CXIMPProtocolInfoImp::NewFromStreamLC()
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPProtocolInfoImp )
|
|
106 |
|
|
107 |
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
// Implement supported interface access.
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPProtocolInfoImp,
|
|
113 |
MXIMPProtocolInfo )
|
|
114 |
XIMPIMP_IF_BASE_GET_INTERFACE_END()
|
|
115 |
|
|
116 |
|
|
117 |
XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPProtocolInfoImp,
|
|
118 |
MXIMPProtocolInfo )
|
|
119 |
XIMPIMP_IF_BASE_GET_INTERFACE_END()
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
// CXIMPProtocolInfoImp::DisplayName()
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
const TDesC16& CXIMPProtocolInfoImp::DisplayName() const
|
|
127 |
{
|
|
128 |
return iDisplayName;
|
|
129 |
}
|
|
130 |
|
|
131 |
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
// CXIMPProtocolInfoImp::ImplementationUid()
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
TUid CXIMPProtocolInfoImp::ImplementationUid() const
|
|
136 |
{
|
|
137 |
return iImplementationUid;
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
// CXIMPProtocolInfoImp::GetProtocolFeaturesLC()
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
MXIMPFeatureInfo* CXIMPProtocolInfoImp::GetProtocolFeaturesLC() const
|
|
145 |
{
|
|
146 |
return TXIMPObjectCloner< CXIMPFeatureInfoImp >::CloneLC( *iFeatures );
|
|
147 |
}
|
|
148 |
|
|
149 |
|
|
150 |
// ---------------------------------------------------------------------------
|
|
151 |
// CXIMPProtocolInfoImp::ExternalizeL()
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
void CXIMPProtocolInfoImp::ExternalizeL( RWriteStream& aStream ) const
|
|
155 |
{
|
|
156 |
XIMPRBuf16Helper::ExternalizeL( iDisplayName, aStream );
|
|
157 |
aStream.WriteInt32L( iImplementationUid.iUid );
|
|
158 |
|
|
159 |
iFeatures->ExternalizeL( aStream );
|
|
160 |
}
|
|
161 |
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// CXIMPProtocolInfoImp::InternalizeL()
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
EXPORT_C void CXIMPProtocolInfoImp::InternalizeL( RReadStream& aStream )
|
|
168 |
{
|
|
169 |
XIMPRBuf16Helper::InternalizeL( iDisplayName, aStream );
|
|
170 |
iImplementationUid.iUid = aStream.ReadInt32L();
|
|
171 |
|
|
172 |
iFeatures->InternalizeL( aStream );
|
|
173 |
}
|
|
174 |
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
// CXIMPProtocolInfoImp::EqualsContent
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
TBool CXIMPProtocolInfoImp::EqualsContent(
|
|
180 |
const CXIMPApiDataObjBase& aOtherInstance ) const
|
|
181 |
{
|
|
182 |
const CXIMPProtocolInfoImp* tmp =
|
|
183 |
TXIMPGetImpClassOrPanic< const CXIMPProtocolInfoImp >::From(
|
|
184 |
aOtherInstance.Base() );
|
|
185 |
|
|
186 |
|
|
187 |
TBool same = ETrue;
|
|
188 |
TBool x;
|
|
189 |
x = 0 == iDisplayName.Compare( tmp->iDisplayName );
|
|
190 |
same &= x;
|
|
191 |
|
|
192 |
x = iImplementationUid == tmp->iImplementationUid;
|
|
193 |
same &= x;
|
|
194 |
|
|
195 |
x = iFeatures->EqualsContent( *( tmp->iFeatures ) );
|
|
196 |
same &= x;
|
|
197 |
|
|
198 |
return same;
|
|
199 |
}
|
|
200 |
|
|
201 |
|
|
202 |
// End of file
|