|
1 /* |
|
2 * Copyright (c) 2006-2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ncdquerypincodeitemimpl.h" |
|
20 |
|
21 #include <s32strm.h> |
|
22 |
|
23 #include "ncd_cp_queryelement.h" |
|
24 #include "catalogsinterfaceidentifier.h" |
|
25 #include "catalogsutils.h" |
|
26 |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 CNcdQueryPinCodeItem* CNcdQueryPinCodeItem::NewL( |
|
31 RReadStream& aReadStream, CNcdQuery& aParent ) |
|
32 { |
|
33 CNcdQueryPinCodeItem* self = |
|
34 CNcdQueryPinCodeItem::NewLC( aReadStream, aParent ); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CNcdQueryPinCodeItem* CNcdQueryPinCodeItem::NewLC( |
|
40 RReadStream& aReadStream, CNcdQuery& aParent ) |
|
41 { |
|
42 CNcdQueryPinCodeItem* self = new ( ELeave ) CNcdQueryPinCodeItem( aParent ); |
|
43 // Using PushL because the object does not have any references yet |
|
44 CleanupStack::PushL( self ); |
|
45 |
|
46 self->ConstructL(); |
|
47 self->InternalizeL( aReadStream ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 CNcdQueryPinCodeItem* CNcdQueryPinCodeItem::NewL( |
|
52 const MNcdConfigurationProtocolQueryElement& aQueryElement, |
|
53 CNcdQuery& aParent ) |
|
54 { |
|
55 CNcdQueryPinCodeItem* self = |
|
56 CNcdQueryPinCodeItem::NewLC( aQueryElement, aParent ); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 CNcdQueryPinCodeItem* CNcdQueryPinCodeItem::NewLC( |
|
62 const MNcdConfigurationProtocolQueryElement& aQueryElement, |
|
63 CNcdQuery& aParent ) |
|
64 { |
|
65 CNcdQueryPinCodeItem* self = new ( ELeave ) CNcdQueryPinCodeItem( aParent ); |
|
66 // Using PushL because the object does not have any references yet |
|
67 CleanupStack::PushL( self ); |
|
68 self->ConstructL(); |
|
69 self->InternalizeL( aQueryElement ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 void CNcdQueryPinCodeItem::InternalizeL( RReadStream& aReadStream ) |
|
74 { |
|
75 CNcdQueryItem::InternalizeL( aReadStream ); |
|
76 InternalizeDesL( iPinCode, aReadStream ); |
|
77 } |
|
78 |
|
79 void CNcdQueryPinCodeItem::InternalizeL( |
|
80 const MNcdConfigurationProtocolQueryElement& aQueryElement ) |
|
81 { |
|
82 CNcdQueryItem::InternalizeL( aQueryElement ); |
|
83 AssignDesL( iPinCode, KNullDesC ); |
|
84 } |
|
85 |
|
86 void CNcdQueryPinCodeItem::ExternalizeL( RWriteStream& aWriteStream ) const |
|
87 { |
|
88 CNcdQueryItem::ExternalizeL( aWriteStream ); |
|
89 ExternalizeDesL( *iPinCode, aWriteStream ); |
|
90 } |
|
91 |
|
92 |
|
93 void CNcdQueryPinCodeItem::SetPinCodeL( const TDesC& aPinCode ) |
|
94 { |
|
95 AssignDesL( iPinCode, aPinCode ); |
|
96 iIsSet = ETrue; |
|
97 } |
|
98 |
|
99 |
|
100 TNcdInterfaceId CNcdQueryPinCodeItem::Type() const |
|
101 { |
|
102 return static_cast<TNcdInterfaceId>(MNcdQueryPinCodeItem::KInterfaceUid); |
|
103 } |
|
104 |
|
105 const TDesC& CNcdQueryPinCodeItem::ValueL() |
|
106 { |
|
107 if ( ! iIsSet ) |
|
108 { |
|
109 User::Leave( KErrArgument ); |
|
110 } |
|
111 return *iPinCode; |
|
112 } |
|
113 |
|
114 CNcdQueryPinCodeItem::~CNcdQueryPinCodeItem() |
|
115 { |
|
116 delete iPinCode; |
|
117 } |
|
118 |
|
119 CNcdQueryPinCodeItem::CNcdQueryPinCodeItem( CNcdQuery& aParent ) |
|
120 : CNcdQueryItem( aParent ) |
|
121 { |
|
122 } |
|
123 |
|
124 void CNcdQueryPinCodeItem::ConstructL() |
|
125 { |
|
126 CNcdQueryItem::ConstructL(); |
|
127 // Register the interfaces of this object |
|
128 MNcdQueryPinCodeItem* queryItem( this ); |
|
129 AddInterfaceL( |
|
130 CCatalogsInterfaceIdentifier::NewL( |
|
131 queryItem, this, MNcdQueryPinCodeItem::KInterfaceUid ) ); |
|
132 } |