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