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

TableCollationData Class Reference

TableCollationData is an internal class used by TableCollation. More...

#include <tcoldata.h>

List of all members.

Public Methods

 TableCollationData ()
virtual ~TableCollationData ()
void streamIn (FileStream* is)
 The streamIn and streamOut methods read and write objects of this class as binary, platform-dependent data in the iostream. More...

void streamOut (FileStream* os) const
void streamIn (UMemoryStream* is, UErrorCode& status)
 For internal use only - streaming to memory.

void streamOut (UMemoryStream* os) const
UBool isBogus () const
 Checks if this object is valid. More...


Static Public Methods

void addToCache (const UnicodeString& key, TableCollationData* data)
 Cache interface. More...

TableCollationData* findInCache (const UnicodeString& key)
 Finds and returns the cached collation data. More...


Friends

class  RuleBasedCollator
class  CollationElementIterator
int32_t ucol_getNextCE (const UCollator *coll, collIterate *source, UErrorCode *status)
int32_t getComplicatedCE (const UCollator *coll, collIterate *source, UErrorCode *status)
int32_t ucol_getSortKey (const UCollator *coll, const UChar *source, int32_t sourceLength, uint8_t *result, int32_t resultLength)
 Get a sort key for a string from a UCollator. More...

UCollationResult ucol_strcoll ( const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength)
 Compare two strings. More...


Detailed Description

TableCollationData is an internal class used by TableCollation.

It encapsulates most of the data associated with a TableCollation. This includes the large collation tables, including the contract order and expand order tables, and some small pieces of data that don't change, such as the maximum secondary order. The general idea is that the TableCollation object should be a lightweight object. If there are two TableCollation objects, they will each be very small, and users can alter the strength of each object independently. However, both objects, if they are refering to the same underlying collation, will share pointers to the same TableCollationData object, which doesn't change.

TableCollationData objects are therefore good candidates for caching in memory and potentially for reference counting.

Definition at line 69 of file tcoldata.h.


Constructor & Destructor Documentation

TableCollationData::TableCollationData ( )
 

virtual TableCollationData::~TableCollationData ( ) [virtual]
 


Member Function Documentation

void TableCollationData::addToCache ( const UnicodeString & key,
TableCollationData * data ) [static]
 

Cache interface.

The cache uses UnicodeString objects as keys. These are completely arbitrary, but are usually something uniquely associated with each collation, while at the same time fairly small, such as a locale identifier string.

Adds the collation data object to the cache list.

Parameters:
key   the unique key of the associated collation data object.
data   the collation data object.

TableCollationData * TableCollationData::findInCache ( const UnicodeString & key ) [static]
 

Finds and returns the cached collation data.

Parameters:
key   the unique key of the associated collation data object.
Returns:
the found collation data object.

UBool TableCollationData::isBogus ( void ) const
 

Checks if this object is valid.

Returns:
TRUE if the object is valid, FALSE otherwise.

void TableCollationData::streamIn ( UMemoryStream * is,
UErrorCode & status )
 

For internal use only - streaming to memory.

void TableCollationData::streamIn ( FileStream * is )
 

The streamIn and streamOut methods read and write objects of this class as binary, platform-dependent data in the iostream.

The stream must be in ios::binary mode for this to work. These methods are not intended for general public use; they are used by the framework to improve performance by storing certain objects in binary files.

void TableCollationData::streamOut ( UMemoryStream * os ) const
 

void TableCollationData::streamOut ( FileStream * os ) const
 


Friends And Related Function Documentation

class CollationElementIterator [friend]
 

Definition at line 133 of file tcoldata.h.

class RuleBasedCollator [friend]
 

The TableCollation class freely manipulates the data members within a TableCollationData object.

This is because TableCollationData is intended to be an internal, invisible implementation detail. If TableCollationData every becomes a more public API, then this will have to change, although this is not really advised.

Definition at line 132 of file tcoldata.h.

int32_t getComplicatedCE ( const UCollator * coll,
collIterate * source,
UErrorCode * status ) [friend]
 

int32_t ucol_getNextCE ( const UCollator * coll,
collIterate * source,
UErrorCode * status ) [friend]
 

int32_t ucol_getSortKey ( const UCollator * coll,
const UChar * source,
int32_t sourceLength,
uint8_t * result,
int32_t resultLength ) [friend]
 

Get a sort key for a string from a UCollator.

Sort keys may be compared using memcmp.

Parameters:
coll   The UCollator containing the collation rules.
source   The string to transform.
sourecLength   The length of source, or -1 if null-terminated.
result   A pointer to a buffer to receive the attribute.
resultLength   The maximum size of result.
Returns:
The size needed to fully store the sort key..
See also:
ucol_keyHashCode
Stable:

UCollationResult ucol_strcoll ( const UCollator * coll,
const UChar * source,
int32_t sourceLength,
const UChar * target,
int32_t targetLength ) [friend]
 

Compare two strings.

The strings will be compared using the normalization mode and options specified in \Ref{ucol_open} or \Ref{ucol_openRules}

Parameters:
coll   The UCollator containing the comparison rules.
source   The source string.
sourceLength   The length of source, or -1 if null-terminated.
target   The target string.
targetLength   The length of target, or -1 if null-terminated.
Returns:
The result of comparing the strings; one of UCOL_EQUAL, UCOL_GREATER, UCOL_LESS
See also:
ucol_greater , ucol_greaterOrEqual , ucol_equal
Stable:


The documentation for this class was generated from the following file:
Generated at Tue Dec 5 17:56:24 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000