examples/SysLibs/Streams/WriteToMany/WriteToMany.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: Function and class definitions used in the 
00028 WriteToMany example  
00029 */
00030 
00031 
00032 
00033 #ifndef __WriteToMany_H
00034 #define __WriteToMany_H
00035 
00036 #include "CommonStreamStore.h"
00037 #include <s32file.h>
00038 
00039 static void doMakeAndStoreL(const TDesC& aName);
00040 static void doRestoreL(const TDesC& aName);
00041 
00042 class CClassA;
00043 static void doShow(const TDesC& aHeading,const CClassA& anA);
00044 
00045 class CClassB;
00046 static void doShow(const TDesC& aHeading,const CClassB& aB);
00047 
00048 class CClassC;
00049 static void doShow(const TDesC& aHeading,const CClassC& aC);
00050 
00051 
00052 class CClassA : public CBase
00053         {
00054 public :
00055         static CClassA* NewL();
00056         static CClassA* NewLC();
00057 public :
00058         ~CClassA();
00059         void     ExternalizeL(RWriteStream& aStream) const;
00060         void     InternalizeL(RReadStream& aStream);
00061 public :
00062         HBufC*   iVarBuf;
00063         TInt     iIntValue;
00064         TUint    iUintValue;
00065         };
00066 
00067 class CClassB : public CBase
00068         {
00069 public :
00070         static CClassB* NewL();
00071         static CClassB* NewLC();
00072 public :
00073         void     ExternalizeL(RWriteStream& aStream) const;
00074         void     InternalizeL(RReadStream& aStream);
00075 public :
00076         TBuf<32> iFixBuf;
00077         TUint    iUintValue;
00078         TInt     iIntValue;
00079         TReal    iRealValue;
00080         };
00081 
00082 class CClassC : public CBase
00083         {
00084 public  :
00085         static CClassC* NewL();
00086         static CClassC* NewLC();
00087 public  :
00088         void     ExternalizeL(RWriteStream& aStream) const;
00089         void     InternalizeL(RReadStream& aStream);
00090 public :
00091         TBuf<32> iFixBuf;
00092         };
00093 
00094 
00095 
00096 class CClassABC : public CBase
00097         {
00098 public :
00099         static CClassABC* NewLC(CStreamStore& aStore);
00100         static CClassABC* NewLC(CStreamStore& aStore, TStreamId anId);
00101 public :
00102         CClassABC(CStreamStore& aStore);
00103         CClassABC(CStreamStore& aStore,TStreamId anId);
00104         ~CClassABC();
00105         TStreamId         StoreL();
00106         void              RestoreL();
00107         void              ConstructAL(const TDesC& aData,TInt anInt,TUint aUint);
00108         void              ConstructB(const TDesC& aData,TInt anInt,TUint aUint,TReal aReal);
00109         void              ConstructC(const TDesC& aData);
00110         const CClassA*    PtrA();
00111         const CClassB*    PtrBL();
00112         const CClassC*    PtrC();
00113 private :
00114         void              ConstructL();
00115         void              RestoreBL();
00116 private :
00117         CClassA*          iA;
00118         TSwizzle<CClassB> iB;     // Note use of swizzle here
00119         CClassC*          iC;
00120         CStreamStore&     iStore; // Store to/Restore from this store
00121         TStreamId         iId;    // Restore from/replace this stream
00122         };
00123 
00124 #endif

Generated by  doxygen 1.6.2