|
1 /* |
|
2 * Copyright (c) 2004 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: Base class for WV attribute constructors. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <E32Base.h> |
|
20 #include "CPEngWVAttributeConstructBase.h" |
|
21 |
|
22 |
|
23 |
|
24 //LOCAL constants |
|
25 namespace |
|
26 { |
|
27 //Panic |
|
28 _LIT( KWVAttrConstructBasePanic, "WVAttrConstBase" ); |
|
29 |
|
30 //Panic reasons |
|
31 enum TWVAttrConstructBasePanicReasons |
|
32 { |
|
33 EWVCspNotSupported |
|
34 }; |
|
35 |
|
36 void WVAttrConstructBasePanic( TWVAttrConstructBasePanicReasons aPanicReason ) |
|
37 { |
|
38 User::Panic( KWVAttrConstructBasePanic, aPanicReason ); |
|
39 } |
|
40 } |
|
41 |
|
42 |
|
43 // ============================ MEMBER FUNCTIONS =============================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CPEngWVAttributeConstructBase::CPEngWVAttributeConstructBase |
|
47 // C++ default constructor can NOT contain any code, that |
|
48 // might leave. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CPEngWVAttributeConstructBase::CPEngWVAttributeConstructBase( |
|
52 TPEngWVCspVersion aCurrentCspVer, |
|
53 const TWVCspAttributeNameEntry* aNameTable, |
|
54 TInt aTableCount ) |
|
55 : iCurrentCspVer( aCurrentCspVer ), |
|
56 iCspNameTable( aNameTable ), |
|
57 iCspNameTableCount( aTableCount ) |
|
58 { |
|
59 __ASSERT_ALWAYS( ProtocolNameTableIndex( aCurrentCspVer ) != KErrNotFound, |
|
60 WVAttrConstructBasePanic( EWVCspNotSupported ) ); |
|
61 } |
|
62 |
|
63 |
|
64 |
|
65 // Destructor |
|
66 CPEngWVAttributeConstructBase::~CPEngWVAttributeConstructBase() |
|
67 { |
|
68 } |
|
69 |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CPEngWVAttributeConstructBase::GetProperty() |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 TInt CPEngWVAttributeConstructBase::GetProperty( TUint /*aPropertyName*/, |
|
76 TUint /*aPropertyLevel*/, |
|
77 TInt& /*aProperty*/ ) const |
|
78 { |
|
79 return KErrNotSupported; |
|
80 } |
|
81 |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CPEngWVAttributeConstructBase::GetProperty() |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 TInt CPEngWVAttributeConstructBase::GetProperty( TUint /*aPropertyName*/, |
|
88 TUint /*aPropertyLevel*/, |
|
89 TDes8& /*aProperty*/ ) const |
|
90 { |
|
91 return KErrNotSupported; |
|
92 } |
|
93 |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CPEngWVAttributeConstructBase::GetPropertyPtr() |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 TInt CPEngWVAttributeConstructBase::GetPropertyPtr( TUint /*aPropertyName*/, |
|
100 TUint /*aPropertyLevel*/, |
|
101 TPtrC16& /*aProperty*/ ) const |
|
102 |
|
103 { |
|
104 return KErrNotSupported; |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CPEngWVAttributeConstructBase::TypeExtension() |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 TAny* CPEngWVAttributeConstructBase::TypeExtension( TUint32 /*aType*/ ) |
|
112 { |
|
113 return NULL; |
|
114 } |
|
115 |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CPEngWVAttributeConstructBase::GetCurrentCspName() |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CPEngWVAttributeConstructBase::GetCurrentCspName( TPtrC8& aAttributeName, |
|
122 TPtrC8& aAttributeNameSpace ) const |
|
123 { |
|
124 TInt ix = ProtocolNameTableIndex( iCurrentCspVer ); |
|
125 |
|
126 if ( ix != KErrNotFound ) |
|
127 { |
|
128 const TWVCspAttributeNameEntry& entry = iCspNameTable[ ix ]; |
|
129 aAttributeName.Set( *entry.iName ); |
|
130 aAttributeNameSpace.Set( *entry.iNameSpace ); |
|
131 if ( ( aAttributeName.Length() > 0 ) && |
|
132 ( aAttributeNameSpace.Length() > 0 ) ) |
|
133 { |
|
134 return KErrNone; |
|
135 } |
|
136 |
|
137 return KErrArgument; |
|
138 } |
|
139 |
|
140 return KErrNotSupported; |
|
141 } |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CPEngWVAttributeConstructBase::ProtocolNameTableIndex() |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 TInt CPEngWVAttributeConstructBase::ProtocolNameTableIndex( |
|
151 TPEngWVCspVersion aCspVer ) const |
|
152 { |
|
153 for ( TInt ix = 0; ix < iCspNameTableCount; ix++ ) |
|
154 { |
|
155 const TWVCspAttributeNameEntry& entry = iCspNameTable[ ix ]; |
|
156 if ( entry.iCspVersion == aCspVer ) |
|
157 { |
|
158 return ix; |
|
159 } |
|
160 } |
|
161 |
|
162 return KErrNotFound; |
|
163 } |
|
164 |
|
165 |
|
166 // End of File |