ICU-6118 Export less internal API.

X-SVN-Rev: 23155
This commit is contained in:
George Rhoten 2008-01-02 23:53:26 +00:00
parent 35aa7a6339
commit 7490278152
9 changed files with 93 additions and 87 deletions

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2004-2006, International Business Machines
* Copyright (c) 2004-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -33,7 +33,7 @@ class NumberFormat;
* @author Alan Liu
* @internal
*/
class U_I18N_API CurrencyFormat : public MeasureFormat {
class CurrencyFormat : public MeasureFormat {
public:

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and
* Copyright (C) 2007-2008, International Business Machines Corporation and
* others. All Rights Reserved. *
*******************************************************************************
*
@ -220,7 +220,7 @@ private:
PatternMap *patternMap;
};
class U_I18N_API DTSkeletonEnumeration : public StringEnumeration {
class DTSkeletonEnumeration : public StringEnumeration {
public:
DTSkeletonEnumeration(PatternMap &patternMap, dtStrEnum type, UErrorCode& status);
virtual ~DTSkeletonEnumeration();
@ -235,7 +235,7 @@ private:
UVector *fSkeletons;
};
class U_I18N_API DTRedundantEnumeration : public StringEnumeration {
class DTRedundantEnumeration : public StringEnumeration {
public:
DTRedundantEnumeration();
virtual ~DTRedundantEnumeration();

View file

@ -1,7 +1,8 @@
/*
* Copyright (C) 2003-2007, International Business Machines Corporation
*****************************************************************************
* Copyright (C) 2003-2008, International Business Machines Corporation
* and others. All Rights Reserved.
******************************************************************************
*****************************************************************************
*
* File INDIANCAL.H
*****************************************************************************
@ -65,8 +66,8 @@ U_NAMESPACE_BEGIN
*/
class U_I18N_API IndianCalendar : public Calendar {
public:
class IndianCalendar : public Calendar {
public:
/**
* Useful constants for IndianCalendar.
* @internal
@ -271,7 +272,7 @@ class U_I18N_API IndianCalendar : public Calendar {
* @return The class ID for all objects of this class.
* @internal
*/
static UClassID U_EXPORT2 getStaticClassID(void);
U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);
/**
* return the calendar type, "buddhist".
@ -281,11 +282,11 @@ class U_I18N_API IndianCalendar : public Calendar {
*/
virtual const char * getType() const;
private:
private:
IndianCalendar(); // default constructor not implemented
// Default century.
protected:
protected:
/**
* (Overrides Calendar) Return true if the current date for this Calendar is in

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and
* Copyright (C) 2007-2008, International Business Machines Corporation and
* others. All Rights Reserved. *
*******************************************************************************
*
@ -14,7 +14,7 @@
U_NAMESPACE_BEGIN
class U_I18N_API FormatNameEnumeration : public StringEnumeration {
class FormatNameEnumeration : public StringEnumeration {
public:
FormatNameEnumeration(UVector *fFormatNames, UErrorCode& status);
virtual ~FormatNameEnumeration();

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and
* Copyright (C) 2007-2008, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@ -197,7 +197,7 @@ private:
int32_t repeatLimit;
};
class U_I18N_API PluralKeywordEnumeration : public StringEnumeration {
class PluralKeywordEnumeration : public StringEnumeration {
public:
PluralKeywordEnumeration(UErrorCode& status);
virtual ~PluralKeywordEnumeration();

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and
* Copyright (C) 2007-2008, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@ -31,7 +31,6 @@
U_NAMESPACE_BEGIN
class Hashtable;
class PluralRules;
/**
* <p>

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and *
* Copyright (C) 2007-2008, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -194,44 +194,8 @@ static const UChar gWorld[] = {0x30, 0x30, 0x31, 0x00}; // "001"
return 0;
}
/*
* Initialize global objects
*/
void
ZoneMeta::initialize(void) {
UBool initialized;
UMTX_CHECK(&gZoneMetaLock, gZoneMetaInitialized, initialized);
if (initialized) {
return;
}
// Initialize hash tables
Hashtable *tmpCanonicalMap = createCanonicalMap();
Hashtable *tmpOlsonToMeta = createOlsonToMetaMap();
if (tmpOlsonToMeta == NULL) {
// With ICU 3.8 data
tmpOlsonToMeta = createOlsonToMetaMapOld();
}
Hashtable *tmpMetaToOlson = createMetaToOlsonMap();
umtx_lock(&gZoneMetaLock);
if (gZoneMetaInitialized) {
// Another thread already created mappings
delete tmpCanonicalMap;
delete tmpOlsonToMeta;
delete tmpMetaToOlson;
} else {
gZoneMetaInitialized = TRUE;
gCanonicalMap = tmpCanonicalMap;
gOlsonToMeta = tmpOlsonToMeta;
gMetaToOlson = tmpMetaToOlson;
ucln_i18n_registerCleanup(UCLN_I18N_ZONEMETA, zoneMeta_cleanup);
}
umtx_unlock(&gZoneMetaLock);
}
Hashtable*
ZoneMeta::createCanonicalMap(void) {
static Hashtable*
createCanonicalMap(void) {
UErrorCode status = U_ZERO_ERROR;
Hashtable *canonicalMap = NULL;
@ -366,8 +330,8 @@ error_cleanup:
/*
* Creating Olson tzid to metazone mappings from resource (3.8.1 and beyond)
*/
Hashtable*
ZoneMeta::createOlsonToMetaMap(void) {
static Hashtable*
createOlsonToMetaMap(void) {
UErrorCode status = U_ZERO_ERROR;
Hashtable *olsonToMeta = NULL;
@ -506,8 +470,8 @@ error_cleanup:
/*
* Creating Olson tzid to metazone mappings from ICU resource (3.8)
*/
Hashtable*
ZoneMeta::createOlsonToMetaMapOld(void) {
static Hashtable*
createOlsonToMetaMapOld(void) {
UErrorCode status = U_ZERO_ERROR;
Hashtable *olsonToMeta = NULL;
@ -645,8 +609,8 @@ error_cleanup:
goto normal_cleanup;
}
Hashtable*
ZoneMeta::createMetaToOlsonMap(void) {
static Hashtable*
createMetaToOlsonMap(void) {
UErrorCode status = U_ZERO_ERROR;
Hashtable *metaToOlson = NULL;
@ -740,7 +704,43 @@ error_cleanup:
goto normal_cleanup;
}
UnicodeString&
/*
* Initialize global objects
*/
static void
initialize(void) {
UBool initialized;
UMTX_CHECK(&gZoneMetaLock, gZoneMetaInitialized, initialized);
if (initialized) {
return;
}
// Initialize hash tables
Hashtable *tmpCanonicalMap = createCanonicalMap();
Hashtable *tmpOlsonToMeta = createOlsonToMetaMap();
if (tmpOlsonToMeta == NULL) {
// With ICU 3.8 data
tmpOlsonToMeta = createOlsonToMetaMapOld();
}
Hashtable *tmpMetaToOlson = createMetaToOlsonMap();
umtx_lock(&gZoneMetaLock);
if (gZoneMetaInitialized) {
// Another thread already created mappings
delete tmpCanonicalMap;
delete tmpOlsonToMeta;
delete tmpMetaToOlson;
} else {
gZoneMetaInitialized = TRUE;
gCanonicalMap = tmpCanonicalMap;
gOlsonToMeta = tmpOlsonToMeta;
gMetaToOlson = tmpMetaToOlson;
ucln_i18n_registerCleanup(UCLN_I18N_ZONEMETA, zoneMeta_cleanup);
}
umtx_unlock(&gZoneMetaLock);
}
UnicodeString& U_EXPORT2
ZoneMeta::getCanonicalID(const UnicodeString &tzid, UnicodeString &canonicalID) {
const CanonicalMapEntry *entry = getCanonicalInfo(tzid);
if (entry != NULL) {
@ -752,7 +752,7 @@ ZoneMeta::getCanonicalID(const UnicodeString &tzid, UnicodeString &canonicalID)
return canonicalID;
}
UnicodeString&
UnicodeString& U_EXPORT2
ZoneMeta::getCanonicalCountry(const UnicodeString &tzid, UnicodeString &canonicalCountry) {
const CanonicalMapEntry *entry = getCanonicalInfo(tzid);
if (entry != NULL && entry->country != NULL) {
@ -764,7 +764,7 @@ ZoneMeta::getCanonicalCountry(const UnicodeString &tzid, UnicodeString &canonica
return canonicalCountry;
}
const CanonicalMapEntry*
const CanonicalMapEntry* U_EXPORT2
ZoneMeta::getCanonicalInfo(const UnicodeString &tzid) {
initialize();
CanonicalMapEntry *entry = NULL;
@ -778,7 +778,7 @@ ZoneMeta::getCanonicalInfo(const UnicodeString &tzid) {
return entry;
}
UnicodeString&
UnicodeString& U_EXPORT2
ZoneMeta::getSingleCountry(const UnicodeString &tzid, UnicodeString &country) {
UErrorCode status = U_ZERO_ERROR;
@ -810,7 +810,7 @@ ZoneMeta::getSingleCountry(const UnicodeString &tzid, UnicodeString &country) {
return country;
}
UnicodeString&
UnicodeString& U_EXPORT2
ZoneMeta::getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &result) {
UBool isSet = FALSE;
const UVector *mappings = getMetazoneMappings(tzid);
@ -830,7 +830,7 @@ ZoneMeta::getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &re
return result;
}
const UVector*
const UVector* U_EXPORT2
ZoneMeta::getMetazoneMappings(const UnicodeString &tzid) {
initialize();
const UVector *result = NULL;
@ -840,7 +840,7 @@ ZoneMeta::getMetazoneMappings(const UnicodeString &tzid) {
return result;
}
UnicodeString&
UnicodeString& U_EXPORT2
ZoneMeta::getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &region, UnicodeString &result) {
initialize();
UBool isSet = FALSE;

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and *
* Copyright (C) 2007-2008, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -40,13 +40,13 @@ public:
* Return the canonical id for this tzid, which might be the id itself.
* If there is no canonical id for it, return the passed-in id.
*/
static UnicodeString& getCanonicalID(const UnicodeString &tzid, UnicodeString &canonicalID);
static UnicodeString& U_EXPORT2 getCanonicalID(const UnicodeString &tzid, UnicodeString &canonicalID);
/**
* Return the canonical country code for this tzid. If we have none, or if the time zone
* is not associated with a country, return null.
*/
static UnicodeString& getCanonicalCountry(const UnicodeString &tzid, UnicodeString &canonicalCountry);
static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &canonicalCountry);
/**
* Return the country code if this is a 'single' time zone that can fallback to just
@ -54,28 +54,22 @@ public:
* to see that there is a localization for the country in order to implement
* tr#35 appendix J step 5.)
*/
static UnicodeString& getSingleCountry(const UnicodeString &tzid, UnicodeString &country);
static UnicodeString& U_EXPORT2 getSingleCountry(const UnicodeString &tzid, UnicodeString &country);
/**
* Returns a CLDR metazone ID for the given Olson tzid and time.
*/
static UnicodeString& getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &result);
static UnicodeString& U_EXPORT2 getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &result);
/**
* Returns an Olson ID for the ginve metazone and region
*/
static UnicodeString& getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &region, UnicodeString &result);
static UnicodeString& U_EXPORT2 getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &region, UnicodeString &result);
static const UVector* getMetazoneMappings(const UnicodeString &tzid);
static const UVector* U_EXPORT2 getMetazoneMappings(const UnicodeString &tzid);
private:
static void initialize(void);
static const CanonicalMapEntry* getCanonicalInfo(const UnicodeString &tzid);
static Hashtable* createCanonicalMap(void);
static Hashtable* createOlsonToMetaMapOld(void);
static Hashtable* createOlsonToMetaMap(void);
static Hashtable* createMetaToOlsonMap(void);
static const CanonicalMapEntry* U_EXPORT2 getCanonicalInfo(const UnicodeString &tzid);
ZoneMeta(); // Prevent construction.
};
U_NAMESPACE_END

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 2002-2007, International Business Machines Corporation and
* Copyright (c) 2002-2008, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@ -158,6 +158,9 @@ UObject *UObjectTest::testClass(UObject *obj,
#include "japancal.h"
#include "hebrwcal.h"
#include "persncal.h"
#include "taiwncal.h"
#include "indiancal.h"
#include "chnsecal.h"
#include "windtfmt.h"
#include "winnmfmt.h"
#include "ustrenum.h"
@ -177,6 +180,7 @@ UObject *UObjectTest::testClass(UObject *obj,
#include "unicode/dcfmtsym.h"
#include "unicode/decimfmt.h"
#include "unicode/dtfmtsym.h"
#include "unicode/dtptngen.h"
#include "unicode/fieldpos.h"
#include "unicode/fmtable.h"
#include "unicode/format.h"
@ -186,6 +190,8 @@ UObject *UObjectTest::testClass(UObject *obj,
#include "unicode/normlzr.h"
#include "unicode/numfmt.h"
#include "unicode/parsepos.h"
#include "unicode/plurrule.h"
#include "unicode/plurfmt.h"
#include "unicode/rbbi.h"
#include "unicode/rbnf.h"
#include "unicode/regex.h"
@ -250,19 +256,25 @@ void UObjectTest::testIDs()
TESTCLASSID_CTOR(ChoiceFormat, (UNICODE_STRING_SIMPLE("0#are no files|1#is one file|1<are many files"), status));
TESTCLASSID_CTOR(MessageFormat, (UnicodeString(), status));
TESTCLASSID_CTOR(DateFormatSymbols, (status));
TESTCLASSID_CTOR(PluralFormat, (status));
TESTCLASSID_CTOR(PluralRules, (status));
TESTCLASSID_FACTORY(DateTimePatternGenerator, DateTimePatternGenerator::createInstance(status));
TESTCLASSID_FACTORY(RelativeDateFormat, DateFormat::createDateInstance(DateFormat::kFullRelative, Locale::getUS()));
TESTCLASSID_CTOR(DecimalFormatSymbols, (status));
TESTCLASSID_DEFAULT(FieldPosition);
TESTCLASSID_DEFAULT(Formattable);
TESTCLASSID_CTOR(CurrencyAmount, (1.0, SMALL_STR, status));
TESTCLASSID_CTOR(CurrencyUnit, (SMALL_STR, status));
TESTCLASSID_CTOR(CurrencyFormat, (Locale::getUS(), status));
TESTCLASSID_FACTORY_HIDDEN(CurrencyFormat, MeasureFormat::createCurrencyFormat(Locale::getUS(), status));
TESTCLASSID_FACTORY(GregorianCalendar, Calendar::createInstance(Locale("@calendar=gregorian"), status));
TESTCLASSID_FACTORY(BuddhistCalendar, Calendar::createInstance(Locale("@calendar=buddhist"), status));
TESTCLASSID_FACTORY(IslamicCalendar, Calendar::createInstance(Locale("@calendar=islamic"), status));
TESTCLASSID_FACTORY(JapaneseCalendar, Calendar::createInstance(Locale("@calendar=japanese"), status));
TESTCLASSID_FACTORY(HebrewCalendar, Calendar::createInstance(Locale("@calendar=hebrew"), status));
TESTCLASSID_FACTORY(PersianCalendar, Calendar::createInstance(Locale("@calendar=persian"), status));
TESTCLASSID_FACTORY(IndianCalendar, Calendar::createInstance(Locale("@calendar=indian"), status));
TESTCLASSID_FACTORY(ChineseCalendar, Calendar::createInstance(Locale("@calendar=chinese"), status));
TESTCLASSID_FACTORY(TaiwanCalendar, Calendar::createInstance(Locale("@calendar=taiwan"), status));
#ifdef U_WINDOWS
TESTCLASSID_FACTORY(Win32DateFormat, DateFormat::createDateInstance(DateFormat::kFull, Locale("@compat=host")));
TESTCLASSID_FACTORY(Win32NumberFormat, NumberFormat::createInstance(Locale("@compat=host"), status));