00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1999, 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 00019 class UnicodeString; 00020 00044 class U_COMMON_API Replaceable { 00045 00046 public: 00047 00052 virtual ~Replaceable(); 00053 00059 virtual int32_t length() const = 0; 00060 00068 virtual UChar charAt(UTextOffset offset) const = 0; 00069 00079 virtual UChar32 char32At(UTextOffset offset) const = 0; 00080 00099 virtual void extractBetween(UTextOffset srcStart, 00100 UTextOffset srcLimit, 00101 UChar* dst, 00102 UTextOffset dstStart = 0) const = 0; 00103 00117 virtual void handleReplaceBetween(UTextOffset start, 00118 UTextOffset limit, 00119 const UnicodeString& text) = 0; 00120 // Note: All other methods in this class take the names of 00121 // existing UnicodeString methods. This method is the exception. 00122 // It is named differently because all replace methods of 00123 // UnicodeString return a UnicodeString&. The 'between' is 00124 // required in order to conform to the UnicodeString naming 00125 // convention; API taking start/length are named <operation>, and 00126 // those taking start/limit are named <operationBetween>. The 00127 // 'handle' is added because 'replaceBetween' and 00128 // 'doReplaceBetween' are already taken. 00129 00150 virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0; 00151 00152 protected: 00153 00157 Replaceable(); 00158 }; 00159 00160 inline Replaceable::Replaceable() {} 00161 00162 inline Replaceable::~Replaceable() {} 00163 00164 #endif