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

ML10N::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 ()
MLocale::CollatorStrength strength () const
void setStrength (MLocale::CollatorStrength collatorStrength)
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

ML10N::MCollator::MCollator (  ) 

Constructor, gets locale data from default locale.

ML10N::MCollator::MCollator ( const MLocale locale  ) 

Constructor, creates a collator based on given MLocale.

ML10N::MCollator::MCollator ( const MCollator other  ) 

Copy constructor.

ML10N::MCollator::~MCollator (  )  [virtual]

Member Function Documentation

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

Compares two strings with the default MLocale.

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

Compares two strings using the given locale.

bool ML10N::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 & ML10N::MCollator::operator= ( const MCollator other  ) 
void ML10N::MCollator::setStrength ( MLocale::CollatorStrength  collatorStrength  ) 

sets the strength of an MCollator

See also:
strength()
MLocale::CollatorStrength ML10N::MCollator::strength (  )  const

Copyright © 2010 Nokia Corporation
MeeGo Touch