00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef SORTKEY_H
00023
#define SORTKEY_H
00024
00025
00026
#include "unicode/utypes.h"
00027
#include "unicode/unistr.h"
00028
#include "unicode/coll.h"
00029
00030 U_NAMESPACE_BEGIN
00031
00032
00033
class RuleBasedCollator;
00034
00087 class U_I18N_API CollationKey {
00088
public:
00096 CollationKey();
00097
00098
00106 CollationKey(
const uint8_t* values,
00107 int32_t count);
00108
00113 CollationKey(
const CollationKey& other);
00114
00119 ~CollationKey();
00120
00125
const CollationKey& operator=(
const CollationKey& other);
00126
00133 UBool operator==(
const CollationKey& source)
const;
00134
00141 UBool operator!=(
const CollationKey& source)
const;
00142
00143
00150 UBool isBogus(
void)
const;
00151
00160
const uint8_t* getByteArray(int32_t& count)
const;
00161
00169 uint8_t* toByteArray(int32_t& count)
const;
00170
00181 Collator::EComparisonResult compareTo(
const CollationKey& target)
const;
00182
00203 int32_t hashCode(
void)
const;
00204
00205
private:
00212
void adopt(uint8_t *values, int32_t count);
00213
00214
00215
00216
00217 CollationKey& ensureCapacity(int32_t newSize);
00218 CollationKey& setToBogus(
void);
00219 CollationKey& reset(
void);
00220
00221
friend class RuleBasedCollator;
00222
00223 UBool fBogus;
00224 int32_t fCount;
00225 int32_t fCapacity;
00226 int32_t fHashCode;
00227 uint8_t* fBytes;
00228 };
00229
00230
inline UBool
00231 CollationKey::operator!=(
const CollationKey& other)
const
00232
{
00233
return !(*
this == other);
00234 }
00235
00236
inline UBool
00237 CollationKey::isBogus()
const
00238
{
00239
return fBogus;
00240 }
00241
00242
inline const uint8_t*
00243 CollationKey::getByteArray(int32_t &count)
const
00244
{
00245 count = fCount;
00246
return fBytes;
00247 }
00248
00249 U_NAMESPACE_END
00250
00251
#endif