~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/i18n/unicode/hextouni.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
**********************************************************************
3
 
*   Copyright (C) 1999-2002, International Business Machines
4
 
*   Corporation and others.  All Rights Reserved.
5
 
**********************************************************************
6
 
*   Date        Name        Description
7
 
*   11/17/99    aliu        Creation.
8
 
**********************************************************************
9
 
*/
10
 
#ifndef HEXTOUNI_H
11
 
#define HEXTOUNI_H
12
 
 
13
 
#include "unicode/translit.h"
14
 
 
15
 
U_NAMESPACE_BEGIN
16
 
 
17
 
/**
18
 
 * A transliterator that converts from hexadecimal Unicode escape
19
 
 * sequences to the characters they represent.  For example, "U+0040"
20
 
 * and '\u0040'.  A default HexToUnicodeTransliterator recognizes the
21
 
 * prefixes "U+", "u+", "\U", and "\u".  Hex values may be
22
 
 * upper- or lowercase.  By calling the applyPattern() method, one
23
 
 * or more custom prefix/suffix pairs may be specified.  See
24
 
 * applyPattern() for details.
25
 
 *
26
 
 * <p>Copyright &copy; IBM Corporation 1999.  All rights reserved.
27
 
 *
28
 
 * @author Alan Liu
29
 
 * @deprecated To be removed after 2002-sep-30, use Transliterator::createInstance factory method.
30
 
 */
31
 
class U_I18N_API HexToUnicodeTransliterator : public Transliterator {
32
 
 
33
 
    /**
34
 
     * ID for this transliterator.
35
 
     */
36
 
    static const char _ID[];
37
 
 
38
 
    /**
39
 
     * The pattern used by the default constructor
40
 
     */
41
 
    static const UChar DEFAULT_PATTERN[];
42
 
 
43
 
    // Character constants defined here to avoid ASCII dependency
44
 
    enum {
45
 
        SEMICOLON = 0x003B, // ';'
46
 
        ZERO      = 0x0030, // '0'
47
 
        POUND     = 0x0023, // '#'
48
 
        BACKSLASH = 0x005C  // '\\'
49
 
    };
50
 
 
51
 
    /**
52
 
     * The pattern for this transliterator
53
 
     */
54
 
    UnicodeString pattern;
55
 
 
56
 
    /**
57
 
     * The processed pattern specification.  See applyPattern() for
58
 
     * details.
59
 
     */
60
 
    UnicodeString affixes;
61
 
 
62
 
    /**
63
 
     * The number of different affix sets in affixes.
64
 
     */
65
 
    int32_t affixCount;
66
 
 
67
 
public:
68
 
 
69
 
    /**
70
 
     * Constructs a transliterator that recognizes the standard
71
 
     * prefixes "&#92;u", "&#92;U", "u+", and "U+", each with no
72
 
     * suffix.
73
 
     * @deprecated To be removed after 2002-sep-30, use Transliterator::createInstance factory method.
74
 
     */
75
 
    HexToUnicodeTransliterator(UnicodeFilter* adoptedFilter = 0);
76
 
 
77
 
    /**
78
 
     * Constructs a custom transliterator with the given pattern.
79
 
     * @see #applyPattern
80
 
     * @deprecated To be removed after 2002-sep-30, use Transliterator::createInstance factory method.
81
 
     */
82
 
    HexToUnicodeTransliterator(const UnicodeString& pattern,
83
 
                               UErrorCode& status);
84
 
 
85
 
    /**
86
 
     * Constructs a custom transliterator with the given pattern
87
 
     * and filter.
88
 
     * @see #applyPattern
89
 
     * @deprecated To be removed after 2002-sep-30, use Transliterator::createInstance factory method.
90
 
     */
91
 
    HexToUnicodeTransliterator(const UnicodeString& pattern,
92
 
                               UnicodeFilter* adoptedFilter,
93
 
                               UErrorCode& status);
94
 
 
95
 
    /**
96
 
     * Destructor.
97
 
     * @deprecated To be removed after 2002-sep-30, use Transliterator dtor directly.
98
 
     */
99
 
    virtual ~HexToUnicodeTransliterator();
100
 
 
101
 
    /**
102
 
     * Copy constructor.
103
 
     * @deprecated To be removed after 2002-sep-30, use Transliterator::createInstance factory method
104
 
     */
105
 
    HexToUnicodeTransliterator(const HexToUnicodeTransliterator&);
106
 
 
107
 
    /**
108
 
     * Assignment operator.
109
 
     * @deprecated To be removed after 2002-sep-30.
110
 
     */
111
 
    HexToUnicodeTransliterator& operator=(const HexToUnicodeTransliterator&);
112
 
 
113
 
    /**
114
 
     * Transliterator API.
115
 
     * @deprecated To be removed after 2002-sep-30.
116
 
     */
117
 
    Transliterator* clone(void) const;
118
 
 
119
 
    /**
120
 
     * Set the patterns recognized by this transliterator.  One or
121
 
     * more patterns may be specified, separated by semicolons (';').
122
 
     * Each pattern contains zero or more prefix characters, one or
123
 
     * more digit characters, and zero or more suffix characters.  The
124
 
     * digit characters indicates optional digits ('#') followed by
125
 
     * required digits ('0').  The total number of digits cannot
126
 
     * exceed 4, and must be at least 1 required digit.  Use a
127
 
     * backslash ('\\') to escape any of the special characters.  An
128
 
     * empty pattern is allowed; it specifies a transliterator that
129
 
     * does nothing.
130
 
     *
131
 
     * <p>Example: "U+0000;<###0>" specifies two patterns.  The first
132
 
     * has a prefix of "U+", exactly four digits, and no suffix.  The
133
 
     * second has a prefix of "<", between one and four digits, and a
134
 
     * suffix of ">".
135
 
     *
136
 
     * <p><pre>
137
 
     * pattern := spec | ( pattern ';' spec )
138
 
     * spec := prefix-char* digit-spec suffix-char*
139
 
     * digit-spec := '#'* '0'+
140
 
     * prefix-char := [^special-char] | '\\' special-char
141
 
     * suffix-char := [^special-char] | '\\' special-char
142
 
     * special-char := ';' | '0' | '#' | '\\'
143
 
     * </pre>
144
 
     * @deprecated To be removed after 2002-sep-30.
145
 
     */
146
 
    void applyPattern(const UnicodeString& thePattern, UErrorCode& status);
147
 
 
148
 
    /**
149
 
     * Return this transliterator's pattern.
150
 
     * @deprecated To be removed after 2002-sep-30.
151
 
     */
152
 
    const UnicodeString& toPattern(void) const;
153
 
 
154
 
    /**
155
 
     * Implements {@link Transliterator#handleTransliterate}.
156
 
     * @deprecated To be removed after 2002-sep-30.
157
 
     */
158
 
    virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
159
 
                                     UBool isIncremental) const;
160
 
};
161
 
 
162
 
inline HexToUnicodeTransliterator::~HexToUnicodeTransliterator() {}
163
 
 
164
 
U_NAMESPACE_END
165
 
 
166
 
#endif