ICU-1533 Moved new Transliterator subclasses here to make them private.

X-SVN-Rev: 6964
This commit is contained in:
Helena Chapman 2001-11-16 23:51:15 +00:00
parent a4b3d2abd2
commit 915a88d738
17 changed files with 603 additions and 15 deletions

View File

@ -8,7 +8,7 @@
**********************************************************************
*/
#include "unicode/name2uni.h"
#include "name2uni.h"
#include "unicode/unifilt.h"
#include "unicode/uchar.h"

View File

@ -0,0 +1,83 @@
/*
**********************************************************************
* Copyright (C) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 06/07/01 aliu Creation.
**********************************************************************
*/
#ifndef NAME2UNI_H
#define NAME2UNI_H
#include "unicode/translit.h"
U_NAMESPACE_BEGIN
/**
* A transliterator that performs name to character mapping.
* @author Alan Liu
* @draft ICU 2.0
*/
class U_I18N_API NameUnicodeTransliterator : public Transliterator {
UChar32 openDelimiter;
UChar32 closeDelimiter;
public:
/**
* Constructs a transliterator.
* @draft ICU 2.0
*/
NameUnicodeTransliterator(UChar32 openDelimiter, UChar32 closeDelimiter,
UnicodeFilter* adoptedFilter = 0);
/**
* Constructs a transliterator with the default delimiters '{' and
* '}'.
* @draft ICU 2.0
*/
NameUnicodeTransliterator(UnicodeFilter* adoptedFilter = 0);
/**
* Destructor.
* @draft ICU 2.0
*/
virtual ~NameUnicodeTransliterator();
/**
* Copy constructor.
* @draft ICU 2.0
*/
NameUnicodeTransliterator(const NameUnicodeTransliterator&);
/**
* Assignment operator.
* @draft ICU 2.0
*/
NameUnicodeTransliterator& operator=(const NameUnicodeTransliterator&);
/**
* Transliterator API.
* @draft ICU 2.0
*/
Transliterator* clone(void) const;
protected:
/**
* Implements {@link Transliterator#handleTransliterate}.
* @draft ICU 2.0
*/
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
private:
static const char _ID[];
};
U_NAMESPACE_END
#endif

View File

@ -9,7 +9,7 @@
*/
#include "unicode/utypes.h"
#include "unicode/nortrans.h"
#include "nortrans.h"
#include "unormimp.h"
U_NAMESPACE_BEGIN

View File

@ -0,0 +1,88 @@
/*
**********************************************************************
* Copyright (C) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 07/03/01 aliu Creation.
**********************************************************************
*/
#ifndef NORTRANS_H
#define NORTRANS_H
#include "unicode/utypes.h"
#include "unicode/translit.h"
#include "unicode/normlzr.h"
U_NAMESPACE_BEGIN
/**
* A transliterator that performs normalization.
* @author Alan Liu
* @version $RCSfile: nortrans.h,v $ $Revision: 1.1 $ $Date: 2001/11/16 23:51:15 $
*/
class U_I18N_API NormalizationTransliterator : public Transliterator {
/**
* The normalization mode of this transliterator.
*/
UNormalizationMode fMode;
/**
* Normalization options for this transliterator.
*/
int32_t options;
public:
/**
* Destructor.
*/
virtual ~NormalizationTransliterator();
/**
* Copy constructor.
*/
NormalizationTransliterator(const NormalizationTransliterator&);
/**
* Assignment operator.
*/
NormalizationTransliterator& operator=(const NormalizationTransliterator&);
/**
* Transliterator API.
*/
Transliterator* clone(void) const;
protected:
/**
* Implements {@link Transliterator#handleTransliterate}.
*/
void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
public:
/**
* System registration hook. Public to Transliterator only.
*/
static void registerIDs();
private:
// Transliterator::Factory methods
static Transliterator* _create(const UnicodeString& ID,
Token context);
/**
* Constructs a transliterator. This method is private.
* Public users must use the factory method createInstance().
*/
NormalizationTransliterator(const UnicodeString& id,
UNormalizationMode mode, int32_t opt);
};
U_NAMESPACE_END
#endif

View File

@ -7,7 +7,7 @@
* 04/02/2001 aliu Creation.
**********************************************************************
*/
#include "unicode/remtrans.h"
#include "remtrans.h"
U_NAMESPACE_BEGIN

View File

@ -0,0 +1,58 @@
/*
**********************************************************************
* Copyright (c) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 04/02/2001 aliu Creation.
**********************************************************************
*/
#ifndef REMTRANS_H
#define REMTRANS_H
#include "unicode/translit.h"
U_NAMESPACE_BEGIN
/**
* A transliterator that removes text.
* @author Alan Liu
*/
class U_I18N_API RemoveTransliterator : public Transliterator {
public:
/**
* ID for this transliterator.
*/
static const UChar ID[]; // public for Transliterator
/**
* Constructs a transliterator.
*/
RemoveTransliterator();
/**
* Destructor.
*/
virtual ~RemoveTransliterator();
/**
* Transliterator API.
*/
Transliterator* clone(void) const;
/**
* Implements {@link Transliterator#handleTransliterate}.
*/
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
};
inline RemoveTransliterator::RemoveTransliterator() : Transliterator(ID, 0) {}
inline RemoveTransliterator::~RemoveTransliterator() {}
U_NAMESPACE_END
#endif

View File

@ -9,7 +9,7 @@
*/
#include "unicode/uchar.h"
#include "unicode/titletrn.h"
#include "titletrn.h"
#include "unicode/uniset.h"
#include "mutex.h"
#include "ucln_in.h"

View File

@ -0,0 +1,77 @@
/*
**********************************************************************
* Copyright (C) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 05/24/01 aliu Creation.
**********************************************************************
*/
#ifndef TITLETRN_H
#define TITLETRN_H
#include "unicode/translit.h"
U_NAMESPACE_BEGIN
/**
* A transliterator that converts all letters (as defined by
* <code>UCharacter.isLetter()</code>) to lower case, except for those
* letters preceded by non-letters. The latter are converted to title
* case using <code>u_totitle()</code>.
* @author Alan Liu
*/
class U_I18N_API TitlecaseTransliterator : public Transliterator {
/**
* ID for this transliterator.
*/
static const char _ID[];
public:
/**
* Constructs a transliterator.
*/
TitlecaseTransliterator(UnicodeFilter* adoptedFilter = 0);
/**
* Destructor.
*/
virtual ~TitlecaseTransliterator();
/**
* Copy constructor.
*/
TitlecaseTransliterator(const TitlecaseTransliterator&);
/**
* Assignment operator.
*/
TitlecaseTransliterator& operator=(const TitlecaseTransliterator&);
/**
* Transliterator API.
*/
Transliterator* clone(void) const;
protected:
/**
* Implements {@link Transliterator#handleTransliterate}.
*/
void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
public:
/**
* Static memory cleanup function. FOR INTERNAL USE ONLY; DO NOT
* CALL.
*/
static void cleanup();
};
U_NAMESPACE_END
#endif

View File

@ -8,7 +8,7 @@
**********************************************************************
*/
#include "unicode/tolowtrn.h"
#include "tolowtrn.h"
U_NAMESPACE_BEGIN

View File

@ -0,0 +1,74 @@
/*
**********************************************************************
* Copyright (C) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 05/24/01 aliu Creation.
**********************************************************************
*/
#ifndef TOLOWTRN_H
#define TOLOWTRN_H
#include "xformtrn.h"
#include "unicode/locid.h"
U_NAMESPACE_BEGIN
/**
* A transliterator that performs locale-sensitive toLower()
* case mapping.
* @author Alan Liu
*/
class U_I18N_API LowercaseTransliterator : public TransformTransliterator {
public:
/**
* Constructs a transliterator.
*/
LowercaseTransliterator(const Locale& loc = Locale::getDefault(),
UnicodeFilter* adoptedFilter = 0);
/**
* Destructor.
*/
virtual ~LowercaseTransliterator();
/**
* Copy constructor.
*/
LowercaseTransliterator(const LowercaseTransliterator&);
/**
* Assignment operator.
*/
LowercaseTransliterator& operator=(const LowercaseTransliterator&);
/**
* Transliterator API.
*/
Transliterator* clone(void) const;
protected:
/**
* TransformTransliterator framework method.
*/
virtual UBool hasTransform(UChar32 c) const;
/**
* TransformTransliterator framework method.
*/
virtual void transform(UnicodeString& s) const;
private:
Locale loc;
static const char _ID[];
};
U_NAMESPACE_END
#endif

View File

@ -8,7 +8,7 @@
**********************************************************************
*/
#include "unicode/toupptrn.h"
#include "toupptrn.h"
U_NAMESPACE_BEGIN

View File

@ -0,0 +1,74 @@
/*
**********************************************************************
* Copyright (C) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 05/24/01 aliu Creation.
**********************************************************************
*/
#ifndef TOUPPTRN_H
#define TOUPPTRN_H
#include "xformtrn.h"
#include "unicode/locid.h"
U_NAMESPACE_BEGIN
/**
* A transliterator that performs locale-sensitive toUpper()
* case mapping.
* @author Alan Liu
*/
class U_I18N_API UppercaseTransliterator : public TransformTransliterator {
public:
/**
* Constructs a transliterator.
*/
UppercaseTransliterator(const Locale& loc = Locale::getDefault(),
UnicodeFilter* adoptedFilter = 0);
/**
* Destructor.
*/
virtual ~UppercaseTransliterator();
/**
* Copy constructor.
*/
UppercaseTransliterator(const UppercaseTransliterator&);
/**
* Assignment operator.
*/
UppercaseTransliterator& operator=(const UppercaseTransliterator&);
/**
* Transliterator API.
*/
Transliterator* clone(void) const;
protected:
/**
* TransformTransliterator framework method.
*/
virtual UBool hasTransform(UChar32 c) const;
/**
* TransformTransliterator framework method.
*/
virtual void transform(UnicodeString& s) const;
private:
Locale loc;
static const char _ID[];
};
U_NAMESPACE_END
#endif

View File

@ -19,18 +19,18 @@
#include "unicode/hextouni.h"
#include "unicode/locid.h"
#include "unicode/msgfmt.h"
#include "unicode/name2uni.h"
#include "unicode/nortrans.h"
#include "name2uni.h"
#include "nortrans.h"
#include "unicode/nultrans.h"
#include "unicode/putil.h"
#include "unicode/rep.h"
#include "unicode/remtrans.h"
#include "remtrans.h"
#include "unicode/resbund.h"
#include "unicode/titletrn.h"
#include "unicode/tolowtrn.h"
#include "unicode/toupptrn.h"
#include "titletrn.h"
#include "tolowtrn.h"
#include "toupptrn.h"
#include "unicode/translit.h"
#include "unicode/uni2name.h"
#include "uni2name.h"
#include "unicode/unicode.h"
#include "unicode/unifilt.h"
#include "unicode/unifltlg.h"

View File

@ -8,7 +8,7 @@
**********************************************************************
*/
#include "unicode/uni2name.h"
#include "uni2name.h"
#include "unicode/unifilt.h"
U_NAMESPACE_BEGIN

View File

@ -0,0 +1,75 @@
/*
**********************************************************************
* Copyright (C) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 06/06/01 aliu Creation.
**********************************************************************
*/
#ifndef UNI2NAME_H
#define UNI2NAME_H
#include "unicode/translit.h"
U_NAMESPACE_BEGIN
/**
* A transliterator that performs character to name mapping.
* @author Alan Liu
*/
class U_I18N_API UnicodeNameTransliterator : public Transliterator {
UChar32 openDelimiter;
UChar32 closeDelimiter;
public:
/**
* Constructs a transliterator.
*/
UnicodeNameTransliterator(UChar32 openDelimiter, UChar32 closeDelimiter,
UnicodeFilter* adoptedFilter = 0);
/**
* Constructs a transliterator with the default delimiters '{' and
* '}'.
*/
UnicodeNameTransliterator(UnicodeFilter* adoptedFilter = 0);
/**
* Destructor.
*/
virtual ~UnicodeNameTransliterator();
/**
* Copy constructor.
*/
UnicodeNameTransliterator(const UnicodeNameTransliterator&);
/**
* Assignment operator.
*/
UnicodeNameTransliterator& operator=(const UnicodeNameTransliterator&);
/**
* Transliterator API.
*/
Transliterator* clone(void) const;
protected:
/**
* Implements {@link Transliterator#handleTransliterate}.
*/
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
private:
static const char _ID[];
};
U_NAMESPACE_END
#endif

View File

@ -8,7 +8,7 @@
**********************************************************************
*/
#include "unicode/xformtrn.h"
#include "xformtrn.h"
#include "unicode/unifilt.h"
U_NAMESPACE_BEGIN

View File

@ -0,0 +1,59 @@
/*
**********************************************************************
* Copyright (C) 2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
* 05/24/01 aliu Creation.
**********************************************************************
*/
#ifndef XFORMTRN_H
#define XFORMTRN_H
#include "unicode/translit.h"
U_NAMESPACE_BEGIN
/**
* An abstract class for transliterators based on a transform
* operation. To create a transliterator that implements a
* transformation, create a subclass of this class and implement the
* abstract <code>transform()</code> and <code>hasTransform()</code>
* methods.
* @author Alan Liu
*/
class U_I18N_API TransformTransliterator : public Transliterator {
protected:
/**
* Constructs a transliterator. For use by subclasses.
*/
TransformTransliterator(const UnicodeString& id,
UnicodeFilter* adoptedFilter);
/**
* Implements {@link Transliterator#handleTransliterate}.
*/
void handleTransliterate(Replaceable& text, UTransPosition& offset,
UBool isIncremental) const;
/**
* Subclasses must implement this method to determine whether a
* given character has a transform that is not equal to itself.
* This is approximately equivalent to <code>c !=
* transform(String.valueOf(c))</code>, where
* <code>String.valueOf(c)</code> returns a String containing the
* single character (not integer) <code>c</code>. Subclasses that
* transform all their input can simply return <code>true</code>.
*/
virtual UBool hasTransform(UChar32 c) const = 0;
/**
* Subclasses must implement this method to transform a string.
*/
virtual void transform(UnicodeString& s) const = 0;
};
U_NAMESPACE_END
#endif