Boost.Locale
|
Collation facet. More...
#include <boost/locale/collator.hpp>
Public Types | |
typedef CharType | char_type |
Type of the underlying character. | |
typedef std::basic_string< CharType > | string_type |
Type of string used with this facet. | |
Public Member Functions | |
int | compare (collate_level level, const char_type *b1, const char_type *e1, const char_type *b2, const char_type *e2) const |
int | compare (const char_type *b1, const char_type *e1, const char_type *b2, const char_type *e2) const |
string_type | transform (collate_level level, const char_type *b, const char_type *e) const |
string_type | transform (const char_type *b, const char_type *e) const |
long | hash (collate_level level, const char_type *b, const char_type *e) const |
long | hash (const char_type *b, const char_type *e) const |
int | compare (collate_level level, const string_type &l, const string_type &r) const |
long | hash (collate_level level, const string_type &s) const |
string_type | transform (collate_level level, const string_type &s) const |
Protected Member Functions | |
collator (size_t refs=0) | |
constructor of the collator object | |
virtual int | do_compare (collate_level level, const char_type *b1, const char_type *e1, const char_type *b2, const char_type *e2) const =0 |
virtual string_type | do_transform (collate_level level, const char_type *b, const char_type *e) const =0 |
Actual function that performs transformation. For details see transform member function. Can be overridden. | |
virtual long | do_hash (collate_level level, const char_type *b, const char_type *e) const =0 |
Actual function that calculates hash. For details see hash member function. Can be overridden. | |
Collation facet.
It reimplements standard C++ std::collate with support for collation levels
|
inline |
Compare two strings in range [b1,e1), [b2,e2) according to collation level level. Calls do_compare
Returns -1 if the first of the two strings sorts before the seconds, returns 1 if sorts after and 0 if they considered equal.
|
inline |
Compare two strings l and r using collation level level
Returns -1 if the first of the two strings sorts before the seconds, returns 1 if sorts after and 0 if they considered equal.
|
inline |
Default compare function as-in std::collate that does not take collation level into account. Uses identical level
|
protectedpure virtual |
Actual function that performs comparison between the strings. For details see compare member function. Can be overridden.
|
inline |
Calculate a hash of a text in range [b,e). The value can be used for collation sensitive string comparison.
If compare(level,b1,e1,b2,e2) == 0 then hash(level,b1,e1) == hash(level,b2,e2)
Calls do_hash
|
inline |
Calculate a hash that can be used for collation sensitive string comparison of a string s
If compare(level,s1,s2) == 0 then hash(level,s1) == hash(level,s2)
|
inline |
Default hash function as-in std::collate that does not take collation level into account. Uses identical level
|
inline |
Create a binary string that can be compared to other in order to get collation order. The string is created for text in range [b,e). It is useful for collation of multiple strings for text.
The transformation follows these rules:
Calls do_transform
|
inline |
|
inline |
Default transform function as-in std::collate that does not take collation level into account. Uses identical level