2016-06-15 18:58:17 +00:00
|
|
|
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2000-12-14 01:11:11 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (C) 1998-2014, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
2000-12-14 01:11:11 +00:00
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* Private implementation header for C collation
|
2001-03-08 17:40:42 +00:00
|
|
|
* file name: ucol_imp.h
|
2000-12-14 01:11:11 +00:00
|
|
|
* encoding: US-ASCII
|
|
|
|
* tab size: 8 (not used)
|
|
|
|
* indentation:4
|
|
|
|
*
|
|
|
|
* created on: 2000dec11
|
|
|
|
* created by: Vladimir Weinstein
|
2001-04-18 19:31:05 +00:00
|
|
|
*
|
2001-02-20 00:26:50 +00:00
|
|
|
* Modification history
|
|
|
|
* Date Name Comments
|
|
|
|
* 02/16/2001 synwee Added UCOL_GETPREVCE for the use in ucoleitr
|
2001-04-18 19:31:05 +00:00
|
|
|
* 02/27/2001 synwee Added getMaxExpansion data structure in UCollator
|
|
|
|
* 03/02/2001 synwee Added UCOL_IMPLICIT_CE
|
2001-03-12 20:05:46 +00:00
|
|
|
* 03/12/2001 synwee Added pointer start to collIterate.
|
2000-12-14 01:11:11 +00:00
|
|
|
*/
|
|
|
|
|
2000-12-12 19:44:23 +00:00
|
|
|
#ifndef UCOL_IMP_H
|
|
|
|
#define UCOL_IMP_H
|
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
#include "unicode/utypes.h"
|
2004-04-14 19:58:08 +00:00
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
#if !UCONFIG_NO_COLLATION
|
|
|
|
|
2014-08-20 21:46:02 +00:00
|
|
|
// This part needs to compile as plain C code, for cintltst.
|
|
|
|
|
2000-12-12 19:44:23 +00:00
|
|
|
#include "unicode/ucol.h"
|
2010-01-06 23:50:03 +00:00
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
/** Check whether two collators are equal. Collators are considered equal if they
|
|
|
|
* will sort strings the same. This means that both the current attributes and the
|
|
|
|
* rules must be equivalent.
|
|
|
|
* @param source first collator
|
|
|
|
* @param target second collator
|
|
|
|
* @return TRUE or FALSE
|
|
|
|
* @internal ICU 3.0
|
2008-05-23 04:22:28 +00:00
|
|
|
*/
|
2014-02-25 21:21:49 +00:00
|
|
|
U_INTERNAL UBool U_EXPORT2
|
|
|
|
ucol_equals(const UCollator *source, const UCollator *target);
|
2000-12-14 01:11:11 +00:00
|
|
|
|
|
|
|
/**
|
2014-02-25 21:21:49 +00:00
|
|
|
* Convenience string denoting the Collation data tree
|
2000-12-14 01:11:11 +00:00
|
|
|
*/
|
2014-02-25 21:21:49 +00:00
|
|
|
#define U_ICUDATA_COLL U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll"
|
2011-05-03 00:29:45 +00:00
|
|
|
|
2011-07-23 00:10:30 +00:00
|
|
|
#ifdef __cplusplus
|
2011-05-03 00:29:45 +00:00
|
|
|
|
2014-08-20 21:46:02 +00:00
|
|
|
#include "unicode/locid.h"
|
|
|
|
#include "unicode/ures.h"
|
|
|
|
|
2011-05-09 23:31:44 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2014-08-20 21:46:02 +00:00
|
|
|
struct CollationCacheEntry;
|
2011-05-09 23:31:44 +00:00
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
class Locale;
|
|
|
|
class UnicodeString;
|
2014-08-20 21:46:02 +00:00
|
|
|
class UnifiedCache;
|
2000-12-12 19:44:23 +00:00
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
/** Implemented in ucol_res.cpp. */
|
|
|
|
class CollationLoader {
|
|
|
|
public:
|
|
|
|
static void appendRootRules(UnicodeString &s);
|
2014-08-13 22:58:14 +00:00
|
|
|
static void loadRules(const char *localeID, const char *collationType,
|
|
|
|
UnicodeString &rules, UErrorCode &errorCode);
|
2014-08-20 21:46:02 +00:00
|
|
|
// Adds a reference to returned value.
|
|
|
|
static const CollationCacheEntry *loadTailoring(const Locale &locale, UErrorCode &errorCode);
|
|
|
|
|
|
|
|
// Cache callback. Adds a reference to returned value.
|
|
|
|
const CollationCacheEntry *createCacheEntry(UErrorCode &errorCode);
|
2000-12-14 01:11:11 +00:00
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
private:
|
2016-09-27 23:39:01 +00:00
|
|
|
static void U_CALLCONV loadRootRules(UErrorCode &errorCode);
|
2014-08-20 21:46:02 +00:00
|
|
|
|
|
|
|
// The following members are used by loadTailoring()
|
|
|
|
// and the cache callback.
|
|
|
|
static const uint32_t TRIED_SEARCH = 1;
|
|
|
|
static const uint32_t TRIED_DEFAULT = 2;
|
|
|
|
static const uint32_t TRIED_STANDARD = 4;
|
|
|
|
|
|
|
|
CollationLoader(const CollationCacheEntry *re, const Locale &requested, UErrorCode &errorCode);
|
|
|
|
~CollationLoader();
|
|
|
|
|
|
|
|
// All loadFromXXX methods add a reference to the returned value.
|
|
|
|
const CollationCacheEntry *loadFromLocale(UErrorCode &errorCode);
|
|
|
|
const CollationCacheEntry *loadFromBundle(UErrorCode &errorCode);
|
|
|
|
const CollationCacheEntry *loadFromCollations(UErrorCode &errorCode);
|
|
|
|
const CollationCacheEntry *loadFromData(UErrorCode &errorCode);
|
|
|
|
|
|
|
|
// Adds a reference to returned value.
|
|
|
|
const CollationCacheEntry *getCacheEntry(UErrorCode &errorCode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the rootEntry (with one addRef()) if loc==root,
|
|
|
|
* or else returns a new cache entry with ref count 1 for the loc and
|
|
|
|
* the root tailoring.
|
|
|
|
*/
|
|
|
|
const CollationCacheEntry *makeCacheEntryFromRoot(
|
|
|
|
const Locale &loc, UErrorCode &errorCode) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the entryFromCache as is if loc==validLocale,
|
|
|
|
* or else returns a new cache entry with ref count 1 for the loc and
|
|
|
|
* the same tailoring. In the latter case, a ref count is removed from
|
|
|
|
* entryFromCache.
|
|
|
|
*/
|
|
|
|
static const CollationCacheEntry *makeCacheEntry(
|
|
|
|
const Locale &loc,
|
|
|
|
const CollationCacheEntry *entryFromCache,
|
|
|
|
UErrorCode &errorCode);
|
|
|
|
|
|
|
|
const UnifiedCache *cache;
|
|
|
|
const CollationCacheEntry *rootEntry;
|
|
|
|
Locale validLocale;
|
|
|
|
Locale locale;
|
|
|
|
char type[16];
|
|
|
|
char defaultType[16];
|
|
|
|
uint32_t typesTried;
|
|
|
|
UBool typeFallback;
|
|
|
|
UResourceBundle *bundle;
|
|
|
|
UResourceBundle *collations;
|
|
|
|
UResourceBundle *data;
|
2001-01-04 00:45:41 +00:00
|
|
|
};
|
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
U_NAMESPACE_END
|
2001-10-09 20:23:39 +00:00
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
#endif /* __cplusplus */
|
2008-06-09 21:18:46 +00:00
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_COLLATION */
|
|
|
|
|
2000-12-13 18:08:27 +00:00
|
|
|
#endif
|