Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

rep.h

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 U_NAMESPACE_BEGIN
00019 
00020 class UnicodeString;
00021 
00057 class U_COMMON_API Replaceable {
00058 
00059 public:
00064     virtual ~Replaceable();
00065 
00071     inline int32_t length() const;
00072 
00080     inline UChar charAt(UTextOffset offset) const;
00081 
00091     inline UChar32 char32At(UTextOffset offset) const;
00092 
00103     virtual void extractBetween(UTextOffset start,
00104                                 UTextOffset limit,
00105                                 UnicodeString& target) const = 0;
00106 
00127     virtual void handleReplaceBetween(UTextOffset start,
00128                                       UTextOffset limit,
00129                                       const UnicodeString& text) = 0;
00130     // Note: All other methods in this class take the names of
00131     // existing UnicodeString methods.  This method is the exception.
00132     // It is named differently because all replace methods of
00133     // UnicodeString return a UnicodeString&.  The 'between' is
00134     // required in order to conform to the UnicodeString naming
00135     // convention; API taking start/length are named <operation>, and
00136     // those taking start/limit are named <operationBetween>.  The
00137     // 'handle' is added because 'replaceBetween' and
00138     // 'doReplaceBetween' are already taken.
00139 
00161     virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0;
00162 
00163 protected:
00164 
00168     Replaceable();
00169 
00173     virtual int32_t getLength() const = 0;
00174 
00178     virtual UChar getCharAt(UTextOffset offset) const = 0;
00179 
00183     virtual UChar32 getChar32At(UTextOffset offset) const = 0;
00184 };
00185 
00186 inline Replaceable::Replaceable() {}
00187 
00188 inline Replaceable::~Replaceable() {}
00189 
00190 inline int32_t
00191 Replaceable::length() const {
00192     return getLength();
00193 }
00194 
00195 inline UChar
00196 Replaceable::charAt(UTextOffset offset) const {
00197     return getCharAt(offset);
00198 }
00199 
00200 inline UChar32
00201 Replaceable::char32At(UTextOffset offset) const {
00202     return getChar32At(offset);
00203 }
00204 
00205 U_NAMESPACE_END
00206 
00207 #endif

Generated on Mon Mar 4 23:18:35 2002 for ICU 2.0 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002