X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..4388f060552cc537e71e957d32f35e9d75a61233:/icuSources/i18n/rbt.h?ds=sidebyside diff --git a/icuSources/i18n/rbt.h b/icuSources/i18n/rbt.h index db5405f0..d061de6e 100644 --- a/icuSources/i18n/rbt.h +++ b/icuSources/i18n/rbt.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2003, International Business Machines +* Copyright (C) 1999-2007, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -17,6 +17,9 @@ #include "unicode/translit.h" #include "unicode/utypes.h" #include "unicode/parseerr.h" +#include "unicode/udata.h" + +#define U_ICUDATA_TRANSLIT U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "translit" U_NAMESPACE_BEGIN @@ -283,13 +286,14 @@ class TransliterationRuleData; * @author Alan Liu * @internal Use transliterator factory methods instead since this class will be removed in that release. */ -class U_I18N_API RuleBasedTransliterator : public Transliterator { - +class RuleBasedTransliterator : public Transliterator { +private: /** * The data object is immutable, so we can freely share it with * other instances of RBT, as long as we do NOT own this object. + * TODO: data is no longer immutable. See bugs #1866, 2155 */ - TransliterationRuleData* data; + TransliterationRuleData* fData; /** * If true, we own the data object and must delete it. @@ -319,38 +323,38 @@ public: * @exception IllegalArgumentException if rules are malformed. * @internal Use transliterator factory methods instead since this class will be removed in that release. */ - RuleBasedTransliterator(const UnicodeString& id, + /*RuleBasedTransliterator(const UnicodeString& id, const UnicodeString& rules, UTransDirection direction, UnicodeFilter* adoptedFilter, - UErrorCode& status); + UErrorCode& status);*/ /** * Covenience constructor with no filter. * @internal Use transliterator factory methods instead since this class will be removed in that release. */ - RuleBasedTransliterator(const UnicodeString& id, + /*RuleBasedTransliterator(const UnicodeString& id, const UnicodeString& rules, UTransDirection direction, - UErrorCode& status); + UErrorCode& status);*/ /** * Covenience constructor with no filter and FORWARD direction. * @internal Use transliterator factory methods instead since this class will be removed in that release. */ - RuleBasedTransliterator(const UnicodeString& id, + /*RuleBasedTransliterator(const UnicodeString& id, const UnicodeString& rules, - UErrorCode& status); + UErrorCode& status);*/ /** * Covenience constructor with FORWARD direction. * @internal Use transliterator factory methods instead since this class will be removed in that release. */ - RuleBasedTransliterator(const UnicodeString& id, + /*RuleBasedTransliterator(const UnicodeString& id, const UnicodeString& rules, UnicodeFilter* adoptedFilter, - UErrorCode& status); - private: + UErrorCode& status);*/ +private: friend class TransliteratorRegistry; // to access TransliterationRuleData convenience ctor /** @@ -376,7 +380,7 @@ public: TransliterationRuleData* data, UBool isDataAdopted); - public: +public: /** * Copy constructor. @@ -390,9 +394,9 @@ public: * Implement Transliterator API. * @internal Use transliterator factory methods instead since this class will be removed in that release. */ - Transliterator* clone(void) const; + virtual Transliterator* clone(void) const; - protected: +protected: /** * Implements {@link Transliterator#handleTransliterate}. * @internal Use transliterator factory methods instead since this class will be removed in that release. @@ -400,7 +404,7 @@ public: virtual void handleTransliterate(Replaceable& text, UTransPosition& offsets, UBool isIncremental) const; - public: +public: /** * Return a representation of this transliterator as source rules. * These rules will produce an equivalent transliterator if used @@ -416,13 +420,13 @@ public: virtual UnicodeString& toRules(UnicodeString& result, UBool escapeUnprintable) const; - protected: +protected: /** * Implement Transliterator framework */ virtual void handleGetSourceSet(UnicodeSet& result) const; - public: +public: /** * Override Transliterator framework */ @@ -439,7 +443,7 @@ public: * @return The class ID for all objects of this class. * @internal Use transliterator factory methods instead since this class will be removed in that release. */ - static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; } + U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void); /** * Returns a unique class ID polymorphically. This method @@ -447,118 +451,20 @@ public: * compilers support genuine RTTI. Polymorphic operator==() and * clone() methods call this method. * - *
Concrete subclasses of Transliterator that wish clients to - * be able to identify them should implement getDynamicClassID() - * and also a static method and data member: - * - *
- * static UClassID getStaticClassID() { return (UClassID)&fgClassID; } - * static char fgClassID; - *- * - * Subclasses that do not implement this method will have a - * dynamic class ID of Transliterator::getStatisClassID(). - * * @return The class ID for this object. All objects of a given * class have the same class ID. Objects of other classes have * different class IDs. */ - virtual UClassID getDynamicClassID(void) const { return getStaticClassID(); }; + virtual UClassID getDynamicClassID(void) const; private: - /** - * Class identifier for RuleBasedTransliterator. - */ - static const char fgClassID; - void _construct(const UnicodeString& rules, UTransDirection direction, UParseError& parseError, UErrorCode& status); }; -/** - * Constructs a new transliterator from the given rules. - * @param id the id for the transliterator. - * @param rules rules, separated by ';' - * @param direction either FORWARD or REVERSE. - * @param adoptedFilter the filter for this transliterator. - * @param parseError Struct to recieve information on position - * of error if an error is encountered - * @param status Output param set to success/failure code. - * @exception IllegalArgumentException if rules are malformed - * or direction is invalid. - */ -inline RuleBasedTransliterator::RuleBasedTransliterator( - const UnicodeString& id, - const UnicodeString& rules, - UTransDirection direction, - UnicodeFilter* adoptedFilter, - UParseError& parseError, - UErrorCode& status) : - Transliterator(id, adoptedFilter) { - _construct(rules, direction,parseError,status); -} - -/** - * Constructs a new transliterator from the given rules. - * @param id the id for the transliterator. - * @param rules rules, separated by ';' - * @param direction either FORWARD or REVERSE. - * @param adoptedFilter the filter for this transliterator. - * @param status Output param set to success/failure code. - * @exception IllegalArgumentException if rules are malformed - * or direction is invalid. - */ -inline RuleBasedTransliterator::RuleBasedTransliterator( - const UnicodeString& id, - const UnicodeString& rules, - UTransDirection direction, - UnicodeFilter* adoptedFilter, - UErrorCode& status) : - Transliterator(id, adoptedFilter) { - UParseError parseError; - _construct(rules, direction,parseError, status); -} - -/** - * Covenience constructor with no filter. - */ -inline RuleBasedTransliterator::RuleBasedTransliterator( - const UnicodeString& id, - const UnicodeString& rules, - UTransDirection direction, - UErrorCode& status) : - Transliterator(id, 0) { - UParseError parseError; - _construct(rules, direction,parseError, status); -} - -/** - * Covenience constructor with no filter and FORWARD direction. - */ -inline RuleBasedTransliterator::RuleBasedTransliterator( - const UnicodeString& id, - const UnicodeString& rules, - UErrorCode& status) : - Transliterator(id, 0) { - UParseError parseError; - _construct(rules, UTRANS_FORWARD, parseError, status); -} - -/** - * Covenience constructor with FORWARD direction. - */ -inline RuleBasedTransliterator::RuleBasedTransliterator( - const UnicodeString& id, - const UnicodeString& rules, - UnicodeFilter* adoptedFilter, - UErrorCode& status) : - Transliterator(id, adoptedFilter) { - UParseError parseError; - _construct(rules, UTRANS_FORWARD,parseError, status); -} U_NAMESPACE_END