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