mds_pub/content_listing_framework_api/inc/MCLFItem.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2002-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 
       
    18 
       
    19 #ifndef MCLFITEM_H
       
    20 #define MCLFITEM_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <CLFContentListing.hrh>
       
    24 #include <CLFContentListing.h>
       
    25 #include <e32std.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MCLFItemExt;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 *  Content Listing Framework item.
       
    34 *  All items that are fetched from server have got an Item ID number.
       
    35 *  Item ID is defined in runtime so do not store Item IDs permanently.
       
    36 *  One item can contain multiple fields. The field consists of a Field ID and
       
    37 *  field data. Type of the field is defined with Field ID: see
       
    38 *  TCLFDefaultFieldId in CLFContentListing.hrh.
       
    39 *  For example, a music file could contain these two fields:
       
    40 *  ECLFFieldIdSongName (data: title of the song) and ECLFFieldIdArtist
       
    41 *  (data: name of the artist).<br><br>
       
    42 *  Usage:
       
    43 *  @code
       
    44 *  // Get file names and sizes of all items
       
    45 *  TInt count( listModel->ItemCount() );
       
    46 *  for( TInt i = 0 ; i < count ; ++i )
       
    47 *      {
       
    48 *      const MCLFItem& myItem = listModel->Item( i );
       
    49 *
       
    50 *      // Get file name of an item (string data)
       
    51 *      TPtrC fileName;
       
    52 *      TInt error( myItem.GetField( ECLFFieldIdFileName, fileName ) );
       
    53 *
       
    54 *      ...
       
    55 *
       
    56 *      // Get file size of an item (integer data)
       
    57 *      TInt32 size( 0 );
       
    58 *      error = myItem.GetField( ECLFFieldIdFileSize, size );
       
    59 *
       
    60 *      ...
       
    61 *
       
    62 *      }
       
    63 *  @endcode
       
    64 *
       
    65 *  @lib ContentListingFramwork.lib
       
    66 *  @since S60 3.1
       
    67 */
       
    68 class MCLFItem
       
    69     {
       
    70     public:  // Destructor
       
    71 
       
    72         /**
       
    73         * Destructor.
       
    74         */
       
    75         virtual ~MCLFItem() {}
       
    76 
       
    77     public: // New functions
       
    78 
       
    79         /**
       
    80         * Get Item ID of the item.
       
    81         * @since S60 3.1
       
    82         * @return Item ID of the item
       
    83         */
       
    84         virtual TCLFItemId ItemId() const = 0;
       
    85 
       
    86         /**
       
    87         * Get data type of the field. Data type can be text, time or integer.
       
    88         * @since S60 3.1
       
    89         * @param aFieldId ID of the field (TCLFDefaultFieldId)
       
    90         * @return Data type of the field.
       
    91         *         ECLFItemDataTypeNull, if the field does not exist in the item.
       
    92         */
       
    93         virtual TCLFItemDataType DataType( TCLFFieldId aFieldId ) const = 0;
       
    94 
       
    95         /**
       
    96         * Get field data that is a string.
       
    97         * @since S60 3.1
       
    98         * @param aFieldId ID of the field (TCLFDefaultFieldId)
       
    99         * @param aData Data of the field
       
   100         * @return System wide error code.
       
   101         *         KErrNone if field exist,
       
   102         *         KErrNotFound if field doesn't exist,
       
   103         *         KErrNotSupported if field type doesn't match
       
   104         */
       
   105         virtual TInt GetField( TCLFFieldId aFieldId, TPtrC& aData ) const = 0;
       
   106 
       
   107         /**
       
   108         * Get field data that is an integer.
       
   109         * @since S60 3.1
       
   110         * @param aFieldId ID of the field (TCLFDefaultFieldId)
       
   111         * @param aData Data of the field
       
   112         * @return System wide error code.
       
   113         *         KErrNone if field exist,
       
   114         *         KErrNotFound if field doesn't exist,
       
   115         *         KErrNotSupported if field type doesn't match
       
   116         */
       
   117         virtual TInt GetField( TCLFFieldId aFieldId, TInt32& aData ) const = 0;
       
   118 
       
   119         /**
       
   120         * Get field data that is a time data.
       
   121         * @since S60 3.1
       
   122         * @param aFieldId ID of the field (TCLFDefaultFieldId)
       
   123         * @param aData Data of the field
       
   124         * @return System wide error code.
       
   125         *         KErrNone if field exist,
       
   126         *         KErrNotFound if field doesn't exist,
       
   127         *         KErrNotSupported if field type doesn't match
       
   128         */
       
   129         virtual TInt GetField( TCLFFieldId aFieldId, TTime& aData ) const = 0;
       
   130 
       
   131     private: // Extension interface
       
   132 
       
   133         /**
       
   134         * This member is internal and not intended for use.
       
   135         */
       
   136         virtual MCLFItemExt* Extension() { return NULL; }
       
   137 
       
   138     };
       
   139 
       
   140 #endif      // MCLFITEM_H
       
   141 
       
   142 // End of File