ICU-110 Added ucol_getVersion() API for getting Collator version information.

X-SVN-Rev: 1375
This commit is contained in:
Helena Chapman 2000-05-15 19:48:26 +00:00
parent 53f279b17e
commit c5a079fe2e
4 changed files with 35 additions and 12 deletions

View File

@ -38,8 +38,8 @@
// 11/23/9 srl Inlining of some critical functions
//=============================================================================
#include "unicode/utypes.h"
#include "colcache.h"
#include "unicode/coll.h"
#include "unicode/tblcoll.h"
@ -49,6 +49,7 @@
#include "unicode/normlzr.h"
//-----------------------------------------------------------------------------
const UVersionInfo Collator::fVersion = {1, 0, 0, 0};
Collator::Collator()
: strength(Collator::TERTIARY), decmp(Normalizer::DECOMP)

View File

@ -12,14 +12,9 @@
#include "unicode/tblcoll.h"
#include "unicode/coleitr.h"
#include "unicode/ustring.h"
/*===============================================
=================================================
---> MOVE SOMEWHERE ELSE !!! <---
=================================================
===============================================*/
#include "unicode/normlzr.h"
#include "cpputils.h"
U_CAPI int32_t
u_normalize(const UChar* source,
int32_t sourceLength,
@ -400,3 +395,10 @@ ucol_setOffset( UCollationElements *elems,
((CollationElementIterator*)elems)->setOffset(offset, *status);
}
U_CAPI void
ucol_getVersion(const UCollator* coll,
UVersionInfo versionInfo)
{
((Collator*)coll)->getVersion(versionInfo);
}

View File

@ -38,6 +38,7 @@
// UnicodeString construction and special case for NO_OP.
// 11/23/99 srl More performance enhancements. Inlining of
// critical accessors.
// 05/15/00 helena Added version information API.
//=============================================================================
#ifndef COLL_H
@ -48,6 +49,7 @@
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "unicode/normlzr.h"
#include "cmemory.h"
class CollationKey;
@ -523,6 +525,13 @@ public:
*/
static const Locale* getAvailableLocales(int32_t& count);
/**
* Gets the version information for a Collator.
* @param info the version # information, the result will be filled in
* @stable
*/
void getVersion(UVersionInfo info) const;
/**
* Returns a unique class ID POLYMORPHICALLY. Pure virtual method.
* This method is to implement a simple version of RTTI, since not all
@ -561,6 +570,7 @@ private:
ECollationStrength strength;
Normalizer::EMode decmp;
static const UVersionInfo fVersion;
};
inline bool_t
@ -592,5 +602,12 @@ Collator::getDecomposition() const
return decmp;
}
inline void
Collator::getVersion(UVersionInfo versionInfo) const
{
if(versionInfo!=NULL) {
uprv_memcpy(versionInfo, fVersion, U_MAX_VERSION_LENGTH);
}
}
#endif

View File

@ -186,11 +186,6 @@ enum UCollationStrength {
} ;
typedef enum UCollationStrength UCollationStrength;
/*===============================================
=================================================
---> MOVE SOMEWHERE ELSE !!! <---
=================================================
===============================================*/
/**
* @name Unicode normalization API
*
@ -744,4 +739,12 @@ ucol_setOffset( UCollationElements *elems,
UTextOffset offset,
UErrorCode *status);
/**
* Gets the version information for a Collator.
* @param info the version # information, the result will be filled in
* @stable
*/
U_CAPI void U_EXPORT2
ucol_getVersion(const UCollator* coll, UVersionInfo info);
#endif