|
1 /* |
|
2 * Copyright (c) 2010 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 the License "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 * sifcommon_internal.h. |
|
16 * |
|
17 */ |
|
18 |
|
19 /** |
|
20 @file |
|
21 @released |
|
22 @internal |
|
23 */ |
|
24 |
|
25 #ifndef __SIFCOMMON_INTERNAL_H__ |
|
26 #define __SIFCOMMON_INTERNAL_H__ |
|
27 |
|
28 namespace Usif { |
|
29 |
|
30 const TUint KMaxOpaqueParamsDescriptorSize = 128; |
|
31 const TUint KMaxOpaqueParamsExternalizedSize = 512; |
|
32 |
|
33 class MOpaqueParam |
|
34 { |
|
35 public: |
|
36 enum TType |
|
37 { |
|
38 EString, |
|
39 EStringArray, |
|
40 EInteger, |
|
41 EIntegerArray |
|
42 }; |
|
43 |
|
44 virtual void ExternalizeL(RWriteStream& aStream) const = 0; |
|
45 virtual void InternalizeL(RReadStream& aStream) = 0; |
|
46 virtual const HBufC& Name() const = 0; |
|
47 virtual TType Type() const = 0; |
|
48 virtual TInt ValueSize() const = 0; |
|
49 virtual ~MOpaqueParam() {} |
|
50 }; |
|
51 |
|
52 class CItemBase : public CBase, public MOpaqueParam |
|
53 { |
|
54 public: |
|
55 void ExternalizeL(RWriteStream& aStream) const; |
|
56 void InternalizeL(RReadStream& aStream); |
|
57 const HBufC& Name() const; |
|
58 TType Type() const; |
|
59 TInt ValueSize() const; |
|
60 ~CItemBase(); |
|
61 |
|
62 protected: |
|
63 CItemBase(TType aType); |
|
64 void SetValueSize(TInt aSize); |
|
65 void VerifyExternalizedSizeForParamL(TUint aValueSize) const; |
|
66 void SetNameL(const TDesC& aName); |
|
67 |
|
68 private: |
|
69 HBufC* iName; |
|
70 TType iType; |
|
71 TUint iSize; |
|
72 }; |
|
73 class CStringItem : public CItemBase |
|
74 { |
|
75 public: |
|
76 static CStringItem* NewL(RReadStream& aStream); |
|
77 static CStringItem* NewL(const TDesC& aName, const TDesC& aValue); |
|
78 void ExternalizeL(RWriteStream& aStream) const; |
|
79 void InternalizeL(RReadStream& aStream); |
|
80 const HBufC& Name() const; |
|
81 TType Type() const; |
|
82 TInt ValueSize() const; |
|
83 const TDesC& StringValue() const; |
|
84 ~CStringItem(); |
|
85 |
|
86 private: |
|
87 CStringItem(); |
|
88 void ConstructL(const TDesC& aName, const TDesC& aValue); |
|
89 |
|
90 private: |
|
91 HBufC* iString; |
|
92 }; |
|
93 |
|
94 class CStringArrayItem : public CItemBase |
|
95 { |
|
96 public: |
|
97 static CStringArrayItem* NewL(RReadStream& aStream); |
|
98 static CStringArrayItem* NewL(const TDesC& aName, const RPointerArray<HBufC>& aValueArray); |
|
99 void ExternalizeL(RWriteStream& aStream) const; |
|
100 void InternalizeL(RReadStream& aStream); |
|
101 const HBufC& Name() const; |
|
102 TType Type() const; |
|
103 TInt ValueSize() const; |
|
104 const RPointerArray<HBufC>& StringArrayValue() const; |
|
105 ~CStringArrayItem(); |
|
106 |
|
107 private: |
|
108 void ConstructL(const TDesC& aName, const RPointerArray<HBufC>& aValueArray); |
|
109 CStringArrayItem(); |
|
110 |
|
111 private: |
|
112 RPointerArray<HBufC> iStringArray; |
|
113 }; |
|
114 |
|
115 class CIntegerItem : public CItemBase |
|
116 { |
|
117 public: |
|
118 static CIntegerItem* NewL(RReadStream& aStream); |
|
119 static CIntegerItem* NewL(const TDesC& aName, TInt aValue); |
|
120 void ExternalizeL(RWriteStream& aStream) const; |
|
121 void InternalizeL(RReadStream& aStream); |
|
122 const HBufC& Name() const; |
|
123 TType Type() const; |
|
124 TInt ValueSize() const; |
|
125 TInt IntegerValue() const; |
|
126 ~CIntegerItem(); |
|
127 |
|
128 private: |
|
129 CIntegerItem(TInt aValue); |
|
130 void ConstructL(const TDesC& aName); |
|
131 |
|
132 private: |
|
133 TInt iInteger; |
|
134 }; |
|
135 |
|
136 class CIntegerArrayItem : public CItemBase |
|
137 { |
|
138 public: |
|
139 static CIntegerArrayItem* NewL(RReadStream& aStream); |
|
140 static CIntegerArrayItem* NewL(const TDesC& aName, const RArray<TInt>& aValueArray); |
|
141 void ExternalizeL(RWriteStream& aStream) const; |
|
142 void InternalizeL(RReadStream& aStream); |
|
143 const HBufC& Name() const; |
|
144 TType Type() const; |
|
145 TInt ValueSize() const; |
|
146 const RArray<TInt>& IntegerArrayValue() const; |
|
147 ~CIntegerArrayItem(); |
|
148 |
|
149 private: |
|
150 CIntegerArrayItem(); |
|
151 void ConstructL(const TDesC& aName, const RArray<TInt>& aValueArray); |
|
152 |
|
153 private: |
|
154 RArray<TInt> iIntegerArray; |
|
155 }; |
|
156 |
|
157 |
|
158 } //namespace |
|
159 |
|
160 #endif //__SIFCOMMON_INTERNAL_H__ |