00001 /* 00002 * ============================================================================ 00003 * Name : AiwGenericParam.h 00004 * Part of : Application Interworking Framework / ServiceHandler 00005 * Interface : SDK, AIW Generic Parameter API 00006 * Description : A generic parameter class. 00007 * Version : 00008 * 00009 * Copyright © 2003-2005 Nokia. All rights reserved. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia. All rights are reserved. Copying, including 00013 * reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia. 00018 * ============================================================================ 00019 */ 00020 00021 #ifndef AIW_GENERIC_PARAM_H 00022 #define AIW_GENERIC_PARAM_H 00023 00024 // INCLUDES 00025 #include <e32base.h> 00026 #include "aiwgenericparam.hrh" 00027 #include "aiwvariant.h" 00028 00036 typedef TInt TGenericParamId; 00037 00038 // CLASS DECLARATION 00039 00054 class TAiwGenericParam 00055 { 00056 public: // Constructors and destructor 00060 inline TAiwGenericParam(); 00061 00067 inline TAiwGenericParam(TGenericParamId aSemanticId); 00068 00075 inline TAiwGenericParam(TGenericParamId aSemanticId, const TAiwVariant& aValue); 00076 00077 public: // Interface 00083 inline void SetSemanticId(TGenericParamId aSemanticId); 00084 00090 inline TGenericParamId SemanticId() const; 00091 00097 inline TAiwVariant& Value(); 00098 00104 inline const TAiwVariant& Value() const; 00105 00109 inline void Reset(); 00110 00111 private: // Interface for friend classes 00112 void Destroy(); 00113 void CopyLC(const TAiwGenericParam& aParam); 00114 static void CleanupDestroy(TAny* aObj); 00115 operator TCleanupItem(); 00116 void InternalizeL(RReadStream& aStream); 00117 void ExternalizeL(RWriteStream& aStream) const; 00118 TInt Size() const; 00119 00120 private: // Data 00122 TGenericParamId iSemanticId; 00124 TAiwVariant iValue; 00126 TAny* iReserved; 00127 00128 private: // friend declarations 00129 friend class CAiwGenericParamList; 00130 }; 00131 00132 00133 // FUNCTIONS 00134 00142 IMPORT_C TBool operator==(const TAiwGenericParam& aLhs, const TAiwGenericParam& aRhs); 00143 00151 inline TBool operator!=(const TAiwGenericParam& aLhs, const TAiwGenericParam& aRhs); 00152 00153 00162 NONSHARABLE_CLASS(CAiwGenericParamList): public CBase 00163 { 00164 public: // Constructors and destructor 00170 IMPORT_C static CAiwGenericParamList* NewL(); 00171 00178 IMPORT_C static CAiwGenericParamList* NewL(RReadStream& aReadStream); 00179 00186 IMPORT_C static CAiwGenericParamList* NewLC(); 00187 00195 IMPORT_C static CAiwGenericParamList* NewLC(RReadStream& aReadStream); 00196 00200 virtual ~CAiwGenericParamList(); 00201 00202 public: // Interface 00208 IMPORT_C TInt Count() const; 00209 00217 IMPORT_C TInt Count(TGenericParamId aSemanticId, 00218 TVariantTypeId aDataType = EVariantTypeAny) const; 00219 00227 IMPORT_C const TAiwGenericParam& operator[](TInt aIndex) const; 00228 00235 IMPORT_C void AppendL(const TAiwGenericParam& aParam); 00236 00243 IMPORT_C void AppendL(const CAiwGenericParamList& aList); 00244 00252 IMPORT_C TBool Remove(TInt aSemanticId); 00253 00257 IMPORT_C void Reset(); 00258 00269 IMPORT_C const TAiwGenericParam* FindFirst( 00270 TInt& aIndex, 00271 TGenericParamId aSemanticId, 00272 TVariantTypeId aDataType = EVariantTypeAny) const; 00283 IMPORT_C const TAiwGenericParam* FindNext( 00284 TInt& aIndex, 00285 TGenericParamId aSemanticId, 00286 TVariantTypeId aDataType = EVariantTypeAny) const; 00287 00295 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; 00296 00302 IMPORT_C TInt Size() const; 00303 00310 IMPORT_C void InternalizeL(RReadStream& aStream); 00311 00321 IMPORT_C HBufC8* PackForServerL(TIpcArgs& aArgs); 00322 00329 IMPORT_C void UnpackFromClientL(const RMessage2& aArgs); 00330 00331 private: // Implementation 00332 CAiwGenericParamList(); 00333 void ConstructL(); 00334 void AppendL(RReadStream& aReadStream); 00335 00336 private: // Data 00338 RArray<TAiwGenericParam> iParameters; 00339 }; 00340 00341 00342 // INLINE FUNCTIONS 00343 #include "aiwgenericparam.inl" 00344 00345 // AIW_GENERIC_PARAM_H 00346 #endif 00347 00348 // End of File