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