contentstorage/cautils/inc/cainnerentry.h
changeset 60 f62f87b200ec
child 61 8e5041d13c84
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     1 /*
       
     2  * Copyright (c) 2008 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:  ?Description
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef __CAINNERENTRY_H__
       
    19 #define __CAINNERENTRY_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 #include "caentryattribute.h"
       
    24 
       
    25 /**
       
    26  * Class represents Content Arsenal entry
       
    27  */
       
    28 NONSHARABLE_CLASS( CCaInnerEntry ): public CBase
       
    29     {
       
    30 public:
       
    31     /*
       
    32      * Struct containing icon attributes
       
    33      */
       
    34     struct TIconAttributes
       
    35         {
       
    36         //TODO: maybe it should be C class with RBuf instead of TFileName
       
    37         TInt iId;
       
    38         TInt iBitmapId;
       
    39         TInt iMaskId;
       
    40         TInt iSkinMajorId;
       
    41         TInt iSkinMinorId;
       
    42         TFileName iFileName;
       
    43         };
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Destructor.
       
    49      */
       
    50     virtual ~CCaInnerEntry();
       
    51 
       
    52     /**
       
    53      * Two-phased constructor.
       
    54      * @return The created object.
       
    55      */
       
    56     IMPORT_C static CCaInnerEntry* NewL();
       
    57 
       
    58     /**
       
    59      * Two-phased constructor.
       
    60      * @return The created object.
       
    61      */
       
    62     IMPORT_C static CCaInnerEntry* NewLC();
       
    63 
       
    64     //    GETTERS
       
    65     /**
       
    66      * Gets entry id.
       
    67      * @return Entry id.
       
    68      */
       
    69     IMPORT_C TInt GetId() const;
       
    70 
       
    71     /**
       
    72      * Gets entry text.
       
    73      * @return Entry text.
       
    74      */
       
    75     IMPORT_C const RBuf& GetText() const;
       
    76 
       
    77     /**
       
    78      * Gets entry description.
       
    79      * @return Entry description.
       
    80      */
       
    81     IMPORT_C const RBuf& GetDescription() const;
       
    82     
       
    83     /**
       
    84      * Gets entry typename.
       
    85      * @return Entry typename.
       
    86      */
       
    87     IMPORT_C const RBuf& GetEntryTypeName() const;
       
    88 
       
    89     /**
       
    90      * Gets icon attributes.
       
    91      * @return Icon atrributes.
       
    92      */
       
    93     IMPORT_C const CCaInnerEntry::TIconAttributes& GetIcon() const;
       
    94 
       
    95     /**
       
    96      * Gets entry flags.
       
    97      * @return Entry flags.
       
    98      */
       
    99     IMPORT_C TUint GetFlags() const;
       
   100 
       
   101     /**
       
   102      * Gets entry attributes.
       
   103      * @return Entry attributes table.
       
   104      */
       
   105     IMPORT_C const RCaEntryAttrArray& GetAttributes() const;
       
   106 
       
   107     /**
       
   108      * Gets entry role.
       
   109      * @return Entry role.
       
   110      */
       
   111     IMPORT_C TUint GetRole() const;
       
   112 
       
   113     /**
       
   114      * Gets entry uid.
       
   115      * @return Entry uid.
       
   116      */
       
   117     IMPORT_C TInt32 GetUid() const;
       
   118 
       
   119     /**
       
   120      * Gets icon id.
       
   121      * @return Icon id.
       
   122      */
       
   123     IMPORT_C TInt GetIconId() const;
       
   124 
       
   125     //    SETTERS
       
   126     /**
       
   127      * Sets entry id.
       
   128      * @param aId Entry id.
       
   129      */
       
   130     IMPORT_C void SetId( TUint aId );
       
   131 
       
   132     /**
       
   133      * Sets the entry text.
       
   134      * @param aText Entry text.
       
   135      */
       
   136     IMPORT_C void SetTextL( const TDesC& aText );
       
   137 
       
   138     /**
       
   139      * Sets the entry description.
       
   140      * @param aText Entry description.
       
   141      */
       
   142     IMPORT_C void SetDescriptionL( const TDesC& aText );
       
   143     
       
   144     /**
       
   145      * Sets the entry typename.
       
   146      * @param aTypeName Entry typename.
       
   147      */
       
   148     IMPORT_C void SetEntryTypeNameL( const TDesC& aTypeName );
       
   149 
       
   150     /**
       
   151      * Sets icon data.
       
   152      * @param aBitmapId Bitmap id.
       
   153      * @param aMaskId Mask id.
       
   154      * @param aSkinMajorId Skin major id.
       
   155      * @param aSkinMinorId Skin minor id.
       
   156      * @param aFilename Filename.
       
   157      */
       
   158     IMPORT_C void SetIconDataL( TInt aBitmapId, TInt aMaskId,
       
   159             TInt aSkinMajorId, TInt aSkinMinorId, const TDesC& aFilename );
       
   160 
       
   161     /**
       
   162      * Adds attribute to entry.
       
   163      * @param aKey Attribute key.
       
   164      * @param aValue Attribute value.
       
   165      */
       
   166     IMPORT_C void AddAttributeL( const TDesC& aKey, const TDesC& aValue );
       
   167 
       
   168     /**
       
   169      * Sets flags for the entry
       
   170      * @param aFlags Flags.
       
   171      */
       
   172     IMPORT_C void SetFlags( TUint aFlags );
       
   173 
       
   174     /**
       
   175      * Sets the entry's role.
       
   176      * @param aRole Entry role.
       
   177      */
       
   178     IMPORT_C void SetRole( TUint aRole );
       
   179 
       
   180     /**
       
   181      * Remove attribute with given key.
       
   182      * @param aKey Key of attribute to be removed.
       
   183      */
       
   184     IMPORT_C void RemoveAttributeL( const TDesC& aKey );
       
   185 
       
   186     /**
       
   187      * Verifies if attribute exists, and returns its value for the given key.
       
   188      * @param aKey Attribute key.
       
   189      * @param aAttrVal Attribute value.
       
   190      * @return ETrue if attribute exists.
       
   191      */
       
   192     IMPORT_C TBool FindAttribute( const TDesC& aKey, TDes& aAttrVal );
       
   193     
       
   194     /**
       
   195      * Sets the entry uid.
       
   196      * @param aUid Entry uid.
       
   197      */
       
   198     IMPORT_C void SetUid( TInt32 aUid );
       
   199 
       
   200     /**
       
   201      * Sets the entry icon id (id from storage).
       
   202      * @param aIconId Icon id.
       
   203      */
       
   204     IMPORT_C void SetIconId( TInt aIconId );
       
   205 
       
   206     /**
       
   207      * Externalizes object to the stream
       
   208      * @param aStream a write stream
       
   209      */
       
   210     IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
   211 
       
   212     /**
       
   213      * Internalizes stream to the object
       
   214      * @param aStream a read stream
       
   215      */
       
   216     IMPORT_C void InternalizeL( RReadStream& aStream );
       
   217 
       
   218 private:
       
   219 
       
   220     /**
       
   221      * Second phased constructor.
       
   222      */
       
   223     void ConstructL();
       
   224 
       
   225     /**
       
   226      * Constructor
       
   227      */
       
   228     CCaInnerEntry();
       
   229 
       
   230 private:
       
   231     // data
       
   232 
       
   233     /*
       
   234      * Unique identifier of the entry.
       
   235      */
       
   236     TInt iId;
       
   237 
       
   238     /*
       
   239      * Name.
       
   240      * Own.
       
   241      */
       
   242     RBuf iText;
       
   243 
       
   244     /*
       
   245      * Description.
       
   246      * Own.
       
   247      */
       
   248     RBuf iDescription;
       
   249     
       
   250     /*
       
   251      * Entry type.
       
   252      * Own.
       
   253      */
       
   254     RBuf iEntryTypeName;
       
   255 
       
   256     /*
       
   257      * Own.
       
   258      */
       
   259     TIconAttributes iIcon;
       
   260 
       
   261     /*
       
   262      * Flags.
       
   263      */
       
   264     TUint iFlags;
       
   265 
       
   266     /*
       
   267      * Attributes array. Own
       
   268      */
       
   269     RCaEntryAttrArray iAttributes;
       
   270 
       
   271     /*
       
   272      * Entry role ( group, item )
       
   273      */
       
   274     TUint iRole;
       
   275 
       
   276     /*
       
   277      * Uid
       
   278      */
       
   279     TInt32 iUid;
       
   280 
       
   281     };
       
   282 
       
   283 #endif // __CAINNERENTRY_H__