ICU 56.1: rep.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

rep.h
Go to the documentation of this file.
1 /*
2 **************************************************************************
3 * Copyright (C) 1999-2012, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 **************************************************************************
6 * Date Name Description
7 * 11/17/99 aliu Creation. Ported from java. Modified to
8 * match current UnicodeString API. Forced
9 * to use name "handleReplaceBetween" because
10 * of existing methods in UnicodeString.
11 **************************************************************************
12 */
13
14 #ifndef REP_H
15 #define REP_H
16
17 #include "unicode/uobject.h"
18
24 U_NAMESPACE_BEGIN
25
26 class UnicodeString;
27
71 class U_COMMON_API Replaceable : public UObject {
72
73 public:
78 virtual ~Replaceable();
79
85 inline int32_t length() const;
86
94 inline UChar charAt(int32_t offset) const;
95
108 inline UChar32 char32At(int32_t offset) const;
109
120 virtual void extractBetween(int32_t start,
121 int32_t limit,
122 UnicodeString& target) const = 0;
123
144 virtual void handleReplaceBetween(int32_t start,
145 int32_t limit,
146 const UnicodeString& text) = 0;
147 // Note: All other methods in this class take the names of
148 // existing UnicodeString methods. This method is the exception.
149 // It is named differently because all replace methods of
150 // UnicodeString return a UnicodeString&. The 'between' is
151 // required in order to conform to the UnicodeString naming
152 // convention; API taking start/length are named <operation>, and
153 // those taking start/limit are named <operationBetween>. The
154 // 'handle' is added because 'replaceBetween' and
155 // 'doReplaceBetween' are already taken.
156
172 virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0;
173
183 virtual UBool hasMetaData() const;
184
200 virtual Replaceable *clone() const;
201
202 protected:
203
208 inline Replaceable();
209
210 /*
211 * Assignment operator not declared. The compiler will provide one
212 * which does nothing since this class does not contain any data members.
213 * API/code coverage may show the assignment operator as present and
214 * untested - ignore.
215 * Subclasses need this assignment operator if they use compiler-provided
216 * assignment operators of their own. An alternative to not declaring one
217 * here would be to declare and empty-implement a protected or public one.
218 Replaceable &Replaceable::operator=(const Replaceable &);
219 */
220
225 virtual int32_t getLength() const = 0;
226
231 virtual UChar getCharAt(int32_t offset) const = 0;
232
237 virtual UChar32 getChar32At(int32_t offset) const = 0;
238 };
239
240 inline Replaceable::Replaceable() {}
241
242 inline int32_t
243 Replaceable::length() const {
244 return getLength();
245 }
246
247 inline UChar
248 Replaceable::charAt(int32_t offset) const {
249 return getCharAt(offset);
250 }
251
252 inline UChar32
253 Replaceable::char32At(int32_t offset) const {
254 return getChar32At(offset);
255 }
256
257 // There is no rep.cpp, see unistr.cpp for Replaceable function implementations.
258
259 U_NAMESPACE_END
260
261 #endif
icu::Replaceable
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
Definition: rep.h:71
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:332
uobject.h
C++ API: Common ICU base class UObject.
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Definition: utypes.h:357
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:293
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234