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 00015 // WriteObjectsToPermanentFileStore1 example 00016 // 00017 00018 #ifndef __WritePermFS1_H 00019 #define __WritePermFS1_H 00020 00021 #include "CommonStreamStore.h" 00022 #include <s32file.h> 00023 00024 LOCAL_C void doMakeL(const TDesC& aName); 00025 LOCAL_C void doUseL(const TDesC& aName); 00026 00027 class CClassA; 00028 LOCAL_C void doShow(const TDesC& aHeading,const CClassA& anA); 00029 00030 class CClassB; 00031 LOCAL_C void doShow(const TDesC& aHeading,const CClassB& aB); 00032 00033 class CClassC; 00034 LOCAL_C void doShow(const TDesC& aHeading,const CClassC& aC); 00035 00036 class CClassP; 00037 LOCAL_C void doShow(const TDesC& aHeading,const CClassP& aP); 00038 00039 class CClassR; 00040 LOCAL_C void doShow(const TDesC& aHeading,const CClassR& aR); 00041 00042 class CClassA : public CBase 00043 { 00044 public : 00045 static CClassA* NewL(); 00046 static CClassA* NewLC(); 00047 public : 00048 ~CClassA(); 00049 void ExternalizeL(RWriteStream& aStream) const; 00050 void InternalizeL(RReadStream& aStream); 00051 public : 00052 HBufC* iVarBuf; 00053 TInt iIntValue; 00054 TUint iUintValue; 00055 }; 00056 00057 class CClassB : public CBase 00058 { 00059 public : 00060 static CClassB* NewL(); 00061 static CClassB* NewLC(); 00062 public : 00063 void ExternalizeL(RWriteStream& aStream) const; 00064 void InternalizeL(RReadStream& aStream); 00065 public : 00066 TBuf<32> iFixBuf; 00067 TUint iUintValue; 00068 TInt iIntValue; 00069 TReal iRealValue; 00070 }; 00071 00072 class CClassC : public CBase 00073 { 00074 public : 00075 static CClassC* NewL(); 00076 static CClassC* NewLC(); 00077 public : 00078 void ExternalizeL(RWriteStream& aStream) const; 00079 void InternalizeL(RReadStream& aStream); 00080 public : 00081 TBuf<32> iFixBuf; 00082 }; 00083 00084 class CClassP : public CBase 00085 { 00086 public : 00087 static CClassP* NewLC(const TDesC& aData,CStreamStore& aStore); 00088 static CClassP* NewLC(CStreamStore& aStore, TStreamId anId); 00089 public : 00090 CClassP(CStreamStore& aStore); 00091 CClassP(CStreamStore& aStore,TStreamId anId); 00092 public : 00093 TStreamId StoreL(); 00094 void RestoreL(); 00095 void ExternalizeL(RWriteStream& aStream) const; 00096 void InternalizeL(RReadStream& aStream); 00097 private : 00098 void Construct(const TDesC& aData); 00099 public : 00100 TBuf<32> iFixBuf; 00101 CStreamStore& iStore; // Store to/Restore from this store 00102 TStreamId iId; // Restore from/replace this stream 00103 }; 00104 00105 00106 class CClassR : public CBase 00107 { 00108 public : 00109 static CClassR* NewLC(const TDesC& aData,CStreamStore& aStore); 00110 static CClassR* NewLC(CStreamStore& aStore, TStreamId anId); 00111 public : 00112 CClassR(CStreamStore& aStore); 00113 CClassR(CStreamStore& aStore,TStreamId anId); 00114 public : 00115 TStreamId StoreL(); 00116 void UpdateStoreL(); 00117 void RestoreL(); 00118 void ExternalizeL(RWriteStream& aStream) const; 00119 void InternalizeL(RReadStream& aStream); 00120 void ChangeDataL(const TDesC& aData); 00121 private : 00122 void Construct(const TDesC& aData); 00123 public : 00124 TBuf<32> iFixBuf; 00125 CStreamStore& iStore; // Store to/Restore from this store 00126 TStreamId iId; // Restore from/replace this stream 00127 }; 00128 00129 00130 class TExampleIndex 00131 { 00132 public : 00133 TStreamId StoreL(CStreamStore& aStore); 00134 void RestoreL(CStreamStore& aStore, TStreamId anId); 00135 void ExternalizeL(RWriteStream& aStream) const; 00136 void InternalizeL(RReadStream& aStream); 00137 public : 00138 TStreamId iPid; 00139 TStreamId iRid; 00140 TStreamId iABCid; 00141 }; 00142 00143 00144 class CClassABC : public CBase 00145 { 00146 public : 00147 static CClassABC* NewLC(CStreamStore& aStore); 00148 static CClassABC* NewLC(CStreamStore& aStore, TStreamId anId); 00149 public : 00150 CClassABC(CStreamStore& aStore); 00151 CClassABC(CStreamStore& aStore,TStreamId anId); 00152 ~CClassABC(); 00153 TStreamId StoreL(); 00154 void RestoreL(); 00155 void ConstructAL(const TDesC& aData,TInt anInt,TUint aUint); 00156 void ConstructB(const TDesC& aData,TInt anInt,TUint aUint,TReal aReal); 00157 void ConstructC(const TDesC& aData); 00158 const CClassA* PtrA(); 00159 const CClassB* PtrBL(); 00160 const CClassC* PtrC(); 00161 private : 00162 void ConstructL(); 00163 void RestoreBL(); 00164 private : 00165 CClassA* iA; 00166 TSwizzle<CClassB> iB; // Note use of swizzle here 00167 CClassC* iC; 00168 CStreamStore& iStore; // Store to/Restore from this store 00169 TStreamId iId; // Restore from/replace this stream 00170 }; 00171 00172 #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.