activityfw/storage/s60/inc/afentry.h
changeset 104 9b022b1f357c
equal deleted inserted replaced
103:b99b84bcd2d1 104:9b022b1f357c
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #ifndef AFENTRYDATA_H
       
    18 #define AFENTRYDATA_H
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <s32strm.h>
       
    22 class RDbColWriteStream;
       
    23 class RDbColReadStream;
       
    24 const TInt KAfMask(0x0001);
       
    25 
       
    26 #ifdef AF_ADD_MASK
       
    27 #undef AF_ADD_MASK
       
    28 #endif
       
    29 #define AF_ADD_MASK(n) (KAfMask << n)
       
    30 
       
    31 class CAfEntry: public CBase
       
    32 {
       
    33 public:
       
    34     enum AccessRights {
       
    35     Private =0,
       
    36     Public
       
    37     };
       
    38 
       
    39     enum Flags {
       
    40     Invisible = KAfMask,
       
    41     Persistent = 0x40000000,
       
    42     };
       
    43 
       
    44 public:
       
    45     static CAfEntry* NewL();
       
    46 
       
    47     static CAfEntry* NewLC();
       
    48 
       
    49     static CAfEntry* NewL(TInt flags,
       
    50                           TInt applicationId,
       
    51                           const TDesC &activityId,
       
    52                           const TDesC &imgSrc,
       
    53                           const TDesC8 &privateData,
       
    54                           const TDesC8 &publicData);
       
    55 
       
    56     static CAfEntry* NewLC(TInt flags,
       
    57                            TInt applicationId,
       
    58                            const TDesC &activityId,
       
    59                            const TDesC &imgSrc,
       
    60                            const TDesC8 &privateData,
       
    61                            const TDesC8 &publicData);
       
    62     
       
    63     static CAfEntry* NewLC(const RMessage2& msg,
       
    64                            int offset =0);
       
    65 
       
    66     ~CAfEntry();
       
    67 
       
    68     TInt Size() const;
       
    69 
       
    70     TInt DataSize() const;
       
    71 
       
    72     void ExternalizeL(RWriteStream &stream) const;
       
    73 
       
    74     void InternalizeL(RReadStream &stream);
       
    75 
       
    76     void ExternalizeDataOnlyL(RWriteStream &stream) const;
       
    77 
       
    78     void InternalizeDataOnlyL(RReadStream &stream);
       
    79 
       
    80     TInt Flags() const;
       
    81 
       
    82     TInt ApplicationId() const;
       
    83 
       
    84     const TDesC& ActivityId() const;
       
    85 
       
    86     const TDesC& ImageSrc() const;
       
    87 
       
    88     void SetImageSrcL(const TDesC& src);
       
    89 
       
    90     const TDesC8& Data(CAfEntry::AccessRights rights) const;
       
    91 
       
    92     void SetDataL(const TDesC8& src, CAfEntry::AccessRights rights);
       
    93 
       
    94     static void ReallocL(RBuf8 &dst,TInt length);
       
    95 
       
    96     static void ReallocL(RBuf &dst,TInt length);
       
    97 
       
    98     static void CopyL(RBuf8 &dst,const TDesC8 &src);
       
    99 
       
   100     static void CopyL(RBuf &dst,const TDesC &src);
       
   101 
       
   102 private:
       
   103     CAfEntry();
       
   104 
       
   105     void ConstructL(TInt flags,
       
   106                     TInt applicationId,
       
   107                     const TDesC &activityId,
       
   108                     const TDesC &imgSrc,
       
   109                     const TDesC8 &privateData,
       
   110                     const TDesC8 &publicData);
       
   111 
       
   112     static void InternalizeL(RBuf8 &dst, RReadStream &src);
       
   113 
       
   114     static void InternalizeL(RBuf &dst, RReadStream &src);
       
   115 
       
   116     static void ExternalizeL(RWriteStream &dst,const TDesC8 & src);
       
   117 
       
   118     static void ExternalizeL(RWriteStream &dst,const TDesC& src);
       
   119 private:
       
   120     TInt mFlags;
       
   121     TInt mAppId;
       
   122     RBuf mActivityId;
       
   123     RBuf mImgSrc;
       
   124     RBuf8 mPrivateData;
       
   125     RBuf8 mPublicData;
       
   126 
       
   127 };
       
   128 
       
   129 RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src);
       
   130 
       
   131 RBuf8& operator << (RBuf8 &dst, const RPointerArray<CAfEntry>& src);
       
   132 
       
   133 #endif