Nokia N97 SDK
Example Applications Guide

CCECustomSorter Class Reference

#include <CCECustomSorter.h>

Inheritance diagram for CCECustomSorter:

List of all members.

Detailed Description

CLF Custom Sorter. Example of Custom Sorter that can be used to sort files in the list model. With Custom Sorters you can create sorting functionality that is not supported in Content Listing Framework by default. This Custom Sorter will randomize the list model.

Definition at line 37 of file CCECustomSorter.h.


Public Member Functions

virtual  ~CCECustomSorter ()

Static Public Member Functions

static CCECustomSorter *  NewL ()
static TInt  Compare (const MCLFItem &aFirst, const MCLFItem &aSecond)

Protected Member Functions

void  SortItemsL (RPointerArray< MCLFItem > &aItemArray)

Private Member Functions

  CCECustomSorter ()


Constructor & Destructor Documentation

CCECustomSorter::~CCECustomSorter (   )  [virtual]
 

Destructor.

Definition at line 53 of file CCECustomSorter.cpp.

00054     {
00055     }

CCECustomSorter::CCECustomSorter (   )  [private]
 

C++ default constructor.

Definition at line 37 of file CCECustomSorter.cpp.

00038     {
00039     }


Member Function Documentation

CCECustomSorter * CCECustomSorter::NewL (   )  [static]
 

Creates and returns a new instance of this class.

Returns:
Pointer to the CCECustomSorter object

Definition at line 46 of file CCECustomSorter.cpp.

Referenced by CCEMusicView::SetSortingL().

00047     {
00048     CCECustomSorter* self = new (ELeave) CCECustomSorter;
00049     return self;
00050     }

void CCECustomSorter::SortItemsL (  RPointerArray< MCLFItem > &  aItemArray  )  [protected]
 

From MCLFCustomSorter. Method for sorting Content Listing Framework items. Will get called when sorting operation is executed by calling refresh for the list model.

Since:
Series 60 3.0
Parameters:
aItemArray  item array

Definition at line 62 of file CCECustomSorter.cpp.

References Compare().

00063     {
00064     // TLinearOrder can be used to sort RPointerArrays. TLinearOrder
00065     // defines a position for each item by comparing two items at a time.
00066     // It does the comparison by calling static method
00067     // CCECustomSorter::Compare. In this case, the Compare method
00068     // returns a random value and the array will be randomized. The
00069     // comparison process is started when RPointerArray::Sort method
00070     // is called.
00071     TLinearOrder<MCLFItem> sorter( CCECustomSorter::Compare );
00072     aItemArray.Sort( sorter );
00073     }

TInt CCECustomSorter::Compare (  const MCLFItem &  aFirst,
const MCLFItem &  aSecond
)  [static]
 

Compare two items for ordering the list model. In this case the list model will be randomized.

Parameters:
aFirst  First item to compare
aSecond  Second item to compare
Returns:
Random number

Definition at line 80 of file CCECustomSorter.cpp.

Referenced by SortItemsL().

00082     {
00083     // return a random value
00084     return Math::Random();
00085     }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top