Browse files

Use Froyo East Asian width measurement and drop JNI lib

  • Loading branch information...
1 parent ddb146d commit 409d414dc5b943ae3992fe2a6e161af18b212c94 @kruton kruton committed Oct 8, 2010
Showing with 1 addition and 21,873 deletions.
  1. +1 −1 AndroidManifest.xml
  2. +0 −11 jni/EastAsianWidth/Android.mk
  3. +0 −101 jni/EastAsianWidth/org_connectbot_util_EastAsianWidth.c
  4. 0 jni/EastAsianWidth/unicode/VERSION_ICU_3_8_1
  5. +0 −557 jni/EastAsianWidth/unicode/brkiter.h
  6. +0 −201 jni/EastAsianWidth/unicode/caniter.h
  7. +0 −716 jni/EastAsianWidth/unicode/chariter.h
  8. +0 −41 jni/EastAsianWidth/unicode/dbbi.h
  9. +0 −202 jni/EastAsianWidth/unicode/docmain.h
  10. +0 −765 jni/EastAsianWidth/unicode/locid.h
  11. +0 −823 jni/EastAsianWidth/unicode/normlzr.h
  12. +0 −92 jni/EastAsianWidth/unicode/parseerr.h
  13. +0 −230 jni/EastAsianWidth/unicode/parsepos.h
  14. +0 −325 jni/EastAsianWidth/unicode/platform.h
  15. +0 −313 jni/EastAsianWidth/unicode/platform.h.in
  16. +0 −273 jni/EastAsianWidth/unicode/ppalmos.h
  17. +0 −184 jni/EastAsianWidth/unicode/putil.h
  18. +0 −311 jni/EastAsianWidth/unicode/pwin32.h
  19. +0 −700 jni/EastAsianWidth/unicode/rbbi.h
  20. +0 −259 jni/EastAsianWidth/unicode/rep.h
  21. +0 −485 jni/EastAsianWidth/unicode/resbund.h
  22. +0 −187 jni/EastAsianWidth/unicode/schriter.h
  23. +0 −271 jni/EastAsianWidth/unicode/strenum.h
  24. +0 −112 jni/EastAsianWidth/unicode/symtable.h
  25. +0 −1,999 jni/EastAsianWidth/unicode/ubidi.h
  26. +0 −482 jni/EastAsianWidth/unicode/ubrk.h
  27. +0 −395 jni/EastAsianWidth/unicode/ucasemap.h
  28. +0 −158 jni/EastAsianWidth/unicode/ucat.h
  29. +0 −3,013 jni/EastAsianWidth/unicode/uchar.h
  30. +0 −381 jni/EastAsianWidth/unicode/uchriter.h
  31. +0 −267 jni/EastAsianWidth/unicode/uclean.h
  32. +0 −1,967 jni/EastAsianWidth/unicode/ucnv.h
  33. +0 −162 jni/EastAsianWidth/unicode/ucnv_cb.h
  34. +0 −456 jni/EastAsianWidth/unicode/ucnv_err.h
  35. +0 −215 jni/EastAsianWidth/unicode/uconfig.h
  36. +0 −389 jni/EastAsianWidth/unicode/udata.h
  37. +0 −50 jni/EastAsianWidth/unicode/udeprctd.h
  38. +0 −186 jni/EastAsianWidth/unicode/udraft.h
  39. +0 −134 jni/EastAsianWidth/unicode/uenum.h
  40. +0 −312 jni/EastAsianWidth/unicode/uidna.h
  41. +0 −180 jni/EastAsianWidth/unicode/uintrnal.h
  42. +0 −707 jni/EastAsianWidth/unicode/uiter.h
  43. +0 −931 jni/EastAsianWidth/unicode/uloc.h
  44. +0 −338 jni/EastAsianWidth/unicode/umachine.h
  45. +0 −60 jni/EastAsianWidth/unicode/umisc.h
  46. +0 −127 jni/EastAsianWidth/unicode/unifilt.h
  47. +0 −125 jni/EastAsianWidth/unicode/unifunct.h
  48. +0 −163 jni/EastAsianWidth/unicode/unimatch.h
  49. +0 −1,516 jni/EastAsianWidth/unicode/uniset.h
Sorry, we could not display the entire diff because it was too big.
View
2 AndroidManifest.xml
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.connectbot"
android:versionName="1.7.1"
- android:versionCode="325"
+ android:versionCode="326"
android:installLocation="auto">
<application
View
11 jni/EastAsianWidth/Android.mk
@@ -1,11 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-
-LOCAL_SRC_FILES := org_connectbot_util_EastAsianWidth.c
-LOCAL_MODULE := org_connectbot_util_EastAsianWidth
-LOCAL_CFLAGS += -I$(LOCAL_PATH)/unicode
-
-LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -licuuc -llog
-
-include $(BUILD_SHARED_LIBRARY)
View
101 jni/EastAsianWidth/org_connectbot_util_EastAsianWidth.c
@@ -1,101 +0,0 @@
-/*
- * ConnectBot: simple, powerful, open-source SSH client for Android
- * Copyright 2007 Kenny Root, Jeffrey Sharkey
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* vim: set ts=4 sw=4 expandtab cindent: */
-#define LOG_TAG "ConnectBot.util.EastAsianWidth"
-
-#include <jni.h>
-#include <android/log.h>
-#include <utypes.h>
-#include <uchar.h>
-
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR , LOG_TAG, __VA_ARGS__)
-
-/**
- * org.connectbot.util.EastAsianWidth
- */
-
-Java_org_connectbot_util_EastAsianWidth_measure(JNIEnv *env, jobject thiz,
- jcharArray buffer, jint start, jint len, jbyteArray attributes, jboolean eastAsian) {
-
- UErrorCode errorCode = U_ZERO_ERROR;
- jint end = start + len;
- jint i = start;
- UChar32 c;
-
- const jchar *uBuffer = (jchar *) (*env)->GetPrimitiveArrayCritical(env, buffer, (jboolean *)0);
- if (!uBuffer) {
- LOGE("Could not obtain source buffer");
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- goto exit;
- }
-
- jbyte *uAttributes = (jbyte *) (*env)->GetPrimitiveArrayCritical(env, attributes, (jboolean *)0);
- if (!uAttributes) {
- LOGE("Could not obtain attribute array");
- errorCode = U_ILLEGAL_ARGUMENT_ERROR;
- goto exit;
- }
-
- while (i < end) {
- U16_NEXT(uBuffer, i, end, c);
- UEastAsianWidth ea = (UEastAsianWidth) u_getIntPropertyValue(c, UCHAR_EAST_ASIAN_WIDTH);
-
- switch (ea) {
- case U_EA_FULLWIDTH:
- case U_EA_WIDE:
- uAttributes[i] = 1;
- break;
- case U_EA_HALFWIDTH:
- case U_EA_NARROW:
- uAttributes[i] = 0;
- break;
- case U_EA_NEUTRAL:
- case U_EA_AMBIGUOUS:
- default:
- if (eastAsian)
- uAttributes[i] = 1;
- else
- uAttributes[i] = 0;
- break;
- }
- }
-
-exit:
- if (uBuffer)
- (*env)->ReleasePrimitiveArrayCritical(env, buffer, (jchar *)uBuffer, JNI_ABORT);
- if (uAttributes)
- (*env)->ReleasePrimitiveArrayCritical(env, attributes, uAttributes, JNI_ABORT);
-
- return errorCode;
-}
-
-jint JNI_OnLoad(JavaVM* vm, void* reserved) {
- JNIEnv* env = NULL;
- jint result = -1;
- jclass clazz;
-
- if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) {
- LOGE("ERROR: GetEnv failed\n");
- goto bail;
- }
-
- result = JNI_VERSION_1_4;
-
-bail:
- return result;
-}
View
0 jni/EastAsianWidth/unicode/VERSION_ICU_3_8_1
No changes.
View
557 jni/EastAsianWidth/unicode/brkiter.h
@@ -1,557 +0,0 @@
-/*
-********************************************************************************
-* Copyright (C) 1997-2007, International Business Machines
-* Corporation and others. All Rights Reserved.
-********************************************************************************
-*
-* File brkiter.h
-*
-* Modification History:
-*
-* Date Name Description
-* 02/18/97 aliu Added typedef for TextCount. Made DONE const.
-* 05/07/97 aliu Fixed DLL declaration.
-* 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK
-* 08/11/98 helena Sync-up JDK1.2.
-* 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods.
-********************************************************************************
-*/
-
-#ifndef BRKITER_H
-#define BRKITER_H
-
-#include "unicode/utypes.h"
-
-/**
- * \file
- * \brief C++ API: Break Iterator.
- */
-
-#if UCONFIG_NO_BREAK_ITERATION
-
-U_NAMESPACE_BEGIN
-
-/*
- * Allow the declaration of APIs with pointers to BreakIterator
- * even when break iteration is removed from the build.
- */
-class BreakIterator;
-
-U_NAMESPACE_END
-
-#else
-
-#include "unicode/uobject.h"
-#include "unicode/unistr.h"
-#include "unicode/chariter.h"
-#include "unicode/locid.h"
-#include "unicode/ubrk.h"
-#include "unicode/strenum.h"
-#include "unicode/utext.h"
-#include "unicode/umisc.h"
-
-U_NAMESPACE_BEGIN
-
-/**
- * The BreakIterator class implements methods for finding the location
- * of boundaries in text. BreakIterator is an abstract base class.
- * Instances of BreakIterator maintain a current position and scan over
- * text returning the index of characters where boundaries occur.
- * <p>
- * Line boundary analysis determines where a text string can be broken
- * when line-wrapping. The mechanism correctly handles punctuation and
- * hyphenated words.
- * <p>
- * Sentence boundary analysis allows selection with correct
- * interpretation of periods within numbers and abbreviations, and
- * trailing punctuation marks such as quotation marks and parentheses.
- * <p>
- * Word boundary analysis is used by search and replace functions, as
- * well as within text editing applications that allow the user to
- * select words with a double click. Word selection provides correct
- * interpretation of punctuation marks within and following
- * words. Characters that are not part of a word, such as symbols or
- * punctuation marks, have word-breaks on both sides.
- * <p>
- * Character boundary analysis allows users to interact with
- * characters as they expect to, for example, when moving the cursor
- * through a text string. Character boundary analysis provides correct
- * navigation of through character strings, regardless of how the
- * character is stored. For example, an accented character might be
- * stored as a base character and a diacritical mark. What users
- * consider to be a character can differ between languages.
- * <p>
- * The text boundary positions are found according to the rules
- * described in Unicode Standard Annex #29, Text Boundaries, and
- * Unicode Standard Annex #14, Line Breaking Properties. These
- * are available at http://www.unicode.org/reports/tr14/ and
- * http://www.unicode.org/reports/tr29/.
- * <p>
- * In addition to the C++ API defined in this header file, a
- * plain C API with equivalent functionality is defined in the
- * file ubrk.h
- * <p>
- * Code snippits illustrating the use of the Break Iterator APIs
- * are available in the ICU User Guide,
- * http://icu-project.org/userguide/boundaryAnalysis.html
- * and in the sample program icu/source/samples/break/break.cpp"
- *
- */
-class U_COMMON_API BreakIterator : public UObject {
-public:
- /**
- * destructor
- * @stable ICU 2.0
- */
- virtual ~BreakIterator();
-
- /**
- * Return true if another object is semantically equal to this
- * one. The other object should be an instance of the same subclass of
- * BreakIterator. Objects of different subclasses are considered
- * unequal.
- * <P>
- * Return true if this BreakIterator is at the same position in the
- * same text, and is the same class and type (word, line, etc.) of
- * BreakIterator, as the argument. Text is considered the same if
- * it contains the same characters, it need not be the same
- * object, and styles are not considered.
- * @stable ICU 2.0
- */
- virtual UBool operator==(const BreakIterator&) const = 0;
-
- /**
- * Returns the complement of the result of operator==
- * @param rhs The BreakIterator to be compared for inequality
- * @return the complement of the result of operator==
- * @stable ICU 2.0
- */
- UBool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); }
-
- /**
- * Return a polymorphic copy of this object. This is an abstract
- * method which subclasses implement.
- * @stable ICU 2.0
- */
- virtual BreakIterator* clone(void) const = 0;
-
- /**
- * Return a polymorphic class ID for this object. Different subclasses
- * will return distinct unequal values.
- * @stable ICU 2.0
- */
- virtual UClassID getDynamicClassID(void) const = 0;
-
- /**
- * Return a CharacterIterator over the text being analyzed.
- * @stable ICU 2.0
- */
- virtual CharacterIterator& getText(void) const = 0;
-
-
- /**
- * Get a UText for the text being analyzed.
- * The returned UText is a shallow clone of the UText used internally
- * by the break iterator implementation. It can safely be used to
- * access the text without impacting any break iterator operations,
- * but the underlying text itself must not be altered.
- *
- * @param fillIn A UText to be filled in. If NULL, a new UText will be
- * allocated to hold the result.
- * @param status receives any error codes.
- * @return The current UText for this break iterator. If an input
- * UText was provided, it will always be returned.
- * @stable ICU 3.4
- */
- virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0;
-
- /**
- * Change the text over which this operates. The text boundary is
- * reset to the start.
- * @param text The UnicodeString used to change the text.
- * @stable ICU 2.0
- */
- virtual void setText(const UnicodeString &text) = 0;
-
- /**
- * Reset the break iterator to operate over the text represented by
- * the UText. The iterator position is reset to the start.
- *
- * This function makes a shallow clone of the supplied UText. This means
- * that the caller is free to immediately close or otherwise reuse the
- * Utext that was passed as a parameter, but that the underlying text itself
- * must not be altered while being referenced by the break iterator.
- *
- * @param text The UText used to change the text.
- * @param status receives any error codes.
- * @stable ICU 3.4
- */
- virtual void setText(UText *text, UErrorCode &status) = 0;
-
- /**
- * Change the text over which this operates. The text boundary is
- * reset to the start.
- * Note that setText(UText *) provides similar functionality to this function,
- * and is more efficient.
- * @param it The CharacterIterator used to change the text.
- * @stable ICU 2.0
- */
- virtual void adoptText(CharacterIterator* it) = 0;
-
- enum {
- /**
- * DONE is returned by previous() and next() after all valid
- * boundaries have been returned.
- * @stable ICU 2.0
- */
- DONE = (int32_t)-1
- };
-
- /**
- * Return the index of the first character in the text being scanned.
- * @stable ICU 2.0
- */
- virtual int32_t first(void) = 0;
-
- /**
- * Return the index immediately BEYOND the last character in the text being scanned.
- * @stable ICU 2.0
- */
- virtual int32_t last(void) = 0;
-
- /**
- * Return the boundary preceding the current boundary.
- * @return The character index of the previous text boundary or DONE if all
- * boundaries have been returned.
- * @stable ICU 2.0
- */
- virtual int32_t previous(void) = 0;
-
- /**
- * Return the boundary following the current boundary.
- * @return The character index of the next text boundary or DONE if all
- * boundaries have been returned.
- * @stable ICU 2.0
- */
- virtual int32_t next(void) = 0;
-
- /**
- * Return character index of the current interator position within the text.
- * @return The boundary most recently returned.
- * @stable ICU 2.0
- */
- virtual int32_t current(void) const = 0;
-
- /**
- * Return the first boundary following the specified offset.
- * The value returned is always greater than the offset or
- * the value BreakIterator.DONE
- * @param offset the offset to begin scanning.
- * @return The first boundary after the specified offset.
- * @stable ICU 2.0
- */
- virtual int32_t following(int32_t offset) = 0;
-
- /**
- * Return the first boundary preceding the specified offset.
- * The value returned is always smaller than the offset or
- * the value BreakIterator.DONE
- * @param offset the offset to begin scanning.
- * @return The first boundary before the specified offset.
- * @stable ICU 2.0
- */
- virtual int32_t preceding(int32_t offset) = 0;
-
- /**
- * Return true if the specfied position is a boundary position.
- * As a side effect, the current position of the iterator is set
- * to the first boundary position at or following the specified offset.
- * @param offset the offset to check.
- * @return True if "offset" is a boundary position.
- * @stable ICU 2.0
- */
- virtual UBool isBoundary(int32_t offset) = 0;
-
- /**
- * Return the nth boundary from the current boundary
- * @param n which boundary to return. A value of 0
- * does nothing. Negative values move to previous boundaries
- * and positive values move to later boundaries.
- * @return The index of the nth boundary from the current position, or
- * DONE if there are fewer than |n| boundaries in the specfied direction.
- * @stable ICU 2.0
- */
- virtual int32_t next(int32_t n) = 0;
-
- /**
- * Create BreakIterator for word-breaks using the given locale.
- * Returns an instance of a BreakIterator implementing word breaks.
- * WordBreak is useful for word selection (ex. double click)
- * @param where the locale.
- * @param status the error code
- * @return A BreakIterator for word-breaks. The UErrorCode& status
- * parameter is used to return status information to the user.
- * To check whether the construction succeeded or not, you should check
- * the value of U_SUCCESS(err). If you wish more detailed information, you
- * can check for informational error results which still indicate success.
- * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For
- * example, 'de_CH' was requested, but nothing was found there, so 'de' was
- * used. U_USING_DEFAULT_WARNING indicates that the default locale data was
- * used; neither the requested locale nor any of its fall back locales
- * could be found.
- * The caller owns the returned object and is responsible for deleting it.
- * @stable ICU 2.0
- */
- static BreakIterator* U_EXPORT2
- createWordInstance(const Locale& where, UErrorCode& status);
-
- /**
- * Create BreakIterator for line-breaks using specified locale.
- * Returns an instance of a BreakIterator implementing line breaks. Line
- * breaks are logically possible line breaks, actual line breaks are
- * usually determined based on display width.
- * LineBreak is useful for word wrapping text.
- * @param where the locale.
- * @param status The error code.
- * @return A BreakIterator for line-breaks. The UErrorCode& status
- * parameter is used to return status information to the user.
- * To check whether the construction succeeded or not, you should check
- * the value of U_SUCCESS(err). If you wish more detailed information, you
- * can check for informational error results which still indicate success.
- * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For
- * example, 'de_CH' was requested, but nothing was found there, so 'de' was
- * used. U_USING_DEFAULT_WARNING indicates that the default locale data was
- * used; neither the requested locale nor any of its fall back locales
- * could be found.
- * The caller owns the returned object and is responsible for deleting it.
- * @stable ICU 2.0
- */
- static BreakIterator* U_EXPORT2
- createLineInstance(const Locale& where, UErrorCode& status);
-
- /**
- * Create BreakIterator for character-breaks using specified locale
- * Returns an instance of a BreakIterator implementing character breaks.
- * Character breaks are boundaries of combining character sequences.
- * @param where the locale.
- * @param status The error code.
- * @return A BreakIterator for character-breaks. The UErrorCode& status
- * parameter is used to return status information to the user.
- * To check whether the construction succeeded or not, you should check
- * the value of U_SUCCESS(err). If you wish more detailed information, you
- * can check for informational error results which still indicate success.
- * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For
- * example, 'de_CH' was requested, but nothing was found there, so 'de' was
- * used. U_USING_DEFAULT_WARNING indicates that the default locale data was
- * used; neither the requested locale nor any of its fall back locales
- * could be found.
- * The caller owns the returned object and is responsible for deleting it.
- * @stable ICU 2.0
- */
- static BreakIterator* U_EXPORT2
- createCharacterInstance(const Locale& where, UErrorCode& status);
-
- /**
- * Create BreakIterator for sentence-breaks using specified locale
- * Returns an instance of a BreakIterator implementing sentence breaks.
- * @param where the locale.
- * @param status The error code.
- * @return A BreakIterator for sentence-breaks. The UErrorCode& status
- * parameter is used to return status information to the user.
- * To check whether the construction succeeded or not, you should check
- * the value of U_SUCCESS(err). If you wish more detailed information, you
- * can check for informational error results which still indicate success.
- * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For
- * example, 'de_CH' was requested, but nothing was found there, so 'de' was
- * used. U_USING_DEFAULT_WARNING indicates that the default locale data was
- * used; neither the requested locale nor any of its fall back locales
- * could be found.
- * The caller owns the returned object and is responsible for deleting it.
- * @stable ICU 2.0
- */
- static BreakIterator* U_EXPORT2
- createSentenceInstance(const Locale& where, UErrorCode& status);
-
- /**
- * Create BreakIterator for title-casing breaks using the specified locale
- * Returns an instance of a BreakIterator implementing title breaks.
- * The iterator returned locates title boundaries as described for
- * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration,
- * please use Word Boundary iterator.{@link #createWordInstance }
- *
- * @param where the locale.
- * @param status The error code.
- * @return A BreakIterator for title-breaks. The UErrorCode& status
- * parameter is used to return status information to the user.
- * To check whether the construction succeeded or not, you should check
- * the value of U_SUCCESS(err). If you wish more detailed information, you
- * can check for informational error results which still indicate success.
- * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For
- * example, 'de_CH' was requested, but nothing was found there, so 'de' was
- * used. U_USING_DEFAULT_WARNING indicates that the default locale data was
- * used; neither the requested locale nor any of its fall back locales
- * could be found.
- * The caller owns the returned object and is responsible for deleting it.
- * @stable ICU 2.1
- */
- static BreakIterator* U_EXPORT2
- createTitleInstance(const Locale& where, UErrorCode& status);
-
- /**
- * Get the set of Locales for which TextBoundaries are installed.
- * <p><b>Note:</b> this will not return locales added through the register
- * call. To see the registered locales too, use the getAvailableLocales
- * function that returns a StringEnumeration object </p>
- * @param count the output parameter of number of elements in the locale list
- * @return available locales
- * @stable ICU 2.0
- */
- static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
-
- /**
- * Get name of the object for the desired Locale, in the desired langauge.
- * @param objectLocale must be from getAvailableLocales.
- * @param displayLocale specifies the desired locale for output.
- * @param name the fill-in parameter of the return value
- * Uses best match.
- * @return user-displayable name
- * @stable ICU 2.0
- */
- static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
- const Locale& displayLocale,
- UnicodeString& name);
-
- /**
- * Get name of the object for the desired Locale, in the langauge of the
- * default locale.
- * @param objectLocale must be from getMatchingLocales
- * @param name the fill-in parameter of the return value
- * @return user-displayable name
- * @stable ICU 2.0
- */
- static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
- UnicodeString& name);
-
- /**
- * Thread safe client-buffer-based cloning operation
- * Do NOT call delete on a safeclone, since 'new' is not used to create it.
- * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated.
- * If buffer is not large enough, new memory will be allocated.
- * @param BufferSize reference to size of allocated space.
- * If BufferSize == 0, a sufficient size for use in cloning will
- * be returned ('pre-flighting')
- * If BufferSize is not enough for a stack-based safe clone,
- * new memory will be allocated.
- * @param status to indicate whether the operation went on smoothly or there were errors
- * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were
- * necessary.
- * @return pointer to the new clone
- *
- * @stable ICU 2.0
- */
- virtual BreakIterator * createBufferClone(void *stackBuffer,
- int32_t &BufferSize,
- UErrorCode &status) = 0;
-
- /**
- * Determine whether the BreakIterator was created in user memory by
- * createBufferClone(), and thus should not be deleted. Such objects
- * must be closed by an explicit call to the destructor (not delete).
- * @stable ICU 2.0
- */
- inline UBool isBufferClone(void);
-
-#if !UCONFIG_NO_SERVICE
- /**
- * Register a new break iterator of the indicated kind, to use in the given locale.
- * The break iterator will be adopted. Clones of the iterator will be returned
- * if a request for a break iterator of the given kind matches or falls back to
- * this locale.
- * @param toAdopt the BreakIterator instance to be adopted
- * @param locale the Locale for which this instance is to be registered
- * @param kind the type of iterator for which this instance is to be registered
- * @param status the in/out status code, no special meanings are assigned
- * @return a registry key that can be used to unregister this instance
- * @stable ICU 2.4
- */
- static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt,
- const Locale& locale,
- UBreakIteratorType kind,
- UErrorCode& status);
-
- /**
- * Unregister a previously-registered BreakIterator using the key returned from the
- * register call. Key becomes invalid after a successful call and should not be used again.
- * The BreakIterator corresponding to the key will be deleted.
- * @param key the registry key returned by a previous call to registerInstance
- * @param status the in/out status code, no special meanings are assigned
- * @return TRUE if the iterator for the key was successfully unregistered
- * @stable ICU 2.4
- */
- static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status);
-
- /**
- * Return a StringEnumeration over the locales available at the time of the call,
- * including registered locales.
- * @return a StringEnumeration over the locales available at the time of the call
- * @stable ICU 2.4
- */
- static StringEnumeration* U_EXPORT2 getAvailableLocales(void);
-#endif
-
- /**
- * Returns the locale for this break iterator. Two flavors are available: valid and
- * actual locale.
- * @stable ICU 2.8
- */
- Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
-
- /** Get the locale for this break iterator object. You can choose between valid and actual locale.
- * @param type type of the locale we're looking for (valid or actual)
- * @param status error code for the operation
- * @return the locale
- * @internal
- */
- const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const;
-
- private:
- static BreakIterator* buildInstance(const Locale& loc, const char *type, int32_t kind, UErrorCode& status);
- static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status);
- static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status);
-
- friend class ICUBreakIteratorFactory;
- friend class ICUBreakIteratorService;
-
-protected:
- /** @internal */
- BreakIterator();
- /** @internal */
- UBool fBufferClone;
- /** @internal */
- BreakIterator (const BreakIterator &other) : UObject(other), fBufferClone(FALSE) {}
-
-private:
-
- /** @internal */
- char actualLocale[ULOC_FULLNAME_CAPACITY];
- char validLocale[ULOC_FULLNAME_CAPACITY];
-
- /**
- * The assignment operator has no real implementation.
- * It's provided to make the compiler happy. Do not call.
- */
- BreakIterator& operator=(const BreakIterator&);
-};
-
-inline UBool BreakIterator::isBufferClone()
-{
- return fBufferClone;
-}
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-
-#endif // _BRKITER
-//eof
-
View
201 jni/EastAsianWidth/unicode/caniter.h
@@ -1,201 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (C) 1996-2006, International Business Machines Corporation and *
- * others. All Rights Reserved. *
- *******************************************************************************
- */
-
-#ifndef CANITER_H
-#define CANITER_H
-
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_NORMALIZATION
-
-#include "unicode/uobject.h"
-#include "unicode/unistr.h"
-
-/**
- * \file
- * \brief C++ API: Canonical Iterator
- */
-
-/** Should permutation skip characters with combining class zero
- * Should be either TRUE or FALSE. This is a compile time option
- * @stable ICU 2.4
- */
-#ifndef CANITER_SKIP_ZEROES
-#define CANITER_SKIP_ZEROES TRUE
-#endif
-
-U_NAMESPACE_BEGIN
-
-class Hashtable;
-
-/**
- * This class allows one to iterate through all the strings that are canonically equivalent to a given
- * string. For example, here are some sample results:
-Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
-1: \\u0041\\u030A\\u0064\\u0307\\u0327
- = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
-2: \\u0041\\u030A\\u0064\\u0327\\u0307
- = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE}
-3: \\u0041\\u030A\\u1E0B\\u0327
- = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA}
-4: \\u0041\\u030A\\u1E11\\u0307
- = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE}
-5: \\u00C5\\u0064\\u0307\\u0327
- = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
-6: \\u00C5\\u0064\\u0327\\u0307
- = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE}
-7: \\u00C5\\u1E0B\\u0327
- = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA}
-8: \\u00C5\\u1E11\\u0307
- = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE}
-9: \\u212B\\u0064\\u0307\\u0327
- = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
-10: \\u212B\\u0064\\u0327\\u0307
- = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE}
-11: \\u212B\\u1E0B\\u0327
- = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA}
-12: \\u212B\\u1E11\\u0307
- = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE}
- *<br>Note: the code is intended for use with small strings, and is not suitable for larger ones,
- * since it has not been optimized for that situation.
- * Note, CanonicalIterator is not intended to be subclassed.
- * @author M. Davis
- * @author C++ port by V. Weinstein
- * @stable ICU 2.4
- */
-class U_COMMON_API CanonicalIterator : public UObject {
-public:
- /**
- * Construct a CanonicalIterator object
- * @param source string to get results for
- * @param status Fill-in parameter which receives the status of this operation.
- * @stable ICU 2.4
- */
- CanonicalIterator(const UnicodeString &source, UErrorCode &status);
-
- /** Destructor
- * Cleans pieces
- * @stable ICU 2.4
- */
- virtual ~CanonicalIterator();
-
- /**
- * Gets the NFD form of the current source we are iterating over.
- * @return gets the source: NOTE: it is the NFD form of source
- * @stable ICU 2.4
- */
- UnicodeString getSource();
-
- /**
- * Resets the iterator so that one can start again from the beginning.
- * @stable ICU 2.4
- */
- void reset();
-
- /**
- * Get the next canonically equivalent string.
- * <br><b>Warning: The strings are not guaranteed to be in any particular order.</b>
- * @return the next string that is canonically equivalent. A bogus string is returned when
- * the iteration is done.
- * @stable ICU 2.4
- */
- UnicodeString next();
-
- /**
- * Set a new source for this iterator. Allows object reuse.
- * @param newSource the source string to iterate against. This allows the same iterator to be used
- * while changing the source string, saving object creation.
- * @param status Fill-in parameter which receives the status of this operation.
- * @stable ICU 2.4
- */
- void setSource(const UnicodeString &newSource, UErrorCode &status);
-
- /**
- * Dumb recursive implementation of permutation.
- * TODO: optimize
- * @param source the string to find permutations for
- * @param skipZeros determine if skip zeros
- * @param result the results in a set.
- * @param status Fill-in parameter which receives the status of this operation.
- * @internal
- */
- static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);
-
- /**
- * ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @stable ICU 2.2
- */
- static UClassID U_EXPORT2 getStaticClassID();
-
- /**
- * ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @stable ICU 2.2
- */
- virtual UClassID getDynamicClassID() const;
-
-private:
- // ===================== PRIVATES ==============================
- // private default constructor
- CanonicalIterator();
-
-
- /**
- * Copy constructor. Private for now.
- * @internal
- */
- CanonicalIterator(const CanonicalIterator& other);
-
- /**
- * Assignment operator. Private for now.
- * @internal
- */
- CanonicalIterator& operator=(const CanonicalIterator& other);
-
- // fields
- UnicodeString source;
- UBool done;
-
- // 2 dimensional array holds the pieces of the string with
- // their different canonically equivalent representations
- UnicodeString **pieces;
- int32_t pieces_length;
- int32_t *pieces_lengths;
-
- // current is used in iterating to combine pieces
- int32_t *current;
- int32_t current_length;
-
- // transient fields
- UnicodeString buffer;
-
- // we have a segment, in NFD. Find all the strings that are canonically equivalent to it.
- UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment)
-
- //Set getEquivalents2(String segment);
- Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status);
- //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status);
-
- /**
- * See if the decomposition of cp2 is at segment starting at segmentPos
- * (with canonical rearrangment!)
- * If so, take the remainder, and return the equivalents
- */
- //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer);
- Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
- //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
-
- void cleanPieces();
-
-};
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_NORMALIZATION */
-
-#endif
View
716 jni/EastAsianWidth/unicode/chariter.h
@@ -1,716 +0,0 @@
-/*
-********************************************************************
-*
-* Copyright (C) 1997-2005, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-********************************************************************
-*/
-
-#ifndef CHARITER_H
-#define CHARITER_H
-
-#include "unicode/utypes.h"
-#include "unicode/uobject.h"
-#include "unicode/unistr.h"
-/**
- * \file
- * \brief C++ API: Character Iterator
- */
-
-U_NAMESPACE_BEGIN
-/**
- * Abstract class that defines an API for forward-only iteration
- * on text objects.
- * This is a minimal interface for iteration without random access
- * or backwards iteration. It is especially useful for wrapping
- * streams with converters into an object for collation or
- * normalization.
- *
- * <p>Characters can be accessed in two ways: as code units or as
- * code points.
- * Unicode code points are 21-bit integers and are the scalar values
- * of Unicode characters. ICU uses the type UChar32 for them.
- * Unicode code units are the storage units of a given
- * Unicode/UCS Transformation Format (a character encoding scheme).
- * With UTF-16, all code points can be represented with either one
- * or two code units ("surrogates").
- * String storage is typically based on code units, while properties
- * of characters are typically determined using code point values.
- * Some processes may be designed to work with sequences of code units,
- * or it may be known that all characters that are important to an
- * algorithm can be represented with single code units.
- * Other processes will need to use the code point access functions.</p>
- *
- * <p>ForwardCharacterIterator provides nextPostInc() to access
- * a code unit and advance an internal position into the text object,
- * similar to a <code>return text[position++]</code>.<br>
- * It provides next32PostInc() to access a code point and advance an internal
- * position.</p>
- *
- * <p>next32PostInc() assumes that the current position is that of
- * the beginning of a code point, i.e., of its first code unit.
- * After next32PostInc(), this will be true again.
- * In general, access to code units and code points in the same
- * iteration loop should not be mixed. In UTF-16, if the current position
- * is on a second code unit (Low Surrogate), then only that code unit
- * is returned even by next32PostInc().</p>
- *
- * <p>For iteration with either function, there are two ways to
- * check for the end of the iteration. When there are no more
- * characters in the text object:
- * <ul>
- * <li>The hasNext() function returns FALSE.</li>
- * <li>nextPostInc() and next32PostInc() return DONE
- * when one attempts to read beyond the end of the text object.</li>
- * </ul>
- *
- * Example:
- * \code
- * void function1(ForwardCharacterIterator &it) {
- * UChar32 c;
- * while(it.hasNext()) {
- * c=it.next32PostInc();
- * // use c
- * }
- * }
- *
- * void function1(ForwardCharacterIterator &it) {
- * UChar c;
- * while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) {
- * // use c
- * }
- * }
- * \endcode
- * </p>
- *
- * @stable ICU 2.0
- */
-class U_COMMON_API ForwardCharacterIterator : public UObject {
-public:
- /**
- * Value returned by most of ForwardCharacterIterator's functions
- * when the iterator has reached the limits of its iteration.
- * @stable ICU 2.0
- */
- enum { DONE = 0xffff };
-
- /**
- * Destructor.
- * @stable ICU 2.0
- */
- virtual ~ForwardCharacterIterator();
-
- /**
- * Returns true when both iterators refer to the same
- * character in the same character-storage object.
- * @param that The ForwardCharacterIterator to be compared for equality
- * @return true when both iterators refer to the same
- * character in the same character-storage object
- * @stable ICU 2.0
- */
- virtual UBool operator==(const ForwardCharacterIterator& that) const = 0;
-
- /**
- * Returns true when the iterators refer to different
- * text-storage objects, or to different characters in the
- * same text-storage object.
- * @param that The ForwardCharacterIterator to be compared for inequality
- * @return true when the iterators refer to different
- * text-storage objects, or to different characters in the
- * same text-storage object
- * @stable ICU 2.0
- */
- inline UBool operator!=(const ForwardCharacterIterator& that) const;
-
- /**
- * Generates a hash code for this iterator.
- * @return the hash code.
- * @stable ICU 2.0
- */
- virtual int32_t hashCode(void) const = 0;
-
- /**
- * Returns a UClassID for this ForwardCharacterIterator ("poor man's
- * RTTI").<P> Despite the fact that this function is public,
- * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!
- * @return a UClassID for this ForwardCharacterIterator
- * @stable ICU 2.0
- */
- virtual UClassID getDynamicClassID(void) const = 0;
-
- /**
- * Gets the current code unit for returning and advances to the next code unit
- * in the iteration range
- * (toward endIndex()). If there are
- * no more code units to return, returns DONE.
- * @return the current code unit.
- * @stable ICU 2.0
- */
- virtual UChar nextPostInc(void) = 0;
-
- /**
- * Gets the current code point for returning and advances to the next code point
- * in the iteration range
- * (toward endIndex()). If there are
- * no more code points to return, returns DONE.
- * @return the current code point.
- * @stable ICU 2.0
- */
- virtual UChar32 next32PostInc(void) = 0;
-
- /**
- * Returns FALSE if there are no more code units or code points
- * at or after the current position in the iteration range.
- * This is used with nextPostInc() or next32PostInc() in forward
- * iteration.
- * @returns FALSE if there are no more code units or code points
- * at or after the current position in the iteration range.
- * @stable ICU 2.0
- */
- virtual UBool hasNext() = 0;
-
-protected:
- /** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/
- ForwardCharacterIterator();
-
- /** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/
- ForwardCharacterIterator(const ForwardCharacterIterator &other);
-
- /**
- * Assignment operator to be overridden in the implementing class.
- * @stable ICU 2.0
- */
- ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; }
-};
-
-/**
- * Abstract class that defines an API for iteration
- * on text objects.
- * This is an interface for forward and backward iteration
- * and random access into a text object.
- *
- * <p>The API provides backward compatibility to the Java and older ICU
- * CharacterIterator classes but extends them significantly:
- * <ol>
- * <li>CharacterIterator is now a subclass of ForwardCharacterIterator.</li>
- * <li>While the old API functions provided forward iteration with
- * "pre-increment" semantics, the new one also provides functions
- * with "post-increment" semantics. They are more efficient and should
- * be the preferred iterator functions for new implementations.
- * The backward iteration always had "pre-decrement" semantics, which
- * are efficient.</li>
- * <li>Just like ForwardCharacterIterator, it provides access to
- * both code units and code points. Code point access versions are available
- * for the old and the new iteration semantics.</li>
- * <li>There are new functions for setting and moving the current position
- * without returning a character, for efficiency.</li>
- * </ol>
- *
- * See ForwardCharacterIterator for examples for using the new forward iteration
- * functions. For backward iteration, there is also a hasPrevious() function
- * that can be used analogously to hasNext().
- * The old functions work as before and are shown below.</p>
- *
- * <p>Examples for some of the new functions:</p>
- *
- * Forward iteration with hasNext():
- * \code
- * void forward1(CharacterIterator &it) {
- * UChar32 c;
- * for(it.setToStart(); it.hasNext();) {
- * c=it.next32PostInc();
- * // use c
- * }
- * }
- * \endcode
- * Forward iteration more similar to loops with the old forward iteration,
- * showing a way to convert simple for() loops:
- * \code
- * void forward2(CharacterIterator &it) {
- * UChar c;
- * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) {
- * // use c
- * }
- * }
- * \endcode
- * Backward iteration with setToEnd() and hasPrevious():
- * \code
- * void backward1(CharacterIterator &it) {
- * UChar32 c;
- * for(it.setToEnd(); it.hasPrevious();) {
- * c=it.previous32();
- * // use c
- * }
- * }
- * \endcode
- * Backward iteration with a more traditional for() loop:
- * \code
- * void backward2(CharacterIterator &it) {
- * UChar c;
- * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) {
- * // use c
- * }
- * }
- * \endcode
- *
- * Example for random access:
- * \code
- * void random(CharacterIterator &it) {
- * // set to the third code point from the beginning
- * it.move32(3, CharacterIterator::kStart);
- * // get a code point from here without moving the position
- * UChar32 c=it.current32();
- * // get the position
- * int32_t pos=it.getIndex();
- * // get the previous code unit
- * UChar u=it.previous();
- * // move back one more code unit
- * it.move(-1, CharacterIterator::kCurrent);
- * // set the position back to where it was
- * // and read the same code point c and move beyond it
- * it.setIndex(pos);
- * if(c!=it.next32PostInc()) {
- * exit(1); // CharacterIterator inconsistent
- * }
- * }
- * \endcode
- *
- * <p>Examples, especially for the old API:</p>
- *
- * Function processing characters, in this example simple output
- * <pre>
- * \code
- * void processChar( UChar c )
- * {
- * cout << " " << c;
- * }
- * \endcode
- * </pre>
- * Traverse the text from start to finish
- * <pre>
- * \code
- * void traverseForward(CharacterIterator& iter)
- * {
- * for(UChar c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
- * processChar(c);
- * }
- * }
- * \endcode
- * </pre>
- * Traverse the text backwards, from end to start
- * <pre>
- * \code
- * void traverseBackward(CharacterIterator& iter)
- * {
- * for(UChar c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
- * processChar(c);
- * }
- * }
- * \endcode
- * </pre>
- * Traverse both forward and backward from a given position in the text.
- * Calls to notBoundary() in this example represents some additional stopping criteria.
- * <pre>
- * \code
- * void traverseOut(CharacterIterator& iter, int32_t pos)
- * {
- * UChar c;
- * for (c = iter.setIndex(pos);
- * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
- * c = iter.next()) {}
- * int32_t end = iter.getIndex();
- * for (c = iter.setIndex(pos);
- * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
- * c = iter.previous()) {}
- * int32_t start = iter.getIndex() + 1;
- *
- * cout << "start: " << start << " end: " << end << endl;
- * for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) {
- * processChar(c);
- * }
- * }
- * \endcode
- * </pre>
- * Creating a StringCharacterIterator and calling the test functions
- * <pre>
- * \code
- * void CharacterIterator_Example( void )
- * {
- * cout << endl << "===== CharacterIterator_Example: =====" << endl;
- * UnicodeString text("Ein kleiner Satz.");
- * StringCharacterIterator iterator(text);
- * cout << "----- traverseForward: -----------" << endl;
- * traverseForward( iterator );
- * cout << endl << endl << "----- traverseBackward: ----------" << endl;
- * traverseBackward( iterator );
- * cout << endl << endl << "----- traverseOut: ---------------" << endl;
- * traverseOut( iterator, 7 );
- * cout << endl << endl << "-----" << endl;
- * }
- * \endcode
- * </pre>
- *
- * @stable ICU 2.0
- */
-class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
-public:
- /**
- * Origin enumeration for the move() and move32() functions.
- * @stable ICU 2.0
- */
- enum EOrigin { kStart, kCurrent, kEnd };
-
- /**
- * Returns a pointer to a new CharacterIterator of the same
- * concrete class as this one, and referring to the same
- * character in the same text-storage object as this one. The
- * caller is responsible for deleting the new clone.
- * @return a pointer to a new CharacterIterator
- * @stable ICU 2.0
- */
- virtual CharacterIterator* clone(void) const = 0;
-
- /**
- * Sets the iterator to refer to the first code unit in its
- * iteration range, and returns that code unit.
- * This can be used to begin an iteration with next().
- * @return the first code unit in its iteration range.
- * @stable ICU 2.0
- */
- virtual UChar first(void) = 0;
-
- /**
- * Sets the iterator to refer to the first code unit in its
- * iteration range, returns that code unit, and moves the position
- * to the second code unit. This is an alternative to setToStart()
- * for forward iteration with nextPostInc().
- * @return the first code unit in its iteration range.
- * @stable ICU 2.0
- */
- virtual UChar firstPostInc(void);
-
- /**
- * Sets the iterator to refer to the first code point in its
- * iteration range, and returns that code unit,
- * This can be used to begin an iteration with next32().
- * Note that an iteration with next32PostInc(), beginning with,
- * e.g., setToStart() or firstPostInc(), is more efficient.
- * @return the first code point in its iteration range.
- * @stable ICU 2.0
- */
- virtual UChar32 first32(void) = 0;
-
- /**
- * Sets the iterator to refer to the first code point in its
- * iteration range, returns that code point, and moves the position
- * to the second code point. This is an alternative to setToStart()
- * for forward iteration with next32PostInc().
- * @return the first code point in its iteration range.
- * @stable ICU 2.0
- */
- virtual UChar32 first32PostInc(void);
-
- /**
- * Sets the iterator to refer to the first code unit or code point in its
- * iteration range. This can be used to begin a forward
- * iteration with nextPostInc() or next32PostInc().
- * @return the start position of the iteration range
- * @stable ICU 2.0
- */
- inline int32_t setToStart();
-
- /**
- * Sets the iterator to refer to the last code unit in its
- * iteration range, and returns that code unit.
- * This can be used to begin an iteration with previous().
- * @return the last code unit.
- * @stable ICU 2.0
- */
- virtual UChar last(void) = 0;
-
- /**
- * Sets the iterator to refer to the last code point in its
- * iteration range, and returns that code unit.
- * This can be used to begin an iteration with previous32().
- * @return the last code point.
- * @stable ICU 2.0
- */
- virtual UChar32 last32(void) = 0;
-
- /**
- * Sets the iterator to the end of its iteration range, just behind
- * the last code unit or code point. This can be used to begin a backward
- * iteration with previous() or previous32().
- * @return the end position of the iteration range
- * @stable ICU 2.0
- */
- inline int32_t setToEnd();
-
- /**
- * Sets the iterator to refer to the "position"-th code unit
- * in the text-storage object the iterator refers to, and
- * returns that code unit.
- * @param position the "position"-th code unit in the text-storage object
- * @return the "position"-th code unit.
- * @stable ICU 2.0
- */
- virtual UChar setIndex(int32_t position) = 0;
-
- /**
- * Sets the iterator to refer to the beginning of the code point
- * that contains the "position"-th code unit
- * in the text-storage object the iterator refers to, and
- * returns that code point.
- * The current position is adjusted to the beginning of the code point
- * (its first code unit).
- * @param position the "position"-th code unit in the text-storage object
- * @return the "position"-th code point.
- * @stable ICU 2.0
- */
- virtual UChar32 setIndex32(int32_t position) = 0;
-
- /**
- * Returns the code unit the iterator currently refers to.
- * @return the current code unit.
- * @stable ICU 2.0
- */
- virtual UChar current(void) const = 0;
-
- /**
- * Returns the code point the iterator currently refers to.
- * @return the current code point.
- * @stable ICU 2.0
- */
- virtual UChar32 current32(void) const = 0;
-
- /**
- * Advances to the next code unit in the iteration range
- * (toward endIndex()), and returns that code unit. If there are
- * no more code units to return, returns DONE.
- * @return the next code unit.
- * @stable ICU 2.0
- */
- virtual UChar next(void) = 0;
-
- /**
- * Advances to the next code point in the iteration range
- * (toward endIndex()), and returns that code point. If there are
- * no more code points to return, returns DONE.
- * Note that iteration with "pre-increment" semantics is less
- * efficient than iteration with "post-increment" semantics
- * that is provided by next32PostInc().
- * @return the next code point.
- * @stable ICU 2.0
- */
- virtual UChar32 next32(void) = 0;
-
- /**
- * Advances to the previous code unit in the iteration range
- * (toward startIndex()), and returns that code unit. If there are
- * no more code units to return, returns DONE.
- * @return the previous code unit.
- * @stable ICU 2.0
- */
- virtual UChar previous(void) = 0;
-
- /**
- * Advances to the previous code point in the iteration range
- * (toward startIndex()), and returns that code point. If there are
- * no more code points to return, returns DONE.
- * @return the previous code point.
- * @stable ICU 2.0
- */
- virtual UChar32 previous32(void) = 0;
-
- /**
- * Returns FALSE if there are no more code units or code points
- * before the current position in the iteration range.
- * This is used with previous() or previous32() in backward
- * iteration.
- * @return FALSE if there are no more code units or code points
- * before the current position in the iteration range, return TRUE otherwise.
- * @stable ICU 2.0
- */
- virtual UBool hasPrevious() = 0;
-
- /**
- * Returns the numeric index in the underlying text-storage
- * object of the character returned by first(). Since it's
- * possible to create an iterator that iterates across only
- * part of a text-storage object, this number isn't
- * necessarily 0.
- * @returns the numeric index in the underlying text-storage
- * object of the character returned by first().
- * @stable ICU 2.0
- */
- inline int32_t startIndex(void) const;
-
- /**
- * Returns the numeric index in the underlying text-storage
- * object of the position immediately BEYOND the character
- * returned by last().
- * @return the numeric index in the underlying text-storage
- * object of the position immediately BEYOND the character
- * returned by last().
- * @stable ICU 2.0
- */
- inline int32_t endIndex(void) const;
-
- /**
- * Returns the numeric index in the underlying text-storage
- * object of the character the iterator currently refers to
- * (i.e., the character returned by current()).
- * @return the numberic index in the text-storage object of
- * the character the iterator currently refers to
- * @stable ICU 2.0
- */
- inline int32_t getIndex(void) const;
-
- /**
- * Returns the length of the entire text in the underlying
- * text-storage object.
- * @return the length of the entire text in the text-storage object
- * @stable ICU 2.0
- */
- inline int32_t getLength() const;
-
- /**
- * Moves the current position relative to the start or end of the
- * iteration range, or relative to the current position itself.
- * The movement is expressed in numbers of code units forward
- * or backward by specifying a positive or negative delta.
- * @param delta the position relative to origin. A positive delta means forward;
- * a negative delta means backward.
- * @param origin Origin enumeration {kStart, kCurrent, kEnd}
- * @return the new position
- * @stable ICU 2.0
- */
- virtual int32_t move(int32_t delta, EOrigin origin) = 0;
-
- /**
- * Moves the current position relative to the start or end of the
- * iteration range, or relative to the current position itself.
- * The movement is expressed in numbers of code points forward
- * or backward by specifying a positive or negative delta.
- * @param delta the position relative to origin. A positive delta means forward;
- * a negative delta means backward.
- * @param origin Origin enumeration {kStart, kCurrent, kEnd}
- * @return the new position
- * @stable ICU 2.0
- */
- virtual int32_t move32(int32_t delta, EOrigin origin) = 0;
-
- /**
- * Copies the text under iteration into the UnicodeString
- * referred to by "result".
- * @param result Receives a copy of the text under iteration.
- * @stable ICU 2.0
- */
- virtual void getText(UnicodeString& result) = 0;
-
-protected:
- /**
- * Empty constructor.
- * @stable ICU 2.0
- */
- CharacterIterator();
-
- /**
- * Constructor, just setting the length field in this base class.
- * @stable ICU 2.0
- */
- CharacterIterator(int32_t length);
-
- /**
- * Constructor, just setting the length and position fields in this base class.
- * @stable ICU 2.0
- */
- CharacterIterator(int32_t length, int32_t position);
-
- /**
- * Constructor, just setting the length, start, end, and position fields in this base class.
- * @stable ICU 2.0
- */
- CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position);
-
- /**
- * Copy constructor.
- *
- * @param that The CharacterIterator to be copied
- * @stable ICU 2.0
- */
- CharacterIterator(const CharacterIterator &that);
-
- /**
- * Assignment operator. Sets this CharacterIterator to have the same behavior,
- * as the one passed in.
- * @param that The CharacterIterator passed in.
- * @return the newly set CharacterIterator.
- * @stable ICU 2.0
- */
- CharacterIterator &operator=(const CharacterIterator &that);
-
- /**
- * Base class text length field.
- * Necessary this for correct getText() and hashCode().
- * @stable ICU 2.0
- */
- int32_t textLength;
-
- /**
- * Base class field for the current position.
- * @stable ICU 2.0
- */
- int32_t pos;
-
- /**
- * Base class field for the start of the iteration range.
- * @stable ICU 2.0
- */
- int32_t begin;
-
- /**
- * Base class field for the end of the iteration range.
- * @stable ICU 2.0
- */
- int32_t end;
-};
-
-inline UBool
-ForwardCharacterIterator::operator!=(const ForwardCharacterIterator& that) const {
- return !operator==(that);
-}
-
-inline int32_t
-CharacterIterator::setToStart() {
- return move(0, kStart);
-}
-
-inline int32_t
-CharacterIterator::setToEnd() {
- return move(0, kEnd);
-}
-
-inline int32_t
-CharacterIterator::startIndex(void) const {
- return begin;
-}
-
-inline int32_t
-CharacterIterator::endIndex(void) const {
- return end;
-}
-
-inline int32_t
-CharacterIterator::getIndex(void) const {
- return pos;
-}
-
-inline int32_t
-CharacterIterator::getLength(void) const {
- return textLength;
-}
-
-U_NAMESPACE_END
-#endif
View
41 jni/EastAsianWidth/unicode/dbbi.h
@@ -1,41 +0,0 @@
-/*
-**********************************************************************
-* Copyright (C) 1999-2006 IBM Corp. All rights reserved.
-**********************************************************************
-* Date Name Description
-* 12/1/99 rgillam Complete port from Java.
-* 01/13/2000 helena Added UErrorCode to ctors.
-**********************************************************************
-*/
-
-#ifndef DBBI_H
-#define DBBI_H
-
-#include "unicode/rbbi.h"
-
-#if !UCONFIG_NO_BREAK_ITERATION
-
-/**
- * \file
- * \brief C++ API: Dictionary Based Break Iterator
- */
-
-U_NAMESPACE_BEGIN
-
-/**
- * An obsolete subclass of RuleBasedBreakIterator. Handling of dictionary-
- * based break iteration has been folded into the base class. This class
- * is deprecated as of ICU 3.6.
- */
-
-#ifndef U_HIDE_DEPRECATED_API
-
-typedef RuleBasedBreakIterator DictionaryBasedBreakIterator;
-
-#endif
-
-U_NAMESPACE_END
-
-#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-
-#endif
View
202 jni/EastAsianWidth/unicode/docmain.h
@@ -1,202 +0,0 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 1997-2007, International Business Machines Corporation and
- * others. All Rights Reserved.
- *
- * FILE NAME: DOCMAIN.h
- *
- * Date Name Description
- * 12/11/2000 Ram Creation.
- */
-
-/* This file contains documentation for Doxygen and doesnot have
- * any significance with respect to C or C++ API
- */
-
-/*! \mainpage
- *
- * \section API API Reference Usage
- *
- * <h3>C++ Programmers:</h3>
- * <p>Use <a href="hierarchy.html">Class Hierarchy</a> or <a href="classes.html"> Alphabetical List </a>
- * or <a href="annotated.html"> Compound List</a>
- * to find the class you are interested in. For example, to find BreakIterator,
- * you can go to the <a href="classes.html"> Alphabetical List</a>, then click on
- * "BreakIterator". Once you are at the class, you will find an inheritance
- * chart, a list of the public members, a detailed description of the class,
- * then detailed member descriptions.</p>
- *
- * <h3>C Programmers:</h3>
- * <p>Use <a href="#Module">Module List</a> or <a href="globals.html">File Members</a>
- * to find a list of all the functions and constants.
- * For example, to find BreakIterator functions you would click on
- * <a href="files.html"> File List</a>,
- * then find "ubrk.h" and click on it. You will find descriptions of Defines,
- * Typedefs, Enumerations, and Functions, with detailed descriptions below.
- * If you want to find a specific function, such as ubrk_next(), then click
- * first on <a href="globals.html"> File Members</a>, then use your browser
- * Find dialog to search for "ubrk_next()".</p>
- *
- *
- * <h3>API References for Previous Releases</h3>
- * <p>The API References for each release of ICU are also available as
- * a zip file from the ICU
- * <a href="http://icu-project.org/download/">download page</a>.</p>
- *
- * <hr>
- *
- * <h2>Architecture (User's Guide)</h2>
- * <ul>
- * <li><a href="http://icu-project.org/userguide/">Introduction</a></li>
- * <li><a href="http://icu-project.org/userguide/i18n.html">Internationalization</a></li>
- * <li><a href="http://icu-project.org/userguide/design.html">Locale Model</a></li>
- * <li><a href="http://icu-project.org/userguide/design.html">Multithreading</a></li>
- * <li><a href="http://icu-project.org/userguide/conversion.html">Conversion</a></li>
- * <li><a href="http://icu-project.org/userguide/design.html">Error Handling</a></li>
- * </ul>
- *
- * <hr>
- *\htmlonly <h2><a NAME="Module">Module List</a></h2> \endhtmlonly
- * <table border="1" cols="3" align="center">
- * <tr>
- * <td><strong>Module Name</strong></td>
- * <td><strong>C</strong></td>
- * <td><strong>C++</strong></td>
- * </tr>
- * <tr>
- * <td>Basic Types and Constants</td>
- * <td>utypes.h</td>
- * <td>utypes.h</td>
- * </tr>
- * <tr>
- * <td>Strings and Character Iteration</td>
- * <td>ustring.h, utf.h</td>
- * <td>UnicodeString, CharacterIterator</td>
- * </tr>
- * <tr>
- * <td>Unicode Character<br>Properties and Names</td>
- * <td>uchar.h</td>
- * <td>uchar.h C API</td>
- * </tr>
- * <tr>
- * <td>Codepage Conversion</td>
- * <td>ucnv.h</td>
- * <td>ucnv.h C API</td>
- * </tr>
- * <tr>
- * <td>Unicode Text Compression</td>
- * <td>ucnv.h <br> (encoding name "SCSU" or "BOCU-1")</td>
- * <td>ucnv.h C API</td>
- * </tr>
- * <tr>
- * <td>Locales </td>
- * <td>uloc.h</a></td>
- * <td>Locale</td>
- * </tr>
- * <tr>
- * <td>Resource Bundles</td>
- * <td>ures.h</td>
- * <td>ResourceBundle</td>
- * </tr>
- * <tr>
- * <td>Normalization</td>
- * <td>unorm.h</td>
- * <td>Normalizer</td>
- * </tr>
- * <tr>
- * <td>Calendars</td>
- * <td>ucal.h</td>
- * <td>Calendar</td>
- * </tr>
- * <tr>
- * <td>Date and Time Formatting</td>
- * <td>udat.h</td>
- * <td>DateFormat</td>
- * </tr>
- * <tr>
- * <td>Message Formatting</td>
- * <td>umsg.h</td>
- * <td>MessageFormat</td>
- * </tr>
- * <tr>
- * <td>Number Formatting</td>
- * <td>unum.h</td>
- * <td>NumberFormat</td>
- * </tr>
- * <tr>
- * <td>Number Spellout <br> (Rule Based Number Formatting)</td>
- * <td>unum.h <br> (use UNUM_SPELLOUT)</td>
- * <td>RuleBasedNumberFormat</td>
- * </tr>
- * <tr>
- * <td>Text Transformation <br> (Transliteration)</td>
- * <td>utrans.h</td>
- * <td>Transliterator</td>
- * </tr>
- * <tr>
- * <td>Bidirectional Algorithm</td>
- * <td>ubidi.h</td>
- * <td>ubidi.h C API</td>
- * </tr>
- * <tr>
- * <td>Arabic Shaping</td>
- * <td>ushape.h</td>
- * <td>ushape.h C API</td>
- * </tr>
- * <tr>
- * <td>Collation</td>
- * <td>ucol.h</td>
- * <td>Collator</td>
- * </tr>
- * <tr>
- * <td>String Searching</td>
- * <td>usearch.h</td>
- * <td>StringSearch</td>
- * </tr>
- * <tr>
- * <td>Text Boundary Analysis <br> (Break Iteration)</td>
- * <td>ubrk.h</td>
- * <td>BreakIterator</td>
- * </tr>
- * <tr>
- * <td>Unicode Set</td>
- * <td>uset.h</td>
- * <td>UnicodeSet</td>
- * </tr>
- * <tr>
- * <td>Regular Expressions</td>
- * <td>uregex.h</td>
- * <td>RegexPattern, RegexMatcher</td>
- * </tr>
- * <tr>
- * <td>StringPrep</td>
- * <td>usprep.h</td>
- * <td>usprep.h C API</td>
- * </tr>
- * <tr>
- * <td>International Domain Names in Applications</td>
- * <td>uidna.h</td>
- * <td>uidna.h C API</td>
- * </tr>
- * <tr>
- * <td>Universal Time Scale</td>
- * <td>utmscale.h</td>
- * <td>utmscale.h C API</td>
- * </tr>
- * <tr>
- * <td>Basic Layout Engine Types and Constants</td>
- * <td>(no C API)</td>
- * <td>LETypes.h</td>
- * </tr>
- * <tr>
- * <td>Complex Text Layout</td>
- * <td>(no C API)</td>
- * <td>LayoutEngine, ParagraphLayout</td>
- * </tr>
- * <tr>
- * <td>ICU I/O</td>
- * <td>ustdio.h</td>
- * <td>ustream.h</td>
- * </tr>
- * </table>
- */
View
765 jni/EastAsianWidth/unicode/locid.h
@@ -1,765 +0,0 @@
-/*
-******************************************************************************
-*
-* Copyright (C) 1996-2006, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* File locid.h
-*
-* Created by: Helena Shih
-*
-* Modification History:
-*
-* Date Name Description
-* 02/11/97 aliu Changed gLocPath to fgLocPath and added methods to
-* get and set it.
-* 04/02/97 aliu Made operator!= inline; fixed return value of getName().
-* 04/15/97 aliu Cleanup for AIX/Win32.
-* 04/24/97 aliu Numerous changes per code review.
-* 08/18/98 stephen Added tokenizeString(),changed getDisplayName()
-* 09/08/98 stephen Moved definition of kEmptyString for Mac Port
-* 11/09/99 weiv Added const char * getName() const;
-* 04/12/00 srl removing unicodestring api's and cached hash code
-* 08/10/01 grhoten Change the static Locales to accessor functions
-******************************************************************************
-*/
-
-#ifndef LOCID_H
-#define LOCID_H
-
-#include "unicode/utypes.h"
-#include "unicode/uobject.h"
-#include "unicode/unistr.h"
-#include "unicode/putil.h"
-#include "unicode/uloc.h"
-#include "unicode/strenum.h"
-
-/**
- * \file
- * \brief C++ API: Locale ID object.
- */
-
-/**
- * A <code>Locale</code> object represents a specific geographical, political,
- * or cultural region. An operation that requires a <code>Locale</code> to perform
- * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
- * to tailor information for the user. For example, displaying a number
- * is a locale-sensitive operation--the number should be formatted
- * according to the customs/conventions of the user's native country,
- * region, or culture.
- *
- * The Locale class is not suitable for subclassing.
- *
- * <P>
- * You can create a <code>Locale</code> object using the constructor in
- * this class:
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * Locale( const char* language,
- * const char* country,
- * const char* variant);
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- * The first argument to the constructors is a valid <STRONG>ISO
- * Language Code.</STRONG> These codes are the lower-case two-letter
- * codes as defined by ISO-639.
- * You can find a full list of these codes at:
- * <BR><a href ="http://www.loc.gov/standards/iso639-2/">
- * http://www.loc.gov/standards/iso639-2/</a>
- *
- * <P>
- * The second argument to the constructors is a valid <STRONG>ISO Country
- * Code.</STRONG> These codes are the upper-case two-letter codes
- * as defined by ISO-3166.
- * You can find a full list of these codes at a number of sites, such as:
- * <BR><a href="http://www.iso.org/iso/en/prods-services/iso3166ma/index.html">
- * http://www.iso.org/iso/en/prods-services/iso3166ma/index.html</a>
- *
- * <P>
- * The third constructor requires a third argument--the <STRONG>Variant.</STRONG>
- * The Variant codes are vendor and browser-specific.
- * For example, use REVISED for a langauge's revised script orthography, and POSIX for POSIX.
- * Where there are two variants, separate them with an underscore, and
- * put the most important one first. For
- * example, a Traditional Spanish collation might be referenced, with
- * "ES", "ES", "Traditional_POSIX".
- *
- * <P>
- * Because a <code>Locale</code> object is just an identifier for a region,
- * no validity check is performed when you construct a <code>Locale</code>.
- * If you want to see whether particular resources are available for the
- * <code>Locale</code> you construct, you must query those resources. For
- * example, ask the <code>NumberFormat</code> for the locales it supports
- * using its <code>getAvailableLocales</code> method.
- * <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
- * locale, you get back the best available match, not necessarily
- * precisely what you asked for. For more information, look at
- * <code>ResourceBundle</code>.
- *
- * <P>
- * The <code>Locale</code> class provides a number of convenient constants
- * that you can use to create <code>Locale</code> objects for commonly used
- * locales. For example, the following refers to a <code>Locale</code> object
- * for the United States:
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * Locale::getUS()
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- *
- * <P>
- * Once you've created a <code>Locale</code> you can query it for information about
- * itself. Use <code>getCountry</code> to get the ISO Country Code and
- * <code>getLanguage</code> to get the ISO Language Code. You can
- * use <code>getDisplayCountry</code> to get the
- * name of the country suitable for displaying to the user. Similarly,
- * you can use <code>getDisplayLanguage</code> to get the name of
- * the language suitable for displaying to the user. Interestingly,
- * the <code>getDisplayXXX</code> methods are themselves locale-sensitive
- * and have two versions: one that uses the default locale and one
- * that takes a locale as an argument and displays the name or country in
- * a language appropriate to that locale.
- *
- * <P>
- * ICU provides a number of classes that perform locale-sensitive
- * operations. For example, the <code>NumberFormat</code> class formats
- * numbers, currency, or percentages in a locale-sensitive manner. Classes
- * such as <code>NumberFormat</code> have a number of convenience methods
- * for creating a default object of that type. For example, the
- * <code>NumberFormat</code> class provides these three convenience methods
- * for creating a default <code>NumberFormat</code> object:
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * UErrorCode success = U_ZERO_ERROR;
- * Locale myLocale;
- * NumberFormat *nf;
- *
- * nf = NumberFormat::createInstance( success ); delete nf;
- * nf = NumberFormat::createCurrencyInstance( success ); delete nf;
- * nf = NumberFormat::createPercentInstance( success ); delete nf;
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- * Each of these methods has two variants; one with an explicit locale
- * and one without; the latter using the default locale.
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * nf = NumberFormat::createInstance( myLocale, success ); delete nf;
- * nf = NumberFormat::createCurrencyInstance( myLocale, success ); delete nf;
- * nf = NumberFormat::createPercentInstance( myLocale, success ); delete nf;
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- * A <code>Locale</code> is the mechanism for identifying the kind of object
- * (<code>NumberFormat</code>) that you would like to get. The locale is
- * <STRONG>just</STRONG> a mechanism for identifying objects,
- * <STRONG>not</STRONG> a container for the objects themselves.
- *
- * <P>
- * Each class that performs locale-sensitive operations allows you
- * to get all the available objects of that type. You can sift
- * through these objects by language, country, or variant,
- * and use the display names to present a menu to the user.
- * For example, you can create a menu of all the collation objects
- * suitable for a given language. Such classes implement these
- * three class methods:
- * \htmlonly<blockquote>\endhtmlonly
- * <pre>
- * static Locale* getAvailableLocales(int32_t& numLocales)
- * static UnicodeString& getDisplayName(const Locale& objectLocale,
- * const Locale& displayLocale,
- * UnicodeString& displayName)
- * static UnicodeString& getDisplayName(const Locale& objectLocale,
- * UnicodeString& displayName)
- * </pre>
- * \htmlonly</blockquote>\endhtmlonly
- *
- * @stable ICU 2.0
- * @see ResourceBundle
- */
-U_NAMESPACE_BEGIN
-class U_COMMON_API Locale : public UObject {
-public:
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getEnglish(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getFrench(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getGerman(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getItalian(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getJapanese(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getKorean(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getChinese(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getSimplifiedChinese(void);
- /** Useful constant for this language. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getTraditionalChinese(void);
-
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getFrance(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getGermany(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getItaly(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getJapan(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getKorea(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getChina(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getPRC(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getTaiwan(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getUK(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getUS(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getCanada(void);
- /** Useful constant for this country/region. @stable ICU 2.0 */
- static const Locale &U_EXPORT2 getCanadaFrench(void);
-
-
- /**
- * Construct a default locale object, a Locale for the default locale ID.
- *
- * @see getDefault
- * @see uloc_getDefault
- * @stable ICU 2.0
- */
- Locale();
-
- /**
- * Construct a locale from language, country, variant.
- * If an error occurs, then the constructed object will be "bogus"
- * (isBogus() will return TRUE).
- *
- * @param language Lowercase two-letter or three-letter ISO-639 code.
- * This parameter can instead be an ICU style C locale (e.g. "en_US"),
- * but the other parameters must not be used.
- * This parameter can be NULL; if so,
- * the locale is initialized to match the current default locale.
- * (This is the same as using the default constructor.)
- * Please note: The Java Locale class does NOT accept the form
- * 'new Locale("en_US")' but only 'new Locale("en","US")'
- *
- * @param country Uppercase two-letter ISO-3166 code. (optional)
- * @param variant Uppercase vendor and browser specific code. See class
- * description. (optional)
- * @param keywordsAndValues A string consisting of keyword/values pairs, such as
- * "collation=phonebook;currency=euro"
- *
- * @see getDefault
- * @see uloc_getDefault
- * @stable ICU 2.0
- */
- Locale( const char * language,
- const char * country = 0,
- const char * variant = 0,
- const char * keywordsAndValues = 0);
-
- /**
- * Initializes a Locale object from another Locale object.
- *
- * @param other The Locale object being copied in.
- * @stable ICU 2.0
- */
- Locale(const Locale& other);
-
-
- /**
- * Destructor
- * @stable ICU 2.0
- */
- virtual ~Locale() ;
-
- /**
- * Replaces the entire contents of *this with the specified value.
- *
- * @param other The Locale object being copied in.
- * @return *this
- * @stable ICU 2.0
- */
- Locale& operator=(const Locale& other);
-
- /**
- * Checks if two locale keys are the same.
- *
- * @param other The locale key object to be compared with this.
- * @return True if the two locale keys are the same, false otherwise.
- * @stable ICU 2.0
- */
- UBool operator==(const Locale& other) const;
-
- /**
- * Checks if two locale keys are not the same.
- *
- * @param other The locale key object to be compared with this.
- * @return True if the two locale keys are not the same, false
- * otherwise.
- * @stable ICU 2.0
- */
- UBool operator!=(const Locale& other) const;
-
- /**
- * Clone this object.
- * Clones can be used concurrently in multiple threads.
- * If an error occurs, then NULL is returned.
- * The caller must delete the clone.
- *
- * @return a clone of this object
- *
- * @see getDynamicClassID
- * @stable ICU 2.8
- */
- Locale *clone() const;
-
- /**
- * Common methods of getting the current default Locale. Used for the
- * presentation: menus, dialogs, etc. Generally set once when your applet or
- * application is initialized, then never reset. (If you do reset the
- * default locale, you probably want to reload your GUI, so that the change
- * is reflected in your interface.)
- *
- * More advanced programs will allow users to use different locales for
- * different fields, e.g. in a spreadsheet.
- *
- * Note that the initial setting will match the host system.
- * @return a reference to the Locale object for the default locale ID
- * @system
- * @stable ICU 2.0
- */
- static const Locale& U_EXPORT2 getDefault(void);
-
- /**
- * Sets the default. Normally set once at the beginning of a process,
- * then never reset.
- * setDefault() only changes ICU's default locale ID, <strong>not</strong>
- * the default locale ID of the runtime environment.
- *
- * @param newLocale Locale to set to. If NULL, set to the value obtained
- * from the runtime environement.
- * @param success The error code.
- * @system
- * @stable ICU 2.0
- */
- static void U_EXPORT2 setDefault(const Locale& newLocale,
- UErrorCode& success);
-
- /**
- * Creates a locale which has had minimal canonicalization
- * as per uloc_getName().
- * @param name The name to create from. If name is null,
- * the default Locale is used.
- * @return new locale object
- * @stable ICU 2.0
- * @see uloc_getName
- */
- static Locale U_EXPORT2 createFromName(const char *name);
-
- /**
- * Creates a locale from the given string after canonicalizing
- * the string by calling uloc_canonicalize().
- * @param name the locale ID to create from. Must not be NULL.
- * @return a new locale object corresponding to the given name
- * @stable ICU 3.0
- * @see uloc_canonicalize
- */
- static Locale U_EXPORT2 createCanonical(const char* name);
-
- /**
- * Returns the locale's ISO-639 language code.
- * @return An alias to the code
- * @stable ICU 2.0
- */
- inline const char * getLanguage( ) const;
-
- /**
- * Returns the locale's ISO-15924 abbreviation script code.
- * @return An alias to the code
- * @see uscript_getShortName
- * @see uscript_getCode
- * @stable ICU 2.8
- */
- inline const char * getScript( ) const;
-
- /**
- * Returns the locale's ISO-3166 country code.
- * @return An alias to the code
- * @stable ICU 2.0
- */
- inline const char * getCountry( ) const;
-
- /**
- * Returns the locale's variant code.
- * @return An alias to the code
- * @stable ICU 2.0
- */
- inline const char * getVariant( ) const;
-
- /**
- * Returns the programmatic name of the entire locale, with the language,
- * country and variant separated by underbars. If a field is missing, up
- * to two leading underbars will occur. Example: "en", "de_DE", "en_US_WIN",
- * "de__POSIX", "fr__MAC", "__MAC", "_MT", "_FR_EURO"
- * @return A pointer to "name".
- * @stable ICU 2.0
- */
- inline const char * getName() const;
-
- /**
- * Returns the programmatic name of the entire locale as getName would return,
- * but without keywords.
- * @return A pointer to "name".
- * @see getName
- * @stable ICU 2.8
- */
- const char * getBaseName() const;
-
-
- /**
- * Gets the list of keywords for the specified locale.
- *
- * @return pointer to StringEnumeration class. Client must dispose of it by calling delete.
- * @param status Returns any error information while performing this operation.
- * @stable ICU 2.8
- */
- StringEnumeration * createKeywords(UErrorCode &status) const;
-
- /**
- * Get the value for a keyword.
- *
- * @param keywordName name of the keyword for which we want the value. Case insensitive.
- * @param status Returns any error information while performing this operation.
- * @param buffer The buffer to receive the keyword value.
- * @param bufferCapacity The capacity of receiving buffer
- * @return the length of keyword value
- *
- * @stable ICU 2.8
- */
- int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const;
-
- /**
- * returns the locale's three-letter language code, as specified
- * in ISO draft standard ISO-639-2.
- * @return An alias to the code, or NULL
- * @stable ICU 2.0
- */
- const char * getISO3Language() const;
-
- /**
- * Fills in "name" with the locale's three-letter ISO-3166 country code.
- * @return An alias to the code, or NULL
- * @stable ICU 2.0
- */
- const char * getISO3Country() const;
-
- /**
- * Returns the Windows LCID value corresponding to this locale.
- * This value is stored in the resource data for the locale as a one-to-four-digit
- * hexadecimal number. If the resource is missing, in the wrong format, or
- * there is no Windows LCID value that corresponds to this locale, returns 0.
- * @stable ICU 2.0
- */
- uint32_t getLCID(void) const;
-
- /**
- * Fills in "dispLang" with the name of this locale's language in a format suitable for
- * user display in the default locale. For example, if the locale's language code is
- * "fr" and the default locale's language code is "en", this function would set
- * dispLang to "French".
- * @param dispLang Receives the language's display name.
- * @return A reference to "dispLang".
- * @stable ICU 2.0
- */
- UnicodeString& getDisplayLanguage(UnicodeString& dispLang) const;
-
- /**
- * Fills in "dispLang" with the name of this locale's language in a format suitable for
- * user display in the locale specified by "displayLocale". For example, if the locale's
- * language code is "en" and displayLocale's language code is "fr", this function would set
- * dispLang to "Anglais".
- * @param displayLocale Specifies the locale to be used to display the name. In other words,
- * if the locale's language code is "en", passing Locale::getFrench() for
- * displayLocale would result in "Anglais", while passing Locale::getGerman()
- * for displayLocale would result in "Englisch".
- * @param dispLang Receives the language's display name.
- * @return A reference to "dispLang".
- * @stable ICU 2.0
- */
- UnicodeString& getDisplayLanguage( const Locale& displayLocale,
- UnicodeString& dispLang) const;
-
- /**
- * Fills in "dispScript" with the name of this locale's script in a format suitable
- * for user display in the default locale. For example, if the locale's script code
- * is "LATN" and the default locale's language code is "en", this function would set
- * dispScript to "Latin".
- * @param dispScript Receives the scripts's display name.
- * @return A reference to "dispScript".
- * @stable ICU 2.8
- */
- UnicodeString& getDisplayScript( UnicodeString& dispScript) const;
-
- /**
- * Fills in "dispScript" with the name of this locale's country in a format suitable
- * for user display in the locale specified by "displayLocale". For example, if the locale's
- * script code is "LATN" and displayLocale's language code is "en", this function would set
- * dispScript to "Latin".
- * @param displayLocale Specifies the locale to be used to display the name. In other
- * words, if the locale's script code is "LATN", passing
- * Locale::getFrench() for displayLocale would result in "", while
- * passing Locale::getGerman() for displayLocale would result in
- * "".
- * @param dispScript Receives the scripts's display name.
- * @return A reference to "dispScript".
- * @stable ICU 2.8
- */
- UnicodeString& getDisplayScript( const Locale& displayLocale,
- UnicodeString& dispScript) const;
-
- /**
- * Fills in "dispCountry" with the name of this locale's country in a format suitable
- * for user display in the default locale. For example, if the locale's country code
- * is "FR" and the default locale's language code is "en", this function would set
- * dispCountry to "France".
- * @param dispCountry Receives the country's display name.
- * @return A reference to "dispCountry".
- * @stable ICU 2.0
- */
- UnicodeString& getDisplayCountry( UnicodeString& dispCountry) const;
-
- /**
- * Fills in "dispCountry" with the name of this locale's country in a format suitable
- * for user display in the locale specified by "displayLocale". For example, if the locale's
- * country code is "US" and displayLocale's language code is "fr", this function would set
- * dispCountry to "&Eacute;tats-Unis".
- * @param displayLocale Specifies the locale to be used to display the name. In other
- * words, if the locale's country code is "US", passing
- * Locale::getFrench() for displayLocale would result in "&Eacute;tats-Unis", while
- * passing Locale::getGerman() for displayLocale would result in
- * "Vereinigte Staaten".
- * @param dispCountry Receives the country's display name.
- * @return A reference to "dispCountry".
- * @stable ICU 2.0
- */
- UnicodeString& getDisplayCountry( const Locale& displayLocale,
- UnicodeString& dispCountry) const;
-
- /**
- * Fills in "dispVar" with the name of this locale's variant code in a format suitable
- * for user display in the default locale.
- * @param dispVar Receives the variant's name.
- * @return A reference to "dispVar".
- * @stable ICU 2.0
- */
- UnicodeString& getDisplayVariant( UnicodeString& dispVar) const;
-
- /**
- * Fills in "dispVar" with the name of this locale's variant code in a format
- * suitable for user display in the locale specified by "displayLocale".
- * @param displayLocale Specifies the locale to be used to display the name.
- * @param dispVar Receives the variant's display name.
- * @return A reference to "dispVar".
- * @stable ICU 2.0
- */
- UnicodeString& getDisplayVariant( const Locale& displayLocale,
- UnicodeString& dispVar) const;
-
- /**
- * Fills in "name" with the name of this locale in a format suitable for user display
- * in the default locale. This function uses getDisplayLanguage(), getDisplayCountry(),
- * and getDisplayVariant() to do its work, and outputs the display name in the format
- * "language (country[,variant])". For example, if the default locale is en_US, then
- * fr_FR's display name would be "French (France)", and es_MX_Traditional's display name
- * would be "Spanish (Mexico,Traditional)".
- * @param name Receives the locale's display name.
- * @return A reference to "name".
- * @stable ICU 2.0
- */
- UnicodeString& getDisplayName( UnicodeString& name) const;
-
- /**
- * Fills in "name" with the name of this locale in a format suitable for user display
- * in the locale specfied by "displayLocale". This function uses getDisplayLanguage(),
- * getDisplayCountry(), and getDisplayVariant() to do its work, and outputs the display
- * name in the format "language (country[,variant])". For example, if displayLocale is
- * fr_FR, then en_US's display name would be "Anglais (&Eacute;tats-Unis)", and no_NO_NY's
- * display name would be "norv&eacute;gien (Norv&egrave;ge,NY)".
- * @param displayLocale Specifies the locale to be used to display the name.
- * @param name Receives the locale's display name.
- * @return A reference to "name".
- * @stable I