|
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_queryimpl.h" |
|
20 #include "ncd_cp_queryelement.h" |
|
21 #include "ncd_cp_queryelementimpl.h" |
|
22 #include "ncdprotocolutils.h" |
|
23 #include "ncdstring.h" |
|
24 |
|
25 CNcdConfigurationProtocolQueryImpl* |
|
26 CNcdConfigurationProtocolQueryImpl::NewL() |
|
27 { |
|
28 CNcdConfigurationProtocolQueryImpl* self = |
|
29 new (ELeave) CNcdConfigurationProtocolQueryImpl; |
|
30 CleanupStack::PushL( self ); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 CNcdConfigurationProtocolQueryImpl* |
|
37 CNcdConfigurationProtocolQueryImpl::NewLC() |
|
38 { |
|
39 CNcdConfigurationProtocolQueryImpl* self = |
|
40 new (ELeave) CNcdConfigurationProtocolQueryImpl; |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL(); |
|
43 return self; |
|
44 } |
|
45 |
|
46 CNcdConfigurationProtocolQueryImpl::CNcdConfigurationProtocolQueryImpl() |
|
47 : iForce( EFalse ), iOptional( EFalse ) |
|
48 { |
|
49 } |
|
50 |
|
51 void CNcdConfigurationProtocolQueryImpl::ConstructL() |
|
52 { |
|
53 NcdProtocolUtils::AssignEmptyDesL( iId ); |
|
54 NcdProtocolUtils::AssignEmptyDesL( iResponseUri ); |
|
55 iBodyText = CNcdString::NewL( KNullDesC, KNullDesC ); |
|
56 iTitle = CNcdString::NewL( KNullDesC, KNullDesC ); |
|
57 // NcdProtocolUtils::AssignEmptyDesL( iBodyText ); |
|
58 // NcdProtocolUtils::AssignEmptyDesL( iTitle ); |
|
59 } |
|
60 |
|
61 CNcdConfigurationProtocolQueryImpl::~CNcdConfigurationProtocolQueryImpl() |
|
62 { |
|
63 delete iId; |
|
64 delete iResponseUri; |
|
65 delete iBodyText; |
|
66 delete iTitle; |
|
67 iQueryElements.ResetAndDestroy(); |
|
68 } |
|
69 |
|
70 const TDesC& CNcdConfigurationProtocolQueryImpl::Id() const |
|
71 { |
|
72 return *iId; |
|
73 } |
|
74 |
|
75 MNcdQuery::TSemantics CNcdConfigurationProtocolQueryImpl::Semantics() const |
|
76 { |
|
77 return iSemantics; |
|
78 } |
|
79 |
|
80 MNcdConfigurationProtocolQuery::TNcdProtocolQueryTrigger |
|
81 CNcdConfigurationProtocolQueryImpl::Trigger() const |
|
82 { |
|
83 return iTrigger; |
|
84 } |
|
85 |
|
86 TBool CNcdConfigurationProtocolQueryImpl::Force() const |
|
87 { |
|
88 return iForce; |
|
89 } |
|
90 |
|
91 const TDesC& CNcdConfigurationProtocolQueryImpl::ResponseUri() const |
|
92 { |
|
93 return *iResponseUri; |
|
94 } |
|
95 |
|
96 TBool CNcdConfigurationProtocolQueryImpl::Optional() const |
|
97 { |
|
98 return iOptional; |
|
99 } |
|
100 |
|
101 const CNcdString& CNcdConfigurationProtocolQueryImpl::Title() const |
|
102 { |
|
103 return *iTitle; |
|
104 } |
|
105 |
|
106 const CNcdString& CNcdConfigurationProtocolQueryImpl::BodyText() const |
|
107 { |
|
108 return *iBodyText; |
|
109 } |
|
110 |
|
111 TInt CNcdConfigurationProtocolQueryImpl::QueryElementCount() const |
|
112 { |
|
113 return iQueryElements.Count(); |
|
114 } |
|
115 |
|
116 const MNcdConfigurationProtocolQueryElement& |
|
117 CNcdConfigurationProtocolQueryImpl::QueryElementL( TInt aIndex ) const |
|
118 { |
|
119 // Panic is really better here. |
|
120 DASSERT( aIndex >= 0 && aIndex < iQueryElements.Count() ); |
|
121 if ( aIndex < 0 || aIndex >= iQueryElements.Count() ) |
|
122 { |
|
123 User::Leave( KErrArgument ); |
|
124 } |
|
125 return *iQueryElements[aIndex]; |
|
126 } |