Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

rep.h

Go to the documentation of this file.
00001 /*
00002 **************************************************************************
00003 * Copyright (C) 1999-2001, International Business Machines Corporation and
00004 * others. All Rights Reserved.
00005 **************************************************************************
00006 *   Date        Name        Description
00007 *   11/17/99    aliu        Creation.  Ported from java.  Modified to
00008 *                           match current UnicodeString API.  Forced
00009 *                           to use name "handleReplaceBetween" because
00010 *                           of existing methods in UnicodeString.
00011 **************************************************************************
00012 */
00013 
00014 #ifndef REP_H
00015 #define REP_H
00016 
00017 #include "unicode/utypes.h"
00018 #include "unicode/uobject.h"
00019 
00020 U_NAMESPACE_BEGIN
00021 
00022 class UnicodeString;
00023 
00065 class U_COMMON_API Replaceable : public UObject {
00066 
00067 public:
00072     virtual ~Replaceable();
00073 
00079     inline int32_t length() const;
00080 
00088     inline UChar charAt(int32_t offset) const;
00089 
00102     inline UChar32 char32At(int32_t offset) const;
00103 
00114     virtual void extractBetween(int32_t start,
00115                                 int32_t limit,
00116                                 UnicodeString& target) const = 0;
00117 
00138     virtual void handleReplaceBetween(int32_t start,
00139                                       int32_t limit,
00140                                       const UnicodeString& text) = 0;
00141     // Note: All other methods in this class take the names of
00142     // existing UnicodeString methods.  This method is the exception.
00143     // It is named differently because all replace methods of
00144     // UnicodeString return a UnicodeString&.  The 'between' is
00145     // required in order to conform to the UnicodeString naming
00146     // convention; API taking start/length are named <operation>, and
00147     // those taking start/limit are named <operationBetween>.  The
00148     // 'handle' is added because 'replaceBetween' and
00149     // 'doReplaceBetween' are already taken.
00150 
00166     virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0;
00167 
00177     virtual UBool hasMetaData() const;
00178 
00179 protected:
00180 
00184     Replaceable();
00185 
00189     virtual int32_t getLength() const = 0;
00190 
00194     virtual UChar getCharAt(int32_t offset) const = 0;
00195 
00199     virtual UChar32 getChar32At(int32_t offset) const = 0;
00200 };
00201 
00202 inline Replaceable::Replaceable() {}
00203 
00204 inline Replaceable::~Replaceable() {}
00205 
00206 inline int32_t
00207 Replaceable::length() const {
00208     return getLength();
00209 }
00210 
00211 inline UChar
00212 Replaceable::charAt(int32_t offset) const {
00213     return getCharAt(offset);
00214 }
00215 
00216 inline UChar32
00217 Replaceable::char32At(int32_t offset) const {
00218     return getChar32At(offset);
00219 }
00220 
00221 // See unistr.cpp for Replaceable::hasMetaData()
00222 
00223 U_NAMESPACE_END
00224 
00225 #endif

Generated on Thu Aug 15 14:13:28 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001