8 #ifndef BOOSTER_LOCALE_COLLATOR_H_INCLUDED
9 #define BOOSTER_LOCALE_COLLATOR_H_INCLUDED
11 #include <booster/config.h>
13 # pragma warning(push)
14 # pragma warning(disable : 4275 4251 4231 4660)
55 template<
typename CharType>
57 public std::collate<CharType>,
120 return do_compare(level,l.data(),l.data()+l.size(),r.data(),r.data()+r.size());
131 return do_hash(level,s.data(),s.data()+s.size());
152 collator(
size_t refs = 0) : std::collate<CharType>(refs)
216 template<
typename CharType,collator_base::level_type default_level = collator_base::
identical>
234 bool operator()(std::basic_string<CharType>
const &left,std::basic_string<CharType>
const &right)
const
236 return std::use_facet<collator<CharType> >(locale_).compare(level_,left,right) < 0;
a base class that includes collation level flags
Definition: collator.h:35
virtual int do_compare(char_type const *b1, char_type const *e1, char_type const *b2, char_type const *e2) const
Definition: collator.h:164
4th collation level: letters, accents, case and punctuation
Definition: collator.h:44
2nd collation level: letters and accents
Definition: collator.h:42
identical collation level: include code-point comparison
Definition: collator.h:45
long hash(level_type level, string_type const &s) const
Definition: collator.h:129
comparator(std::locale const &l=std::locale(), collator_base::level_type level=default_level)
Definition: collator.h:225
CharType char_type
Definition: collator.h:64
int compare(level_type level, char_type const *b1, char_type const *e1, char_type const *b2, char_type const *e2) const
Definition: collator.h:77
string_type transform(level_type level, string_type const &s) const
Definition: collator.h:142
1st collation level: base letters
Definition: collator.h:41
std::basic_string< CharType > string_type
Definition: collator.h:68
Collation facet.
Definition: collator.h:56
3rd collation level: letters, accents and case
Definition: collator.h:43
string_type transform(level_type level, char_type const *b, char_type const *e) const
Definition: collator.h:94
virtual string_type do_transform(char_type const *b, char_type const *e) const
Definition: collator.h:173
This class can be used in STL algorithms and containers for comparison of strings with a level other ...
Definition: collator.h:217
collator(size_t refs=0)
Definition: collator.h:152
bool operator()(std::basic_string< CharType > const &left, std::basic_string< CharType > const &right) const
Definition: collator.h:234
int compare(level_type level, string_type const &l, string_type const &r) const
Definition: collator.h:118
long hash(level_type level, char_type const *b, char_type const *e) const
Definition: collator.h:106
virtual long do_hash(char_type const *b, char_type const *e) const
Definition: collator.h:181
level_type
Definition: collator.h:40