epoc32/include/mw/favouritesitem.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2004 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:  Declaration of FavouritesItem
    15 *
    16 */
    17 
    18 
    19 #ifndef FAVOURITES_ITEM_H
    20 #define FAVOURITES_ITEM_H
    21 
    22 //  INCLUDES
    23 
    24 #include <e32base.h>
    25 #include <favouriteslimits.h>
    26 #include <favouriteswapap.h>
    27 
    28 // FORWARD DECLARATION
    29 
    30 class CFavouritesItemImpl;
    31 class RWriteStream;
    32 class RReadStream;
    33 
    34 // CLASS DECLARATION
    35 
    36 /**
    37 * CFavouritesItem is the base class for representing one favourites entry (item or folder).
    38 * Instances of this class are used to exchange data between the Favourites
    39 * Engine and clients using it.
    40 */
    41 class CFavouritesItem: public CBase
    42     {
    43 
    44     public:     // Data types
    45 
    46        /**
    47         * Defines the type of an item (item or folder).
    48         */
    49         enum TType  /// Type of an item (item or folder).
    50             {
    51            /*
    52             * Invalid value, can not be set for a CFavouritesItem 
    53             * @see For more informaiton on ENone, see CFavouritesItem.
    54             */
    55             ENone,  
    56            /*
    57             * Favourites item
    58             * @see For more informaiton on ENone, see CFavouritesItem.
    59             */            
    60             EItem,  
    61            /*
    62             * Favourites folder.
    63             * @see For more informaiton on ENone, see CFavouritesItem.
    64             */
    65             EFolder 
    66             };
    67 
    68     public:     // Constructors and destructor
    69         
    70         /**
    71         * Two-phased constructor. Leaves on failure. Places the instance on the
    72         * cleanup stack.
    73         * @since 0.9       
    74         * @return The constructed item.
    75         */
    76         IMPORT_C static CFavouritesItem* NewLC();
    77 
    78         /**
    79         * Two-phased constructor. Leaves on failure.
    80         * @since 0.9       
    81         * @return The constructed item.
    82         */
    83         IMPORT_C static CFavouritesItem* NewL();
    84 
    85         /**
    86         * Destructor.
    87         * @since 0.9       
    88         */
    89         IMPORT_C virtual ~CFavouritesItem();
    90 
    91         /**
    92         * Assignment operator.
    93         * @since 0.9       
    94         * @param aCopyFrom Assign from this.
    95         */
    96         IMPORT_C CFavouritesItem& operator=
    97             ( const CFavouritesItem& aCopyFrom );
    98 
    99     public:     // Query
   100 
   101         /**
   102         * Get unique id of the item.
   103         * @since 0.9       
   104         * @return The unique id.
   105         */
   106         IMPORT_C TInt Uid() const;
   107 
   108         /**
   109         * Get the uid of the parent folder of this item.
   110         * @since 0.9       
   111         * @return The unique id of the parent folder.
   112         */
   113         IMPORT_C TInt ParentFolder() const;
   114 
   115         /**
   116         * Get type of the item (item or folder).
   117         * @since 0.9       
   118         * @return The type of the item. It is either EFolder or EItem
   119         * (never ENone).
   120         */
   121 
   122         IMPORT_C TType Type() const;
   123 
   124         /**
   125         * Get the name of this item.
   126         * @since 0.9       
   127         * @return The name of this item.
   128         */
   129         IMPORT_C const TPtrC Name() const;
   130 
   131         /**
   132         * Get the URL of this item.
   133         * @since 0.9       
   134         * @return The URL of this item.
   135         */
   136         IMPORT_C const TPtrC Url() const;
   137 
   138         /**
   139         * Get WAP Access Point id associated with this item.
   140         * @since 0.9       
   141         * @return The WAP Access Point id.
   142         */
   143         IMPORT_C TFavouritesWapAp WapAp() const;
   144 
   145         /**
   146         * Get the username associated with this item.
   147         * @since 0.9       
   148         * @return The username.
   149         */
   150         IMPORT_C const TPtrC UserName() const;
   151 
   152         /**
   153         * Get password associated with this item.
   154         * @since 0.9       
   155         * @return The password.
   156         */
   157         IMPORT_C const TPtrC Password() const;
   158 
   159         /**
   160         * Get context id associated with this item.
   161         * @since 0.9       
   162         * @return The context id.
   163         */
   164         IMPORT_C TInt32 ContextId() const;
   165 
   166         /**
   167         * Check if this is an item (not folder).
   168         * @since 0.9       
   169         * @return ETrue if this is an item.
   170         */
   171         IMPORT_C TBool IsItem() const;
   172 
   173         /**
   174         * Check if this is a folder.
   175         * @since 0.9       
   176         * @return ETrue if this is a folder.
   177         */
   178         IMPORT_C TBool IsFolder() const;
   179 
   180         /**
   181         * Check if this is a factory item.
   182         * @since 0.9       
   183         * @return ETrue if this is a factory item.
   184         */
   185         IMPORT_C TBool IsFactoryItem() const;
   186 
   187         /**
   188         * Check if this is a read-only in database. Note that ETrue value does
   189         * not prevent modifying this CFavouritesItem object.
   190         * @since 0.9       
   191         * @return ETrue if this is read-only in database.
   192         */
   193         IMPORT_C TBool IsReadOnly() const;
   194 
   195         /**
   196         * Get last modification time (of database entry), universal time.
   197         * This can be zero if:
   198         * - Last modification time is not available in database (old
   199         *   databases); or
   200         * - Engine does not support this feature.
   201         * Note that zero means Modified().Int64() == 0, and not
   202         * Time::NullTTime().
   203         * @since 0.9       
   204         * @return TTime, last modification time                 
   205         */
   206         IMPORT_C TTime Modified() const;
   207 
   208     public:     // update
   209 
   210         /**
   211         * Reset the item to default values.
   212         * @since 0.9       
   213         * @return void                         
   214         */
   215         IMPORT_C void ClearL();
   216 
   217         /**
   218         * Set parent folder.
   219         * @since 0.9       
   220         * @param aId The unique id of the parent folder.
   221         * @return void                                 
   222         */
   223         IMPORT_C void SetParentFolder( TInt aId );
   224 
   225         /**
   226         * Set item type (item or folder).
   227         * @since 0.9               
   228         * @param aType The type to be set. ENone cannot be set (if that is
   229         * specified, it is ignored).
   230         * @return void                                 
   231         */
   232         IMPORT_C void SetType( TType aType );
   233 
   234         /**
   235         * Set name of the item. Leading or trailing whitespace is trimmed.
   236         * Length limit is KFavouritesMaxName (leaves with KErrOverflow).
   237         * @since 0.9               
   238         * @param aName The name to be set.
   239         * @return void                                 
   240         */
   241         IMPORT_C void SetNameL( const TDesC& aName );
   242 
   243         /**
   244         * Set URL of the item.
   245         * @since 0.9                       
   246         * Length limit is KFavouritesMaxURL (leaves with KErrOverflow).
   247         * @param aUrl The URL to be set.
   248         * @return void                                 
   249         */
   250         IMPORT_C void SetUrlL( const TDesC& aUrl );
   251 
   252         /**
   253         * Set WAP Access Point of the item.
   254         * @since 0.9                       
   255         * @param aAccessPoint The WAP Access point to be set.
   256         * @return void                                 
   257         */
   258         IMPORT_C void SetWapAp( const TFavouritesWapAp& aAccessPoint );
   259 
   260         /**
   261         * Set username of the item.
   262         * Length limit is KFavouritesMaxUserName (leaves with KErrOverflow).
   263         * @since 0.9                       
   264         * @param aUserName The username to be set.
   265         * @return void                                 
   266         */
   267         IMPORT_C void SetUserNameL( const TDesC& aUserName );
   268 
   269         /**
   270         * Set password.
   271         * Length limit is KFavouritesMaxPassword (leaves with KErrOverflow).
   272         * @since 0.9                       
   273         * @param aPassword The password to be set.
   274         * @return void                                 
   275         */
   276         IMPORT_C void SetPasswordL( const TDesC& aPassword );
   277 
   278         /**
   279         * Set context id of the item.
   280         * @since 0.9                       
   281         * @param aContextId The context id to be set.
   282         * @return void                                 
   283         */
   284         IMPORT_C void SetContextId( TInt32 aContextId );
   285         
   286         /**
   287         * Check if this is a hidden.
   288         * @since 0.9       
   289         * @return ETrue if this is hidden.
   290         */
   291         IMPORT_C TBool IsHidden() const;        
   292 
   293         /**
   294         * Set hidden value of the item.
   295         * @since 0.9                       
   296         * @param aHidden The hidden value to be set.
   297         * @return void                                 
   298         */
   299         IMPORT_C TBool SetHidden(TBool aHidden) const;        
   300         
   301     public:     // (But not exported:) Streaming
   302 
   303         /**
   304         * Externalize into a stream.
   305         * @since 0.9                       
   306         * @param aStream The stream to externalize to.
   307         * @return void                                 
   308         */
   309         void ExternalizeL( RWriteStream& aStream ) const;
   310 
   311         /**
   312         * Internalize from a stream.
   313         * @since 0.9                       
   314         * @param aStream The stream to externalize from.
   315         * @return void                                 
   316         */
   317         void InternalizeL( RReadStream& aStream );
   318 
   319     private:    // Constructors
   320         
   321         /**
   322         * C++ constructor.
   323         * @since 0.9                       
   324         */
   325         CFavouritesItem();
   326 
   327         /**
   328         * Second-phase constructor.
   329         * @since 0.9                       
   330         */
   331         void ConstructL();
   332 
   333     private:    // Data
   334 
   335         CFavouritesItemImpl* iImpl; ///< Implementation. Owned.
   336 
   337     private:    // friends
   338 
   339         // Setting UID and accessing implementation is granted to this.
   340         friend class RFavouritesDb;
   341 
   342     };
   343 
   344 #endif
   345             
   346 // End of File