|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_NCD_QUERY_H |
|
20 #define C_NCD_QUERY_H |
|
21 |
|
22 #include <e32cmn.h> |
|
23 |
|
24 #include "ncdquery.h" |
|
25 #include "ncdqueryitemimpl.h" |
|
26 #include "catalogsbaseimpl.h" |
|
27 #include "catalogsinterfacebase.h" |
|
28 #include "ncdsendable.h" |
|
29 |
|
30 class MNcdQueryItem; |
|
31 class MNcdConfigurationProtocolQuery; |
|
32 class RReadStream; |
|
33 class RWriteStream; |
|
34 class MDesCArray; |
|
35 class MDesC8Array; |
|
36 class MNcdConfigurationProtocolQueryResponse; |
|
37 class CNcdString; |
|
38 class MNcdClientLocalizer; |
|
39 |
|
40 /** |
|
41 * Implementation class for query. |
|
42 * |
|
43 * This class is used on both sides of the client/server border. |
|
44 */ |
|
45 class CNcdQuery : public CCatalogsInterfaceBase, |
|
46 public MNcdQuery, |
|
47 public MNcdSendable |
|
48 { |
|
49 |
|
50 public: |
|
51 |
|
52 // all constructors call InternalAddRef |
|
53 static CNcdQuery* NewL( RReadStream& aReadStream ); |
|
54 |
|
55 static CNcdQuery* NewLC( RReadStream& aReadStream ); |
|
56 |
|
57 static CNcdQuery* NewL( const MNcdConfigurationProtocolQuery& aQuery, |
|
58 TBool aIsSecureConnection = EFalse ); |
|
59 |
|
60 static CNcdQuery* NewLC( const MNcdConfigurationProtocolQuery& aQuery, |
|
61 TBool aIsSecureConnection = EFalse ); |
|
62 |
|
63 // For payment method query |
|
64 static CNcdQuery* NewL( const RPointerArray<CNcdString>& aPaymentMethodNames, |
|
65 const MDesC8Array& aPaymentMethodTypes ); |
|
66 |
|
67 static CNcdQuery* NewLC( const RPointerArray<CNcdString>& aPaymentMethodNames, |
|
68 const MDesC8Array& aPaymentMethodTypes ); |
|
69 |
|
70 void SetClientLocalizer( MNcdClientLocalizer* aLocalizer ); |
|
71 MNcdClientLocalizer* ClientLocalizer() const; |
|
72 |
|
73 |
|
74 void InternalizeL( RReadStream& aReadStream ); |
|
75 |
|
76 void InternalizeL( const MNcdConfigurationProtocolQuery& aQuery ); |
|
77 |
|
78 void ExternalizeL( RWriteStream& aWriteStream ) const; |
|
79 |
|
80 |
|
81 /** |
|
82 * Returns the number of query items in this query. |
|
83 * |
|
84 * @return Query ítem count. |
|
85 */ |
|
86 TInt ItemCount() const; |
|
87 |
|
88 /** |
|
89 * Returns query item by index. |
|
90 * |
|
91 * @return Query item. |
|
92 */ |
|
93 CNcdQueryItem& QueryItemL( TInt aIndex ); |
|
94 |
|
95 const TDesC& Id() const; |
|
96 |
|
97 /** |
|
98 * Checks whether all query items have been set. |
|
99 * |
|
100 * @return ETrue if all items are set. |
|
101 */ |
|
102 TBool AllItemsSet() const; |
|
103 |
|
104 public: // From MNcdQuery |
|
105 |
|
106 /** |
|
107 * @see MNcdQuery |
|
108 */ |
|
109 virtual TBool IsOptional() const; |
|
110 |
|
111 /** |
|
112 * @see MNcdQuery |
|
113 */ |
|
114 virtual MNcdQuery::TSemantics Semantics() const; |
|
115 |
|
116 /** |
|
117 * @see MNcdQuery |
|
118 */ |
|
119 virtual const TDesC& MessageTitle() const; |
|
120 |
|
121 /** |
|
122 * @see MNcdQuery |
|
123 */ |
|
124 virtual const TDesC& MessageBody() const; |
|
125 |
|
126 /** |
|
127 * @see MNcdQuery |
|
128 */ |
|
129 virtual RCatalogsArray< MNcdQueryItem > QueryItemsL(); |
|
130 |
|
131 /** |
|
132 * @see MNcdQuery |
|
133 */ |
|
134 virtual void SetResponseL( TResponse aResponse ); |
|
135 |
|
136 /** |
|
137 * @see MNcdQuery |
|
138 */ |
|
139 virtual TResponse Response(); |
|
140 |
|
141 /** |
|
142 * @see MNcdQuery |
|
143 */ |
|
144 TBool IsSecureConnection() const; |
|
145 |
|
146 protected: |
|
147 |
|
148 virtual ~CNcdQuery(); |
|
149 |
|
150 private: |
|
151 |
|
152 CNcdQuery( TBool aIsSecureConnection ); |
|
153 |
|
154 void ConstructL(); |
|
155 void ConstructL( const RPointerArray<CNcdString>& aPaymentMethodNames, |
|
156 const MDesC8Array& aPaymentMethodTypes ); |
|
157 |
|
158 private: |
|
159 |
|
160 HBufC* iId; |
|
161 TBool iIsOptional; |
|
162 MNcdQuery::TSemantics iSemantics; |
|
163 |
|
164 CNcdString* iTitle; |
|
165 CNcdString* iBody; |
|
166 |
|
167 mutable HBufC* iLocalizedTitle; |
|
168 mutable HBufC* iLocalizedBody; |
|
169 |
|
170 TResponse iResponse; |
|
171 TBool iIsSecureConnection; |
|
172 RCatalogsArray< CNcdQueryItem > iItems; |
|
173 |
|
174 /** |
|
175 * Client localizer, not own. |
|
176 */ |
|
177 MNcdClientLocalizer* iClientLocalizer; |
|
178 |
|
179 |
|
180 }; |
|
181 |
|
182 |
|
183 #endif // C_NCD_QUERY_H |