|
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: MNcdProtocolElementEntity declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "s32strm.h" |
|
20 |
|
21 #include "ncdqueryoptionimpl.h" |
|
22 #include "ncd_cp_queryoption.h" |
|
23 #include "catalogsinterfaceidentifier.h" |
|
24 #include "catalogsutils.h" |
|
25 #include "ncdstring.h" |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 CNcdQueryOption* CNcdQueryOption::NewL( RReadStream& aReadStream ) |
|
30 { |
|
31 CNcdQueryOption* self = CNcdQueryOption::NewLC( aReadStream ); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 CNcdQueryOption* CNcdQueryOption::NewLC( RReadStream& aReadStream ) |
|
37 { |
|
38 CNcdQueryOption* self = new ( ELeave ) CNcdQueryOption(); |
|
39 CleanupStack::PushL( self ); |
|
40 self->InternalizeL( aReadStream ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 CNcdQueryOption* CNcdQueryOption::NewL( |
|
45 const MNcdConfigurationProtocolQueryOption& aOption) |
|
46 { |
|
47 CNcdQueryOption* self = CNcdQueryOption::NewLC( aOption ); |
|
48 CleanupStack::Pop( self ); |
|
49 return self; |
|
50 } |
|
51 |
|
52 CNcdQueryOption* CNcdQueryOption::NewLC( |
|
53 const MNcdConfigurationProtocolQueryOption& aOption) |
|
54 { |
|
55 CNcdQueryOption* self = new ( ELeave ) CNcdQueryOption(); |
|
56 CleanupStack::PushL( self ); |
|
57 self->InternalizeL( aOption ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 CNcdQueryOption* CNcdQueryOption::NewL( const CNcdString& aPaymentMethodName, |
|
62 const TDesC8& aPaymentMethodType ) |
|
63 { |
|
64 CNcdQueryOption* self = |
|
65 CNcdQueryOption::NewLC( aPaymentMethodName, aPaymentMethodType ); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 CNcdQueryOption* CNcdQueryOption::NewLC( const CNcdString& aPaymentMethodName, |
|
71 const TDesC8& aPaymentMethodType ) |
|
72 { |
|
73 CNcdQueryOption* self = new ( ELeave ) CNcdQueryOption(); |
|
74 CleanupStack::PushL( self ); |
|
75 self->ConstructL( aPaymentMethodName, aPaymentMethodType ); |
|
76 return self; |
|
77 } |
|
78 |
|
79 void CNcdQueryOption::InternalizeL( RReadStream& aReadStream ) |
|
80 { |
|
81 delete iValue; |
|
82 iValue = NULL; |
|
83 iValue = HBufC::NewL( aReadStream, KMaxTInt ); |
|
84 delete iName; |
|
85 iName = NULL; |
|
86 iName = CNcdString::NewL( aReadStream ); |
|
87 delete iData; |
|
88 iData = NULL; |
|
89 iData = HBufC8::NewL( aReadStream, KMaxTInt ); |
|
90 } |
|
91 |
|
92 void CNcdQueryOption::InternalizeL( |
|
93 const MNcdConfigurationProtocolQueryOption& aOption ) |
|
94 { |
|
95 delete iValue; |
|
96 iValue = NULL; |
|
97 iValue = aOption.Value().AllocL(); |
|
98 delete iName; |
|
99 iName = NULL; |
|
100 iName = CNcdString::NewL( aOption.Name() ); |
|
101 AssignDesL( iData, KNullDesC8 ); |
|
102 } |
|
103 |
|
104 void CNcdQueryOption::ExternalizeL( RWriteStream& aWriteStream ) |
|
105 { |
|
106 aWriteStream << *iValue; |
|
107 iName->ExternalizeL( aWriteStream ); |
|
108 aWriteStream << *iData; |
|
109 } |
|
110 |
|
111 |
|
112 const TDesC& CNcdQueryOption::Value() const |
|
113 { |
|
114 return *iValue; |
|
115 } |
|
116 |
|
117 const CNcdString& CNcdQueryOption::Name() const |
|
118 { |
|
119 return *iName; |
|
120 } |
|
121 |
|
122 const TDesC8& CNcdQueryOption::Data() const |
|
123 { |
|
124 return *iData; |
|
125 } |
|
126 |
|
127 void CNcdQueryOption::SetDataL( const TDesC8& aData ) |
|
128 { |
|
129 delete iData; |
|
130 iData = NULL; |
|
131 iData = aData.AllocL(); |
|
132 } |
|
133 |
|
134 CNcdQueryOption::~CNcdQueryOption() |
|
135 { |
|
136 delete iValue; |
|
137 delete iName; |
|
138 delete iData; |
|
139 } |
|
140 |
|
141 void CNcdQueryOption::ConstructL( const CNcdString& aPaymentMethodName, |
|
142 const TDesC8& aPaymentMethodType ) |
|
143 { |
|
144 AssignDesL( iValue, KNullDesC ); |
|
145 iName = CNcdString::NewL( aPaymentMethodName ); |
|
146 AssignDesL( iData, aPaymentMethodType ); |
|
147 } |