web_plat/feeds_engine_api/inc/FeedsEntity.h
changeset 0 dd21522fd290
child 38 4917f9bf7995
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 the License "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:  The client side connection to the FeedsSever.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __FEEDSENTITY_H
       
    20 #define __FEEDSENTITY_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // MACROS
       
    29 
       
    30 // DATA TYPES
       
    31 
       
    32 // FUNCTION PROTOTYPES
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CFeedsMap;
       
    36 class CPackedFeed;
       
    37 class CPackedFolder;
       
    38 class CPacked;
       
    39 class RFeedsInterface;
       
    40 
       
    41 enum TFeedsEntityType
       
    42     {
       
    43     EFeed,
       
    44     EFolder,
       
    45     EFeedsItem,
       
    46     EFeedsEnclosure,
       
    47     EMiniItem
       
    48     };
       
    49 
       
    50 // DATA TYPES
       
    51 enum TFeedItemStatus
       
    52     {
       
    53     EItemStatusUndefined,
       
    54     EItemStatusNew,
       
    55     EItemStatusUnread,
       
    56     EItemStatusRead
       
    57     };
       
    58 
       
    59 // CLASS DECLARATION
       
    60 class CFeedsEntity : public CBase
       
    61     {
       
    62 
       
    63 public:
       
    64 
       
    65     /**
       
    66      * Two-phased constructor.
       
    67      */
       
    68     static CFeedsEntity* NewL(RFeedsInterface* aFeedsInterface);
       
    69 
       
    70     /**
       
    71      * Two-phased constructor.
       
    72      * Only called from RFolderItem.  aPackedFolder is adopted by this method.
       
    73      */
       
    74     static CFeedsEntity* NewL(CPackedFolder* aPackedFolder,
       
    75     		RFeedsInterface* aFeedsInterface);
       
    76 
       
    77     /**
       
    78      * Two-phased constructor.
       
    79      * Only called from RFolderItem.  aPackedFolder is adopted by this method.
       
    80      */
       
    81     static CFeedsEntity* NewL(CPackedFeed* aPackedFeed,
       
    82     		RFeedsInterface* aFeedsInterface);
       
    83 
       
    84     /**
       
    85      * Two-phased constructor.
       
    86      */
       
    87     static CFeedsEntity* NewFolderL(const TDesC& aTitle, TInt aEntryId, TInt aStatusCode);
       
    88 
       
    89     /**
       
    90      * Two-phased constructor.
       
    91      */
       
    92     static CFeedsEntity* NewFeedL(const TDesC& aTitle, const TDesC& aUrl,
       
    93             TInt aEntryId, TInt aFeedId, const TTime& aTimestamp, TInt aStatusCode, TInt aFreq,
       
    94     		const TInt& aUnreadCount=0);
       
    95     		
       
    96     /**
       
    97      * Two-phased constructor.
       
    98      */
       
    99      CFeedsEntity* CFeedsEntity::NewMiniItemL();
       
   100     		
       
   101 
       
   102     /**
       
   103      * C++ default constructor.  aPackedFolder is adopted by this method. 
       
   104      */
       
   105     CFeedsEntity(CPackedFolder* aPackedFolder);
       
   106 
       
   107     /**
       
   108      * C++ default constructor.  aPackedFolder is adopted by this method. 
       
   109      */
       
   110     CFeedsEntity(CPackedFeed* aPackedFeed);
       
   111 
       
   112     /**
       
   113      * C++ default constructor.
       
   114      */
       
   115     CFeedsEntity();
       
   116 
       
   117     /**
       
   118      * By default Symbian 2nd phase constructor is private.
       
   119      */
       
   120     void ConstructL();
       
   121 
       
   122     /**
       
   123      * By default Symbian 2nd phase constructor is private.
       
   124      */
       
   125     void ConstructL(const CPackedFolder& aPackedFolder);
       
   126 
       
   127     /**
       
   128      * By default Symbian 2nd phase constructor is private.
       
   129      */
       
   130     void ConstructL(const CPackedFeed& aPackedFeed);
       
   131 
       
   132     /**
       
   133      * Destructor
       
   134      */
       
   135     ~CFeedsEntity();
       
   136 
       
   137     /**
       
   138      * Sets string Attribute
       
   139      *
       
   140      *
       
   141      * @param aAttribute Enum representing attribute
       
   142      * @param aAttributeValue - Attribute value
       
   143      * @return void
       
   144      */
       
   145     void SetAttribute(TUint aAttribute, const TPtrC& aAttributeValue);
       
   146 
       
   147     /**
       
   148      * Changes Attributes/Property
       
   149      *
       
   150      *
       
   151      * @param aNewValues Map containing new Values
       
   152      * @return wheather operation was successful or failed (ETrue/EFalse)
       
   153      */
       
   154     IMPORT_C TInt ChangeValueL(const CFeedsMap& aNewValues);
       
   155 
       
   156     /**
       
   157      * Gets string Attribute
       
   158      *
       
   159      *
       
   160      * @param Enum value representing an attribute
       
   161      * @param aValue - returned value of the attribute 
       
   162      * @return KErrNone if successful otherwise KErrNotFound
       
   163      */
       
   164     IMPORT_C TInt GetStringValue(TUint anAttribute, TPtrC& aValue) const;
       
   165 
       
   166     /**
       
   167      * Gets integer Attribute
       
   168      *
       
   169      *
       
   170      * @param Enum value representing an attribute
       
   171      * @param aValue - returned value of the attribute 
       
   172      * @return KErrNone if successful otherwise KErrNotFound
       
   173      */
       
   174     IMPORT_C TInt GetIntegerValue(TUint anAttribute, TInt& aValue) const;
       
   175 
       
   176     /**
       
   177      * Gets time Attribute
       
   178      *
       
   179      *
       
   180      * @param Enum value representing an attribute
       
   181      * @param aValue - returned value of the attribute 
       
   182      * @return KErrNone if successful otherwise KErrNotFound
       
   183      */
       
   184     IMPORT_C TInt GetTimeValue(TUint anAttribute, TTime& aValue) const;
       
   185 
       
   186     /**
       
   187      * Gets type of CFeedsEntity (Where this represents folder/feeds/items/enclosures)
       
   188      *
       
   189      *
       
   190      * @return TFeedsEntityType enum
       
   191      */
       
   192 
       
   193     IMPORT_C TFeedsEntityType GetType() const;
       
   194 
       
   195     /**
       
   196      * Gets ID of feeds entity (This ID is actually unique integer value)
       
   197      *
       
   198      *
       
   199      * @return TInt ID
       
   200      */
       
   201     IMPORT_C TInt GetId() const;
       
   202 
       
   203     /**
       
   204      * Returns Parent of this feeds entity (NULL if it is root folder)
       
   205      *
       
   206      *
       
   207      * @return CFeedsEntity* (parent)
       
   208      */
       
   209     IMPORT_C CFeedsEntity* GetParent() const;
       
   210 
       
   211     /**
       
   212      * Returns RPointerArray containing all children of this CFeedsEntity
       
   213      *
       
   214      *
       
   215      * @return Array containing children.
       
   216      */
       
   217     IMPORT_C const RPointerArray<CFeedsEntity>& GetChildren() const;
       
   218 
       
   219     /**
       
   220      * Initialises FeedsInterface pointer
       
   221      *
       
   222      *
       
   223      * @param aFeedIterface 
       
   224      * @return void
       
   225      */
       
   226     void SetFeedInterface(RFeedsInterface* aFeedInterface)
       
   227     	{
       
   228     	iFeedInterface = aFeedInterface;
       
   229     	}
       
   230 
       
   231     // Friend classes declration.
       
   232     friend class RFeedsInterface;
       
   233     friend class CTransaction;
       
   234 
       
   235 private: // Private data members.
       
   236     TInt iId;
       
   237     TInt iFeedId;
       
   238     TFeedsEntityType iType;
       
   239     CFeedsEntity* iParent;
       
   240     RPointerArray<CFeedsEntity> iChildren;
       
   241     CFeedsMap* iAttrProp;
       
   242     CPacked* iPacked;
       
   243     RFeedsInterface* iFeedInterface;
       
   244     };
       
   245 
       
   246 #endif	//__FEEDSENTITY_H__
       
   247 
       
   248