00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). 00002 // All rights reserved. 00003 // This component and the accompanying materials are made available 00004 // under the terms of "Eclipse Public License v1.0" 00005 // which accompanies this distribution, and is available 00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00007 // 00008 // Initial Contributors: 00009 // Nokia Corporation - initial contribution. 00010 // 00011 // Contributors: 00012 // 00013 // Description: 00014 // Function and class definitions used in the example 00015 // 00016 00017 #ifndef __WriteToEmbedded_H 00018 #define __WriteToEmbedded_H 00019 00020 #include "CommonStreamStore.h" 00021 #include <s32file.h> 00022 00023 LOCAL_C void doMakeAndStoreL(const TDesC& aName); 00024 LOCAL_C void doDeleteComponentL(const TDesC& aName); 00025 00026 LOCAL_C void doShow(const TDesC& aComment); 00027 00028 class CClassA; 00029 LOCAL_C void doShow(const TDesC& aHeading,const CClassA& anA); 00030 00031 class CClassB; 00032 LOCAL_C void doShow(const TDesC& aHeading,const CClassB& aB); 00033 00034 class CClassC; 00035 LOCAL_C void doShow(const TDesC& aHeading,const CClassC& aC); 00036 00037 00038 class CClassA : public CBase 00039 { 00040 public : 00041 static CClassA* NewL(); 00042 static CClassA* NewLC(); 00043 public : 00044 ~CClassA(); 00045 void ExternalizeL(RWriteStream& aStream) const; 00046 void InternalizeL(RReadStream& aStream); 00047 public : 00048 HBufC* iVarBuf; 00049 TInt iIntValue; 00050 TUint iUintValue; 00051 }; 00052 00053 class CClassB : public CBase 00054 { 00055 public : 00056 static CClassB* NewL(); 00057 static CClassB* NewLC(); 00058 public : 00059 void ExternalizeL(RWriteStream& aStream) const; 00060 void InternalizeL(RReadStream& aStream); 00061 public : 00062 TBuf<32> iFixBuf; 00063 TUint iUintValue; 00064 TInt iIntValue; 00065 TReal iRealValue; 00066 }; 00067 00068 class CClassC : public CBase 00069 { 00070 public : 00071 static CClassC* NewL(); 00072 static CClassC* NewLC(); 00073 public : 00074 void ExternalizeL(RWriteStream& aStream) const; 00075 void InternalizeL(RReadStream& aStream); 00076 public : 00077 TBuf<32> iFixBuf; 00078 }; 00079 00080 class CClassABC : public CBase 00081 { 00082 public : 00083 static CClassABC* NewLC(CStreamStore& aStore); 00084 static CClassABC* NewL(CStreamStore& aStore); 00085 static CClassABC* NewLC(CStreamStore& aStore, TStreamId anId); 00086 static CClassABC* NewL(CStreamStore& aStore, TStreamId anId); 00087 public : 00088 CClassABC(CStreamStore& aStore); 00089 CClassABC(CStreamStore& aStore,TStreamId anId); 00090 ~CClassABC(); 00091 TStreamId StoreL(); 00092 void RestoreL(); 00093 void ConstructAL(const TDesC& aData,TInt anInt,TUint aUint); 00094 void ConstructB(const TDesC& aData,TInt anInt,TUint aUint,TReal aReal); 00095 void ConstructC(const TDesC& aData); 00096 const CClassA* PtrA(); 00097 const CClassB* PtrBL(); 00098 const CClassC* PtrC(); 00099 private : 00100 void ConstructL(); 00101 void RestoreBL(); 00102 private : 00103 CClassA* iA; 00104 TSwizzle<CClassB> iB; // Note use of swizzle here 00105 CClassC* iC; 00106 CStreamStore& iStore; // Store to/Restore from this store 00107 TStreamId iId; // Restore from/replace this stream 00108 }; 00109 00110 class CMainClass : public CBase 00111 { 00112 public : 00113 static CMainClass* NewLC(CStreamStore& aStore); 00114 static CMainClass* NewLC(CStreamStore& aStore, TStreamId anId); 00115 public : 00116 CMainClass(CStreamStore& aStore); 00117 CMainClass(CStreamStore& aStore,TStreamId anId); 00118 ~CMainClass(); 00119 TStreamId StoreL(); 00120 void RestoreL(); 00121 void InternalizeL(RReadStream& aStream); 00122 void ExternalizeL(RWriteStream& aStream); 00123 CClassABC* PtrAbc(); 00124 void RemoveAbcL(); 00125 private : 00126 void ConstructL(); 00127 private : 00128 TBuf<32> iSomeData; 00129 TStreamId iEmbeddedStoreId; 00130 CEmbeddedStore* iEmbeddedStore; 00131 RStoreReadStream iChildStream; 00132 CClassABC* iAbc; 00133 CStreamStore& iStore; // Store to/Restore from this store 00134 TStreamId iId; // Restore from/replace this stream 00135 00136 }; 00137 #endif
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.