mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-990 add toRules API to RuleBasedTransliterator
X-SVN-Rev: 4964
This commit is contained in:
parent
a29178ff31
commit
90eb29fdee
1 changed files with 56 additions and 0 deletions
|
@ -375,6 +375,57 @@ public:
|
|||
virtual void handleTransliterate(Replaceable& text, UTransPosition& offsets,
|
||||
UBool isIncremental) const;
|
||||
|
||||
/**
|
||||
* Return a representation of this transliterator as source rules.
|
||||
* These rules will produce an equivalent transliterator if used
|
||||
* to construct a new transliterator.
|
||||
* @param result the string to receive the rules. Previous
|
||||
* contents will be deleted.
|
||||
* @param escapeUnprintable if TRUE then convert unprintable
|
||||
* character to their hex escape representations, \uxxxx or
|
||||
* \Uxxxxxxxx. Unprintable characters are those other than
|
||||
* U+000A, U+0020..U+007E.
|
||||
*/
|
||||
virtual UnicodeString& toRules(UnicodeString& result,
|
||||
UBool escapeUnprintable) const;
|
||||
|
||||
/**
|
||||
* Return the class ID for this class. This is useful only for
|
||||
* comparing to a return value from getDynamicClassID(). For example:
|
||||
* <pre>
|
||||
* . Base* polymorphic_pointer = createPolymorphicObject();
|
||||
* . if (polymorphic_pointer->getDynamicClassID() ==
|
||||
* . Derived::getStaticClassID()) ...
|
||||
* </pre>
|
||||
* @return The class ID for all objects of this class.
|
||||
* @stable
|
||||
*/
|
||||
static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; }
|
||||
|
||||
/**
|
||||
* Returns a unique class ID <b>polymorphically</b>. This method
|
||||
* is to implement a simple version of RTTI, since not all C++
|
||||
* compilers support genuine RTTI. Polymorphic operator==() and
|
||||
* clone() methods call this method.
|
||||
*
|
||||
* <p>Concrete subclasses of Transliterator that wish clients to
|
||||
* be able to identify them should implement getDynamicClassID()
|
||||
* and also a static method and data member:
|
||||
*
|
||||
* <pre>
|
||||
* static UClassID getStaticClassID() { return (UClassID)&fgClassID; }
|
||||
* static char fgClassID;
|
||||
* </pre>
|
||||
*
|
||||
* 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(); };
|
||||
|
||||
/**
|
||||
* Parse error codes generated by RuleBasedTransliterator.
|
||||
* See parseerr.h.
|
||||
|
@ -405,6 +456,11 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Class identifier for RuleBasedTransliterator.
|
||||
*/
|
||||
static char fgClassID;
|
||||
|
||||
void _construct(const UnicodeString& rules,
|
||||
UTransDirection direction,
|
||||
UErrorCode& status,
|
||||
|
|
Loading…
Add table
Reference in a new issue