filemanager/GFLM/inc/CGflmGroupItem.h
branchRCL_3
changeset 38 491b3ed49290
parent 36 95243422089a
child 39 65326cf895ed
equal deleted inserted replaced
36:95243422089a 38:491b3ed49290
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  Group item definitions
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CGFLMGROUPITEM_H
       
    21 #define CGFLMGROUPITEM_H
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "GFLM.hrh"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MGflmItemGroup;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  A base class for all GFLM item classes
       
    35 *
       
    36 *  @lib GFLM.lib
       
    37 *  @since 2.0
       
    38 */
       
    39 class CGflmGroupItem : public CBase
       
    40     {
       
    41 
       
    42     public:
       
    43         // Data types in default priority order
       
    44         enum TGflmItemType
       
    45             {
       
    46             EGlobalActionItem = 0,
       
    47             EDrive,
       
    48             EDirectory,
       
    49             EFile
       
    50             };
       
    51 
       
    52     public:  // Constructors and destructor
       
    53 
       
    54         /**
       
    55         * Destructor.
       
    56         */
       
    57         virtual ~CGflmGroupItem();
       
    58 
       
    59     public: // New functions
       
    60 
       
    61         /**
       
    62         * Returns the type of the item.
       
    63         * @since 2.0
       
    64         * @return Type of the item.
       
    65         */
       
    66         virtual TGflmItemType Type() const = 0;
       
    67 
       
    68         /**
       
    69         * Returns the name of the item.
       
    70         * @since 2.0
       
    71         * @return A pointer descriptor containing the name of the item.
       
    72         */
       
    73         virtual TPtrC Name() const = 0;
       
    74 
       
    75         /**
       
    76         * Returns the date of the item.
       
    77         * @since 2.0
       
    78         * @return A TTime object containing the date of the item.
       
    79         */
       
    80         virtual TTime Date() const = 0;
       
    81 
       
    82         /**
       
    83         * Returns the size.
       
    84         * @since 5.0
       
    85         * @return Size in bytes
       
    86         */
       
    87         virtual TInt64 Size() const = 0;
       
    88 
       
    89         /**
       
    90         * Returns the extension of the item.
       
    91         * @since 5.0
       
    92         * @return A pointer descriptor containing the extension of the item
       
    93         */
       
    94         virtual TPtrC Ext() const = 0;
       
    95 
       
    96         /**
       
    97         * Returns the icon id of the item.
       
    98         * @since 3.1
       
    99         * @param aIconId Reference of icon id. Filled if icon is defined.
       
   100         * @return KErrNotFound if icon id is undefined.
       
   101         *         Otherwise KErrNone.
       
   102         */
       
   103         IMPORT_C TInt GetIconId( TInt& aIconId );
       
   104 
       
   105         /**
       
   106         * Stores the icon id of the item.
       
   107         * @since 3.1
       
   108         * @param aIconId Icon id of the item.
       
   109         */
       
   110         IMPORT_C void SetIconId( const TInt aIconId );
       
   111 
       
   112         /**
       
   113         * Checks if simple name comparison can be used that is
       
   114         * significantly faster compared to normal comparison.
       
   115         * @since 3.2
       
   116         * @return ETrue if simple name comparison can be used, otherwise EFalse
       
   117         */
       
   118         TBool CanUseCompareF() const;
       
   119 
       
   120         /**
       
   121         * Sets the group owning the item
       
   122         * @since 3.2
       
   123         * @param Pointer to the group or NULL
       
   124         */
       
   125         void SetGroup( MGflmItemGroup* aGroup );
       
   126 
       
   127         /**
       
   128         * Gets sort function from method
       
   129         * @since 5.0
       
   130         * @param aSortMethod Given sort method
       
   131         */
       
   132         static TLinearOrder< CGflmGroupItem > GetSortL( TGflmSortMethod aSortMethod );
       
   133 
       
   134         /**
       
   135         * Compares items by name and ignores item type
       
   136         * @since 5.0
       
   137         * @param aFirst Given first item for comparison
       
   138         * @param aSecond Given second item for comparison
       
   139         * @return Comparison result
       
   140         */
       
   141         static TInt CompareByNameWithoutItemType(
       
   142             const CGflmGroupItem& aFirst,
       
   143             const CGflmGroupItem& aSecond );
       
   144 
       
   145         /**
       
   146         * Compares items by name with item type
       
   147         * @since 5.0
       
   148         * @param aFirst Given first item for comparison
       
   149         * @param aSecond Given second item for comparison
       
   150         * @return Comparison result
       
   151         */
       
   152         static TInt CompareByName(
       
   153             const CGflmGroupItem& aFirst,
       
   154             const CGflmGroupItem& aSecond );
       
   155 
       
   156         /**
       
   157         * Compares items by type
       
   158         * @since 5.0
       
   159         * @param aFirst Given first item for comparison
       
   160         * @param aSecond Given second item for comparison
       
   161         * @return Comparison result
       
   162         */
       
   163         static TInt CompareByType(
       
   164             const CGflmGroupItem& aFirst,
       
   165             const CGflmGroupItem& aSecond );
       
   166 
       
   167         /**
       
   168         * Compares items by modified date and time
       
   169         * @since 5.0
       
   170         * @param aFirst Given first item for comparison
       
   171         * @param aSecond Given second item for comparison
       
   172         * @return Comparison result
       
   173         */            
       
   174         static TInt CompareMostRecentFirst(
       
   175             const CGflmGroupItem& aFirst,
       
   176             const CGflmGroupItem& aSecond );
       
   177 
       
   178         /**
       
   179         * Compares items by size
       
   180         * @since 5.0
       
   181         * @param aFirst Given first item for comparison
       
   182         * @param aSecond Given second item for comparison
       
   183         * @return Comparison result
       
   184         */            
       
   185         static TInt CompareLargestFirst(
       
   186             const CGflmGroupItem& aFirst,
       
   187             const CGflmGroupItem& aSecond );
       
   188 
       
   189     protected:  // New functions
       
   190 
       
   191         /**
       
   192         * C++ default constructor.
       
   193         */
       
   194         CGflmGroupItem();
       
   195 
       
   196     private:
       
   197         // Internal status flags
       
   198         enum TStatus
       
   199             {
       
   200             ECanUseCompareF = 0x1,
       
   201             ECannotUseCompareF = 0x2
       
   202             };
       
   203 
       
   204         static TInt CompareByItemType(
       
   205             const CGflmGroupItem& aFirst,
       
   206             const CGflmGroupItem& aSecond );
       
   207 
       
   208     private:    // Data
       
   209         // Icon id of the item.
       
   210         TInt iIconId;
       
   211         // Internal status of the item.
       
   212         mutable TUint iStatus;
       
   213         // Group owning the item. Not owned.
       
   214         MGflmItemGroup* iGroup;
       
   215     };
       
   216 
       
   217 #endif      // CGFLMGROUPITEM_H
       
   218 
       
   219 // End of File