mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-05 21:45:37 +00:00
ICU-22691 Make sample code possible to compile with current ICU4C.
This commit is contained in:
parent
dd7b0a9d6d
commit
142850ae2c
6 changed files with 17 additions and 8 deletions
|
@ -9,7 +9,6 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/rbt.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/calendar.h"
|
||||
#include "unicode/datefmt.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/rbt.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/calendar.h"
|
||||
#include "unicode/datefmt.h"
|
||||
|
@ -43,7 +42,7 @@ int main(int argc, char **argv) {
|
|||
defFmt->setCalendar(*cal);
|
||||
|
||||
// Create a Greek-Latin Transliterator
|
||||
greek_latin = Transliterator::createInstance("Greek-Latin");
|
||||
greek_latin = Transliterator::createInstance("Greek-Latin", UTRANS_FORWARD, status);
|
||||
if (greek_latin == nullptr) {
|
||||
printf("ERROR: Transliterator::createInstance() failed\n");
|
||||
exit(1);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/rbt.h"
|
||||
#include "rbt.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/calendar.h"
|
||||
#include "unicode/datefmt.h"
|
||||
|
@ -55,16 +55,19 @@ int main(int argc, char **argv) {
|
|||
defFmt->setCalendar(*cal);
|
||||
|
||||
// Create a Greek-Latin Transliterator
|
||||
greek_latin = Transliterator::createInstance("Greek-Latin");
|
||||
greek_latin = Transliterator::createInstance("Greek-Latin", UTRANS_FORWARD, status);
|
||||
if (greek_latin == nullptr) {
|
||||
printf("ERROR: Transliterator::createInstance() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Create a custom Transliterator
|
||||
UParseError parseError;
|
||||
rbtUnaccent = new RuleBasedTransliterator("RBTUnaccent",
|
||||
UNACCENT_RULES,
|
||||
UTRANS_FORWARD,
|
||||
nullptr,
|
||||
parseError,
|
||||
status);
|
||||
check(status, "RuleBasedTransliterator::ct");
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include "unicode/translit.h"
|
||||
#include "unicode/rbt.h"
|
||||
#include "rbt.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/calendar.h"
|
||||
#include "unicode/datefmt.h"
|
||||
|
@ -56,16 +56,19 @@ int main(int argc, char **argv) {
|
|||
defFmt->setCalendar(*cal);
|
||||
|
||||
// Create a Greek-Latin Transliterator
|
||||
greek_latin = Transliterator::createInstance("Greek-Latin");
|
||||
greek_latin = Transliterator::createInstance("Greek-Latin", UTRANS_FORWARD, status);
|
||||
if (greek_latin == nullptr) {
|
||||
printf("ERROR: Transliterator::createInstance() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Create a custom Transliterator
|
||||
UParseError parseError;
|
||||
rbtUnaccent = new RuleBasedTransliterator("RBTUnaccent",
|
||||
UNACCENT_RULES,
|
||||
UTRANS_FORWARD,
|
||||
nullptr,
|
||||
parseError,
|
||||
status);
|
||||
check(status, "RuleBasedTransliterator::ct");
|
||||
|
||||
|
|
|
@ -13,11 +13,13 @@ using icu::Replaceable;
|
|||
using icu::Transliterator;
|
||||
using icu::UnicodeString;
|
||||
|
||||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnaccentTransliterator)
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UnaccentTransliterator::UnaccentTransliterator() :
|
||||
normalizer("", Normalizer::DECOMP),
|
||||
normalizer("", UNORM_NFD),
|
||||
Transliterator("Unaccent", nullptr) {
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ class UnaccentTransliterator : public Transliterator {
|
|||
*/
|
||||
virtual ~UnaccentTransliterator();
|
||||
|
||||
virtual UClassID getDynamicClassID() const override;
|
||||
U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue