ICU 54.1 54.1

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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