Home · All Classes · Main Classes · Deprecated
Public Member Functions | Static Public Member Functions

MCollator Class Reference

MCollator is a MLocale dependant class that is used to do locale aware string comparisons. More...

List of all members.

Public Member Functions

 MCollator ()
 MCollator (const MLocale &locale)
 MCollator (const MCollator &other)
virtual ~MCollator ()
bool operator() (const QString &s1, const QString &s2) const
MCollatoroperator= (const MCollator &other)

Static Public Member Functions

static MLocale::Comparison compare (const QString &first, const QString &second)
static MLocale::Comparison compare (MLocale &locale, const QString &first, const QString &second)

Detailed Description

MCollator is a MLocale dependant class that is used to do locale aware string comparisons.

MCollator can be created using MLocale::collator(). It is used as a functor or with the comparison methods.

Example:

  MLocale loc; // default locale
  MCollator comp = loc.collator();

  QStringList stringList;
  stringList << "bb" << "da" << "aa" << "ab";

  qSort(stringList.begin(), stringList.end(), comp); // sorts the list
  

Constructor & Destructor Documentation

MCollator::MCollator (  ) 

Constructor, gets locale data from default locale.

MCollator::MCollator ( const MLocale locale  ) 

Constructor, creates a collator based on given MLocale.

MCollator::MCollator ( const MCollator other  ) 

Copy constructor.

MCollator::~MCollator (  )  [virtual]

Member Function Documentation

MLocale::Comparison MCollator::compare ( const QString first,
const QString second 
) [static]

Compares two strings with the default MLocale.

MLocale::Comparison MCollator::compare ( MLocale locale,
const QString first,
const QString second 
) [static]

Compares two strings using the given locale.

bool MCollator::operator() ( const QString s1,
const QString s2 
) const

operator () works as lessThan comparison.

Returns true if first string is less than the second

MCollator & MCollator::operator= ( const MCollator other  ) 

Copyright © 2010 Nokia Corporation
MeeGo Touch