|
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 #include "ncd_cp_queryresponseimpl.h" |
|
20 #include "ncdprotocolutils.h" |
|
21 #include "ncdstring.h" |
|
22 |
|
23 |
|
24 CNcdConfigurationProtocolQueryResponseValueImpl* |
|
25 CNcdConfigurationProtocolQueryResponseValueImpl::NewL() |
|
26 { |
|
27 CNcdConfigurationProtocolQueryResponseValueImpl* self = |
|
28 new (ELeave) CNcdConfigurationProtocolQueryResponseValueImpl; |
|
29 CleanupStack::PushL( self ); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop( self ); |
|
32 return self; |
|
33 } |
|
34 |
|
35 CNcdConfigurationProtocolQueryResponseValueImpl* |
|
36 CNcdConfigurationProtocolQueryResponseValueImpl::NewLC() |
|
37 { |
|
38 CNcdConfigurationProtocolQueryResponseValueImpl* self = |
|
39 new (ELeave) CNcdConfigurationProtocolQueryResponseValueImpl; |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 void CNcdConfigurationProtocolQueryResponseValueImpl::ConstructL() |
|
46 { |
|
47 NcdProtocolUtils::AssignEmptyDesL( iId ); |
|
48 } |
|
49 |
|
50 CNcdConfigurationProtocolQueryResponseValueImpl::~CNcdConfigurationProtocolQueryResponseValueImpl() |
|
51 { |
|
52 delete iId; |
|
53 iValues.ResetAndDestroy(); |
|
54 } |
|
55 |
|
56 CNcdConfigurationProtocolQueryResponseValueImpl::CNcdConfigurationProtocolQueryResponseValueImpl() |
|
57 : CBase() |
|
58 { |
|
59 } |
|
60 |
|
61 const TDesC& |
|
62 CNcdConfigurationProtocolQueryResponseValueImpl::Id() const |
|
63 { |
|
64 return *iId; |
|
65 } |
|
66 |
|
67 MNcdQuery::TSemantics CNcdConfigurationProtocolQueryResponseValueImpl::Semantics() const |
|
68 { |
|
69 return iSemantics; |
|
70 } |
|
71 |
|
72 TInt CNcdConfigurationProtocolQueryResponseValueImpl::ValueCount() const |
|
73 { |
|
74 return iValues.Count(); |
|
75 } |
|
76 |
|
77 TDesC& CNcdConfigurationProtocolQueryResponseValueImpl::ValueL(TInt aIndex) const |
|
78 { |
|
79 if ( aIndex < 0 || aIndex >= iValues.Count() ) |
|
80 { |
|
81 User::Leave( KErrArgument ); |
|
82 } |
|
83 return *iValues[aIndex]; |
|
84 } |
|
85 |
|
86 |
|
87 // ----------------------------------------- |
|
88 |
|
89 |
|
90 CNcdConfigurationProtocolQueryResponseImpl* |
|
91 CNcdConfigurationProtocolQueryResponseImpl::NewL() |
|
92 { |
|
93 CNcdConfigurationProtocolQueryResponseImpl* self = |
|
94 new (ELeave) CNcdConfigurationProtocolQueryResponseImpl; |
|
95 CleanupStack::PushL( self ); |
|
96 self->ConstructL(); |
|
97 CleanupStack::Pop( self ); |
|
98 return self; |
|
99 } |
|
100 |
|
101 CNcdConfigurationProtocolQueryResponseImpl* |
|
102 CNcdConfigurationProtocolQueryResponseImpl::NewLC() |
|
103 { |
|
104 CNcdConfigurationProtocolQueryResponseImpl* self = |
|
105 new (ELeave) CNcdConfigurationProtocolQueryResponseImpl; |
|
106 CleanupStack::PushL( self ); |
|
107 self->ConstructL(); |
|
108 return self; |
|
109 } |
|
110 |
|
111 CNcdConfigurationProtocolQueryResponseImpl::CNcdConfigurationProtocolQueryResponseImpl() |
|
112 : iCancel( EFalse ) |
|
113 { |
|
114 } |
|
115 |
|
116 void CNcdConfigurationProtocolQueryResponseImpl::ConstructL() |
|
117 { |
|
118 NcdProtocolUtils::AssignEmptyDesL( iId ); |
|
119 } |
|
120 |
|
121 CNcdConfigurationProtocolQueryResponseImpl::~CNcdConfigurationProtocolQueryResponseImpl() |
|
122 { |
|
123 delete iId; |
|
124 iResponses.ResetAndDestroy(); |
|
125 } |
|
126 |
|
127 const TDesC& CNcdConfigurationProtocolQueryResponseImpl::Id() const |
|
128 { |
|
129 return *iId; |
|
130 } |
|
131 |
|
132 MNcdQuery::TSemantics CNcdConfigurationProtocolQueryResponseImpl::Semantics() const |
|
133 { |
|
134 return iSemantics; |
|
135 } |
|
136 |
|
137 TBool CNcdConfigurationProtocolQueryResponseImpl::Cancel() const |
|
138 { |
|
139 return iCancel; |
|
140 } |
|
141 |
|
142 TInt CNcdConfigurationProtocolQueryResponseImpl::ResponseCount() const |
|
143 { |
|
144 return iResponses.Count(); |
|
145 } |
|
146 |
|
147 const MNcdConfigurationProtocolQueryResponseValue& |
|
148 CNcdConfigurationProtocolQueryResponseImpl::ResponseL( TInt aIndex ) const |
|
149 { |
|
150 // Panic is really better here. |
|
151 DASSERT( aIndex >= 0 && aIndex < iResponses.Count() ); |
|
152 if ( aIndex < 0 || aIndex >= iResponses.Count() ) |
|
153 { |
|
154 User::Leave( KErrArgument ); |
|
155 } |
|
156 return *iResponses[aIndex]; |
|
157 } |