activityfw/activitydatabase/s60/inc/afentry.h
changeset 102 8b8b34fa9751
parent 100 0920c6a9b6c8
child 106 e78d6e055a5b
equal deleted inserted replaced
100:0920c6a9b6c8 102:8b8b34fa9751
     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     ~CAfEntry();
       
    64 
       
    65     TInt Size() const;
       
    66 
       
    67     TInt DataSize() const;
       
    68 
       
    69     void ExternalizeL(RWriteStream &stream) const;
       
    70 
       
    71     void InternalizeL(RReadStream &stream);
       
    72 
       
    73     void ExternalizeDataOnlyL(RWriteStream &stream) const;
       
    74 
       
    75     void InternalizeDataOnlyL(RReadStream &stream);
       
    76 
       
    77     TInt Flags() const;
       
    78 
       
    79     TInt ApplicationId() const;
       
    80 
       
    81     const TDesC& ActivityId() const;
       
    82 
       
    83     const TDesC& ImageSrc() const;
       
    84 
       
    85     void SetImageSrcL(const TDesC& src);
       
    86 
       
    87     const TDesC8& Data(CAfEntry::AccessRights rights) const;
       
    88 
       
    89     void SetDataL(const TDesC8& src, CAfEntry::AccessRights rights);
       
    90 
       
    91     static void ReallocL(RBuf8 &dst,TInt length);
       
    92 
       
    93     static void ReallocL(RBuf &dst,TInt length);
       
    94 
       
    95     static void CopyL(RBuf8 &dst,const TDesC8 &src);
       
    96 
       
    97     static void CopyL(RBuf &dst,const TDesC &src);
       
    98 
       
    99 private:
       
   100     CAfEntry();
       
   101 
       
   102     void ConstructL(TInt flags,
       
   103                     TInt applicationId,
       
   104                     const TDesC &activityId,
       
   105                     const TDesC &imgSrc,
       
   106                     const TDesC8 &privateData,
       
   107                     const TDesC8 &publicData);
       
   108 
       
   109     static void InternalizeL(RBuf8 &dst, RReadStream &src);
       
   110 
       
   111     static void InternalizeL(RBuf &dst, RReadStream &src);
       
   112 
       
   113     static void ExternalizeL(RWriteStream &dst,const TDesC8 & src);
       
   114 
       
   115     static void ExternalizeL(RWriteStream &dst,const TDesC& src);
       
   116 private:
       
   117     TInt mFlags;
       
   118     TInt mAppId;
       
   119     RBuf mActivityId;
       
   120     RBuf mImgSrc;
       
   121     RBuf8 mPrivateData;
       
   122     RBuf8 mPublicData;
       
   123 
       
   124 };
       
   125 
       
   126 RPointerArray<CAfEntry>& operator <<(RPointerArray<CAfEntry>& dst, const TDesC8 &src);
       
   127 
       
   128 RBuf8& operator << (RBuf8 &dst, const RPointerArray<CAfEntry>& src);
       
   129 
       
   130 #endif