examples/SysLibs/FileStores/WritePermFS1/WritePermFS1.h

00001 /*
00002 Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description: 
00028 Function and class definitions used in the 
00029 WriteObjectsToPermanentFileStore1 example 
00030 */
00031  
00032 
00033 
00034 #ifndef __WritePermFS1_H
00035 #define __WritePermFS1_H
00036 
00037 #include "CommonStreamStore.h"
00038 #include <s32file.h>
00039 
00040 LOCAL_C void doMakeL(const TDesC& aName);
00041 LOCAL_C void doUseL(const TDesC& aName);
00042 
00043 class CClassA;
00044 LOCAL_C void doShow(const TDesC& aHeading,const CClassA& anA);
00045 
00046 class CClassB;
00047 LOCAL_C void doShow(const TDesC& aHeading,const CClassB& aB);
00048 
00049 class CClassC;
00050 LOCAL_C void doShow(const TDesC& aHeading,const CClassC& aC);
00051 
00052 class CClassP;
00053 LOCAL_C void doShow(const TDesC& aHeading,const CClassP& aP);
00054 
00055 class CClassR;
00056 LOCAL_C void doShow(const TDesC& aHeading,const CClassR& aR);
00057 
00058 class CClassA : public CBase
00059         {
00060 public :
00061         static CClassA* NewL();
00062         static CClassA* NewLC();
00063 public :
00064         ~CClassA();
00065         void     ExternalizeL(RWriteStream& aStream) const;
00066         void     InternalizeL(RReadStream& aStream);
00067 public :
00068         HBufC*   iVarBuf;
00069         TInt     iIntValue;
00070         TUint    iUintValue;
00071         };
00072 
00073 class CClassB : public CBase
00074         {
00075 public :
00076         static CClassB* NewL();
00077         static CClassB* NewLC();
00078 public :
00079         void     ExternalizeL(RWriteStream& aStream) const;
00080         void     InternalizeL(RReadStream& aStream);
00081 public :
00082         TBuf<32> iFixBuf;
00083         TUint    iUintValue;
00084         TInt     iIntValue;
00085         TReal    iRealValue;
00086         };
00087 
00088 class CClassC : public CBase
00089         {
00090 public  :
00091         static CClassC* NewL();
00092         static CClassC* NewLC();
00093 public  :
00094         void     ExternalizeL(RWriteStream& aStream) const;
00095         void     InternalizeL(RReadStream& aStream);
00096 public :
00097         TBuf<32> iFixBuf;
00098         };
00099 
00100 class CClassP : public CBase
00101         {
00102 public  :
00103         static CClassP* NewLC(const TDesC& aData,CStreamStore& aStore);
00104         static CClassP* NewLC(CStreamStore& aStore, TStreamId anId);
00105 public  :
00106         CClassP(CStreamStore& aStore);
00107         CClassP(CStreamStore& aStore,TStreamId anId);
00108 public  :
00109         TStreamId     StoreL();
00110         void          RestoreL();
00111         void          ExternalizeL(RWriteStream& aStream) const;
00112         void          InternalizeL(RReadStream& aStream);
00113 private :
00114         void          Construct(const TDesC& aData);
00115 public :
00116         TBuf<32>      iFixBuf;
00117         CStreamStore& iStore; // Store to/Restore from this store
00118         TStreamId     iId;    // Restore from/replace this stream
00119         };
00120 
00121 
00122 class CClassR : public CBase
00123         {
00124 public  :
00125         static CClassR* NewLC(const TDesC& aData,CStreamStore& aStore);
00126         static CClassR* NewLC(CStreamStore& aStore, TStreamId anId);
00127 public  :
00128         CClassR(CStreamStore& aStore);
00129         CClassR(CStreamStore& aStore,TStreamId anId);
00130 public  :
00131         TStreamId     StoreL();
00132         void          UpdateStoreL();
00133         void          RestoreL();
00134         void          ExternalizeL(RWriteStream& aStream) const;
00135         void          InternalizeL(RReadStream& aStream);
00136         void          ChangeDataL(const TDesC& aData);
00137 private :
00138         void          Construct(const TDesC& aData);
00139 public :
00140         TBuf<32>      iFixBuf;
00141         CStreamStore& iStore; // Store to/Restore from this store
00142         TStreamId     iId;    // Restore from/replace this stream
00143         };
00144 
00145 
00146 class TExampleIndex
00147         {
00148 public :
00149         TStreamId StoreL(CStreamStore& aStore);
00150         void      RestoreL(CStreamStore& aStore, TStreamId anId);
00151         void      ExternalizeL(RWriteStream& aStream) const;
00152         void      InternalizeL(RReadStream& aStream);
00153 public :
00154         TStreamId iPid;
00155         TStreamId iRid;
00156         TStreamId iABCid;
00157         };
00158 
00159 
00160 class CClassABC : public CBase
00161         {
00162 public :
00163         static CClassABC* NewLC(CStreamStore& aStore);
00164         static CClassABC* NewLC(CStreamStore& aStore, TStreamId anId);
00165 public :
00166         CClassABC(CStreamStore& aStore);
00167         CClassABC(CStreamStore& aStore,TStreamId anId);
00168         ~CClassABC();
00169         TStreamId         StoreL();
00170         void              RestoreL();
00171         void              ConstructAL(const TDesC& aData,TInt anInt,TUint aUint);
00172         void              ConstructB(const TDesC& aData,TInt anInt,TUint aUint,TReal aReal);
00173         void              ConstructC(const TDesC& aData);
00174         const CClassA*    PtrA();
00175         const CClassB*    PtrBL();
00176         const CClassC*    PtrC();
00177 private :
00178         void              ConstructL();
00179         void              RestoreBL();
00180 private :
00181         CClassA*          iA;
00182         TSwizzle<CClassB> iB;     // Note use of swizzle here
00183         CClassC*          iC;
00184         CStreamStore&     iStore; // Store to/Restore from this store
00185         TStreamId         iId;    // Restore from/replace this stream
00186         };
00187 
00188 #endif

Generated by  doxygen 1.6.2