1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/coredump/optionconfig.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,190 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Define the Option Configuration interface class COptionConfig.
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedPartner
1.25 + @released
1.26 + @see COptionConfig
1.27 +*/
1.28 +
1.29 +
1.30 +#ifndef OPTION_CONFIG_H
1.31 +#define OPTION_CONFIG_H
1.32 +
1.33 +
1.34 +
1.35 +#include <streamelement.h>
1.36 +
1.37 +/**
1.38 +Maximum number of characters allowed for the descriptors of a COptionConfig object.
1.39 +@see COptionConfig* NewL().
1.40 +*/
1.41 +#define KCDSMaxConfigParamStr 128
1.42 +
1.43 +
1.44 +/**
1.45 +@publishedPartner
1.46 +@released
1.47 +
1.48 +Class that represents a configuration parameter. It is based on CStreamElementBase so
1.49 +it can be streamed between client and server.
1.50 +*/
1.51 +class COptionConfig : public CStreamElementBase
1.52 +{
1.53 +
1.54 +public:
1.55 +
1.56 + /**
1.57 + Type of parameter
1.58 + */
1.59 + enum TOptionType
1.60 + {
1.61 + /** Signed integer */
1.62 + ETInt,
1.63 + /** Unsigned integer */
1.64 + ETUInt,
1.65 + /** String */
1.66 + ETString,
1.67 + /** Filename */
1.68 + ETFileName,
1.69 +
1.70 + /** Unused */
1.71 + ETSingleEntryEnum,
1.72 +
1.73 + /** Set string values allowed. */
1.74 + ETMultiEntryEnum,
1.75 +
1.76 + /** True/False */
1.77 + ETBool
1.78 +
1.79 + };
1.80 +
1.81 + /**
1.82 + Owning component type
1.83 + */
1.84 + enum TParameterSource
1.85 + {
1.86 + /** Core Dump Server is owner of the parameter */
1.87 + ECoreDumpServer,
1.88 +
1.89 + /** Formatter plugin is owner of the parameter */
1.90 + EFormatterPlugin,
1.91 +
1.92 + /** Writer plugin is owner of the parameter */
1.93 + EWriterPlugin
1.94 + };
1.95 +
1.96 + IMPORT_C static COptionConfig* NewL( const TUint32 & aIndex,
1.97 + const TUint32 & aUID,
1.98 + const TParameterSource & aSource,
1.99 + const TOptionType & aType,
1.100 + const TDesC & aPrompt,
1.101 + const TUint32 & aNumOptions,
1.102 + const TDesC & aOptions,
1.103 + const TInt32 & aVal,
1.104 + const TDesC & aStrValue );
1.105 +
1.106 + IMPORT_C static COptionConfig* NewL( const TDesC8 & aStreamData );
1.107 +
1.108 + IMPORT_C ~COptionConfig();
1.109 +
1.110 +public:
1.111 + // Methods specific to COptionConfig
1.112 +
1.113 + IMPORT_C TOptionType Type() const;
1.114 + IMPORT_C TParameterSource Source() const;
1.115 + IMPORT_C TUint32 Index() const;
1.116 + IMPORT_C TUint32 Uid( ) const;
1.117 +
1.118 + IMPORT_C const TDesC & Prompt() const;
1.119 +
1.120 + IMPORT_C TUint32 NumOptions( ) const;
1.121 + IMPORT_C const TDesC & Options() const;
1.122 +
1.123 + IMPORT_C TInt32 Value() const;
1.124 + IMPORT_C TBool ValueAsBool() const;
1.125 + IMPORT_C const TDesC & ValueAsDesc() const;
1.126 +
1.127 + IMPORT_C void Value( const TInt32 aValue );
1.128 + IMPORT_C void ValueL( const TDesC & aValue );
1.129 +
1.130 +public:
1.131 + // Methods required by streaming interface
1.132 +
1.133 + IMPORT_C static TInt MaxSize();
1.134 + IMPORT_C TInt Size() const;
1.135 +
1.136 + // Initializes ’this’ from stream
1.137 + IMPORT_C void InternalizeL( RReadStream & aStream );
1.138 +
1.139 + // Writes ’this’ to the stream
1.140 + IMPORT_C void ExternalizeL( RWriteStream & aStream, CBufFlat* buf );
1.141 +
1.142 +
1.143 +private:
1.144 +
1.145 + COptionConfig( const TOptionType & aType,
1.146 + const TParameterSource & aSource,
1.147 + const TUint32 & aIndex,
1.148 + const TUint32 & aUID,
1.149 + const TUint32 & aNumOptions,
1.150 + const TInt32 & aValue );
1.151 +
1.152 + void ConstructStringL( const TDesC & aSource, HBufC ** aDest );
1.153 +
1.154 + COptionConfig();
1.155 +
1.156 + void ConstructL( const TDesC & aPrompt,
1.157 + const TDesC & aOptions,
1.158 + const TDesC & aStrValue );
1.159 +
1.160 +private:
1.161 +
1.162 + // Since this is passed accross the Client Server interface, we should keep the type native.
1.163 + TOptionType iType;
1.164 +
1.165 + TParameterSource iSource;
1.166 +
1.167 + // This index is not globally unique. It is valid within a group of parameters only.
1.168 + // For example the params from the formatter are say 0 to 3, then for the writer they are 0 to 2.
1.169 + TUint32 iIndex;
1.170 +
1.171 + TUint32 iUID;
1.172 +
1.173 + HBufC * iPrompt;
1.174 +
1.175 + TUint32 iNumOptions;
1.176 +
1.177 + HBufC * iOptions;
1.178 +
1.179 + TInt32 iValue;
1.180 +
1.181 + HBufC * iStrValue;
1.182 +
1.183 + /**
1.184 + Externalized size
1.185 + */
1.186 + TUint iSize;
1.187 +
1.188 + TUint32 iSpare1;
1.189 + TUint32 iSpare2;
1.190 + };
1.191 +
1.192 +
1.193 +#endif // OPTION_CONFIG_H