Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

sortkey.h

Go to the documentation of this file.
00001 /*
00002 * Copyright (C) {1996-1999}, International Business Machines Corporation and others. All Rights Reserved.
00003 *****************************************************************************************
00004 */
00005 //===============================================================================
00006 //
00007 // File sortkey.h
00008 //
00009 //
00010 //
00011 // Created by: Helena Shih
00012 //
00013 // Modification History:
00014 //
00015 //  Date         Name          Description
00016 //
00017 //  6/20/97     helena      Java class name change.
00018 //  8/18/97     helena      Added internal API documentation.
00019 //  6/26/98     erm         Changed to use byte arrays and memcmp.
00020 //===============================================================================
00021 
00022 #ifndef SORTKEY_H
00023 #define SORTKEY_H
00024 
00025 #include "unicode/utypes.h"
00026 
00027 #if !UCONFIG_NO_COLLATION
00028 
00029 #include "unicode/uobject.h"
00030 #include "unicode/unistr.h"
00031 #include "unicode/coll.h"
00032 
00033 U_NAMESPACE_BEGIN
00034 
00035 /* forward declaration */
00036 class RuleBasedCollator;
00037 
00090 class U_I18N_API CollationKey : public UObject {
00091 public:
00099     CollationKey();
00100 
00101 
00109     CollationKey(const  uint8_t*    values,
00110                 int32_t     count);
00111 
00117     CollationKey(const CollationKey& other);
00118 
00123     ~CollationKey();
00124 
00130     const   CollationKey&   operator=(const CollationKey& other);
00131 
00138     UBool                   operator==(const CollationKey& source) const;
00139 
00146     UBool                   operator!=(const CollationKey& source) const;
00147 
00148 
00155     UBool                   isBogus(void) const;
00156 
00166     const    uint8_t*       getByteArray(int32_t& count) const;
00167 
00175     uint8_t*                toByteArray(int32_t& count) const;
00176 
00186     Collator::EComparisonResult compareTo(const CollationKey& target) const;
00187 
00208     int32_t                 hashCode(void) const;
00209 
00215     virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00216 
00222     static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00223 
00224 private:
00232     void adopt(uint8_t *values, int32_t count);
00233 
00234     /*
00235     * Creates a collation key with a string.
00236     */
00237 
00244     CollationKey&           ensureCapacity(int32_t newSize);
00249     CollationKey&           setToBogus(void);
00254     CollationKey&           reset(void);
00255         
00259     friend  class           RuleBasedCollator;
00263     UBool                   fBogus;
00268     int32_t                 fCount;
00272     int32_t                 fCapacity;
00276     int32_t                 fHashCode;
00280     uint8_t*                fBytes;
00281 
00286     static const char fgClassID;
00287 };
00288 
00289 inline UBool
00290 CollationKey::operator!=(const CollationKey& other) const
00291 {
00292     return !(*this == other);
00293 }
00294 
00295 inline UBool
00296 CollationKey::isBogus() const
00297 {
00298     return fBogus;
00299 }
00300 
00301 inline const uint8_t*
00302 CollationKey::getByteArray(int32_t &count) const
00303 {
00304     count = fCount;
00305     return fBytes;
00306 }
00307 
00308 U_NAMESPACE_END
00309 
00310 #endif /* #if !UCONFIG_NO_COLLATION */
00311 
00312 #endif

Generated on Wed Dec 18 16:49:47 2002 for ICU 2.4 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001