epoc32/include/tools/coredump/optionconfig.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 
    93 	IMPORT_C static COptionConfig* NewL( const TUint32	       & aIndex, 
    94 										const TUint32	       & aUID, 
    95 										const TParameterSource & aSource, 
    96 										const TOptionType	   & aType, 
    97 										const TDesC            & aPrompt, 
    98 										const TUint32	       & aNumOptions,
    99 										const TDesC            & aOptions,
   100 										const TInt32	       & aVal, 
   101 										const TDesC            & aStrValue );
   102 
   103 	IMPORT_C static COptionConfig* NewL( const TDesC8 & aStreamData );
   104 
   105 	IMPORT_C ~COptionConfig();
   106 
   107 public:
   108 	// Methods specific to COptionConfig
   109 	
   110 	IMPORT_C TOptionType Type() const;
   111 	IMPORT_C TParameterSource Source() const;
   112 	IMPORT_C TUint32 Index() const;
   113 	IMPORT_C TUint32 Uid( ) const;
   114 
   115 	IMPORT_C const TDesC & Prompt() const;
   116 
   117 	IMPORT_C TUint32 NumOptions( ) const;
   118 	IMPORT_C const TDesC & Options() const;
   119 
   120 	IMPORT_C TInt32 Value() const;
   121 	IMPORT_C TBool ValueAsBool() const;
   122 	IMPORT_C const TDesC & ValueAsDesc() const;
   123 
   124 	IMPORT_C void Value( const TInt32 aValue );
   125 	IMPORT_C void ValueL( const TDesC & aValue );
   126 
   127 public:
   128 	// Methods required by streaming interface 
   129 
   130 	IMPORT_C static TInt MaxSize();
   131 	IMPORT_C TInt Size() const;
   132 	
   133 	// Initializes ’this’ from stream
   134 	IMPORT_C void InternalizeL( RReadStream & aStream );
   135 
   136 	// Writes ’this’ to the stream
   137 	IMPORT_C void ExternalizeL( RWriteStream & aStream, CBufFlat* buf );
   138 
   139 
   140 private:
   141 
   142 	COptionConfig(  const TOptionType		& aType, 
   143 					const TParameterSource	& aSource, 
   144 					const TUint32			& aIndex, 
   145 					const TUint32			& aUID,
   146 					const TUint32			& aNumOptions,
   147 					const TInt32			& aValue );
   148 
   149 	void ConstructStringL( const TDesC & aSource, HBufC ** aDest );
   150 
   151 	COptionConfig();
   152 
   153 	void ConstructL( const TDesC & aPrompt, 
   154 					const TDesC & aOptions,
   155 					const TDesC & aStrValue );
   156 
   157 private:
   158 
   159 	// Since this is passed accross the Client Server interface, we should keep the type native.
   160 	TOptionType iType;
   161 
   162 	TParameterSource iSource;
   163 
   164 	// This index is not globally unique. It is valid within a group of parameters only. 
   165 	// For example the params from the formatter are say 0 to 3, then for the writer they are 0 to 2.
   166 	TUint32 iIndex;
   167 
   168 	TUint32 iUID;
   169 
   170 	HBufC * iPrompt;
   171 
   172 	TUint32 iNumOptions;
   173 
   174 	HBufC * iOptions;
   175 
   176 	TInt32  iValue;
   177 
   178 	HBufC * iStrValue;
   179 
   180 	/** 
   181 	Externalized size
   182 	*/
   183 	TUint	iSize;
   184 
   185 	TUint32 iSpare1;
   186 	TUint32 iSpare2;
   187 	};
   188 
   189 
   190 #endif // OPTION_CONFIG_H