0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Define the Option Configuration interface class COptionConfig.
|
|
15 |
//
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file
|
|
21 |
@publishedPartner
|
|
22 |
@released
|
|
23 |
@see COptionConfig
|
|
24 |
*/
|
|
25 |
|
|
26 |
|
|
27 |
#ifndef OPTION_CONFIG_H
|
|
28 |
#define OPTION_CONFIG_H
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
#include <streamelement.h>
|
|
33 |
|
|
34 |
/**
|
|
35 |
Maximum number of characters allowed for the descriptors of a COptionConfig object.
|
|
36 |
@see COptionConfig* NewL().
|
|
37 |
*/
|
|
38 |
#define KCDSMaxConfigParamStr 128
|
|
39 |
|
|
40 |
|
|
41 |
/**
|
|
42 |
@publishedPartner
|
|
43 |
@released
|
|
44 |
|
|
45 |
Class that represents a configuration parameter. It is based on CStreamElementBase so
|
|
46 |
it can be streamed between client and server.
|
|
47 |
*/
|
|
48 |
class COptionConfig : public CStreamElementBase
|
|
49 |
{
|
|
50 |
|
|
51 |
public:
|
|
52 |
|
|
53 |
/**
|
|
54 |
Type of parameter
|
|
55 |
*/
|
|
56 |
enum TOptionType
|
|
57 |
{
|
|
58 |
/** Signed integer */
|
|
59 |
ETInt,
|
|
60 |
/** Unsigned integer */
|
|
61 |
ETUInt,
|
|
62 |
/** String */
|
|
63 |
ETString,
|
|
64 |
/** Filename */
|
|
65 |
ETFileName,
|
|
66 |
|
|
67 |
/** Unused */
|
|
68 |
ETSingleEntryEnum,
|
|
69 |
|
|
70 |
/** Set string values allowed. */
|
|
71 |
ETMultiEntryEnum,
|
|
72 |
|
|
73 |
/** True/False */
|
|
74 |
ETBool
|
|
75 |
|
|
76 |
};
|
|
77 |
|
|
78 |
/**
|
|
79 |
Owning component type
|
|
80 |
*/
|
|
81 |
enum TParameterSource
|
|
82 |
{
|
|
83 |
/** Core Dump Server is owner of the parameter */
|
|
84 |
ECoreDumpServer,
|
|
85 |
|
|
86 |
/** Formatter plugin is owner of the parameter */
|
|
87 |
EFormatterPlugin,
|
|
88 |
|
|
89 |
/** Writer plugin is owner of the parameter */
|
|
90 |
EWriterPlugin,
|
|
91 |
|
|
92 |
/* SCM config option */
|
|
93 |
ESCMConfig
|
|
94 |
};
|
|
95 |
|
|
96 |
IMPORT_C static COptionConfig* NewL( const TUint32 & aIndex,
|
|
97 |
const TUint32 & aUID,
|
|
98 |
const TParameterSource & aSource,
|
|
99 |
const TOptionType & aType,
|
|
100 |
const TDesC & aPrompt,
|
|
101 |
const TUint32 & aNumOptions,
|
|
102 |
const TDesC & aOptions,
|
|
103 |
const TInt32 & aVal,
|
|
104 |
const TDesC & aStrValue );
|
|
105 |
|
|
106 |
IMPORT_C static COptionConfig* NewL( const TDesC8 & aStreamData );
|
|
107 |
|
|
108 |
IMPORT_C ~COptionConfig();
|
|
109 |
|
|
110 |
public:
|
|
111 |
// Methods specific to COptionConfig
|
|
112 |
|
|
113 |
IMPORT_C TOptionType Type() const;
|
|
114 |
IMPORT_C TParameterSource Source() const;
|
|
115 |
IMPORT_C TUint32 Index() const;
|
|
116 |
IMPORT_C TUint32 Uid( ) const;
|
|
117 |
|
|
118 |
IMPORT_C const TDesC & Prompt() const;
|
|
119 |
|
|
120 |
IMPORT_C TUint32 NumOptions( ) const;
|
|
121 |
IMPORT_C const TDesC & Options() const;
|
|
122 |
|
|
123 |
IMPORT_C TInt32 Value() const;
|
|
124 |
IMPORT_C TBool ValueAsBool() const;
|
|
125 |
IMPORT_C const TDesC & ValueAsDesc() const;
|
|
126 |
|
|
127 |
IMPORT_C void Value( const TInt32 aValue );
|
|
128 |
IMPORT_C void ValueL( const TDesC & aValue );
|
|
129 |
|
|
130 |
public:
|
|
131 |
// Methods required by streaming interface
|
|
132 |
|
|
133 |
IMPORT_C static TInt MaxSize();
|
|
134 |
IMPORT_C TInt Size() const;
|
|
135 |
|
|
136 |
// Initializes ’this’ from stream
|
|
137 |
IMPORT_C void InternalizeL( RReadStream & aStream );
|
|
138 |
|
|
139 |
// Writes ’this’ to the stream
|
|
140 |
IMPORT_C void ExternalizeL( RWriteStream & aStream, CBufFlat* buf );
|
|
141 |
|
|
142 |
|
|
143 |
private:
|
|
144 |
|
|
145 |
COptionConfig( const TOptionType & aType,
|
|
146 |
const TParameterSource & aSource,
|
|
147 |
const TUint32 & aIndex,
|
|
148 |
const TUint32 & aUID,
|
|
149 |
const TUint32 & aNumOptions,
|
|
150 |
const TInt32 & aValue );
|
|
151 |
|
|
152 |
void ConstructStringL( const TDesC & aSource, HBufC ** aDest );
|
|
153 |
|
|
154 |
COptionConfig();
|
|
155 |
|
|
156 |
void ConstructL( const TDesC & aPrompt,
|
|
157 |
const TDesC & aOptions,
|
|
158 |
const TDesC & aStrValue );
|
|
159 |
|
|
160 |
public:
|
|
161 |
IMPORT_C TUint32 Instance() const;
|
|
162 |
IMPORT_C void Instance( const TInt32 aInstance );
|
|
163 |
|
|
164 |
TAny* Tag() const { return iTag; }
|
|
165 |
void SetTag(TAny* aTag) { iTag = aTag; }
|
|
166 |
|
|
167 |
private:
|
|
168 |
|
|
169 |
// Since this is passed accross the Client Server interface, we should keep the type native.
|
|
170 |
TOptionType iType;
|
|
171 |
|
|
172 |
TParameterSource iSource;
|
|
173 |
|
|
174 |
// This index is not globally unique. It is valid within a group of parameters only.
|
|
175 |
// For example the params from the formatter are say 0 to 3, then for the writer they are 0 to 2.
|
|
176 |
TUint32 iIndex;
|
|
177 |
|
|
178 |
TUint32 iUID;
|
|
179 |
|
|
180 |
HBufC * iPrompt;
|
|
181 |
|
|
182 |
TUint32 iNumOptions;
|
|
183 |
|
|
184 |
HBufC * iOptions;
|
|
185 |
|
|
186 |
TInt32 iValue;
|
|
187 |
|
|
188 |
HBufC * iStrValue;
|
|
189 |
|
|
190 |
/**
|
|
191 |
Externalized size
|
|
192 |
*/
|
|
193 |
TUint iSize;
|
|
194 |
|
|
195 |
TUint32 iInstance;
|
|
196 |
|
|
197 |
TAny* iTag;
|
|
198 |
TUint32 iSpare2;
|
|
199 |
|
|
200 |
|
|
201 |
};
|
|
202 |
|
|
203 |
typedef RPointerArray<COptionConfig> RConfigParameterList;
|
|
204 |
|
|
205 |
#endif // OPTION_CONFIG_H
|