CppCMS
|
Collation facet. More...
#include <booster/booster/locale/collator.h>
Public Types | |
typedef CharType | char_type |
typedef std::basic_string< CharType > | string_type |
Public Types inherited from booster::locale::collator_base | |
enum | level_type { primary = 0, secondary = 1, tertiary = 2, quaternary = 3, identical = 4 } |
Public Member Functions | |
int | compare (level_type level, char_type const *b1, char_type const *e1, char_type const *b2, char_type const *e2) const |
string_type | transform (level_type level, char_type const *b, char_type const *e) const |
long | hash (level_type level, char_type const *b, char_type const *e) const |
int | compare (level_type level, string_type const &l, string_type const &r) const |
long | hash (level_type level, string_type const &s) const |
string_type | transform (level_type level, string_type const &s) const |
Protected Member Functions | |
collator (size_t refs=0) | |
virtual int | do_compare (char_type const *b1, char_type const *e1, char_type const *b2, char_type const *e2) const |
virtual string_type | do_transform (char_type const *b, char_type const *e) const |
virtual long | do_hash (char_type const *b, char_type const *e) const |
virtual int | do_compare (level_type level, char_type const *b1, char_type const *e1, char_type const *b2, char_type const *e2) const =0 |
virtual string_type | do_transform (level_type level, char_type const *b, char_type const *e) const =0 |
virtual long | do_hash (level_type level, char_type const *b, char_type const *e) const =0 |
Collation facet.
It reimplements standard C++ std::collate, allowing usage of std::locale for direct string comparison
typedef CharType booster::locale::collator< CharType >::char_type |
Type of the underlying character
typedef std::basic_string<CharType> booster::locale::collator< CharType >::string_type |
Type of string used with this facet
|
inlineprotected |
constructor of the collator object
|
inline |
Compare two strings in rage [b1,e1), [b2,e2) according using a 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.
|
inlineprotectedvirtual |
This function is used to override default collation function that does not take in account collation level. Uses primary level
References booster::locale::collator_base::identical.
|
protectedpure virtual |
Actual function that performs comparison between the strings. For details see compare member function. Can be overridden.
|
inlineprotectedvirtual |
This function is used to override default collation function that does not take in account collation level. Uses primary level
References booster::locale::collator_base::identical.
|
protectedpure virtual |
Actual function that calculates hash. For details see hash member function. Can be overridden.
|
inlineprotectedvirtual |
This function is used to override default collation function that does not take in account collation level. Uses primary level
References booster::locale::collator_base::identical.
|
protectedpure virtual |
Actual function that performs transformation. For details see transform 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 |
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 |