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 /* THIS API IS NOT NEEDED, BUT KEPT HERE AS A COMMENT IN 00100 CASE OF FUTURE NEED. CURRENTLY INDIVIDUAL CHARACTER 00101 ACCESS SUFFICES. */ 00102 /* virtual void extractBetween(UTextOffset srcStart, 00103 UTextOffset srcLimit, 00104 UChar* dst, 00105 UTextOffset dstStart = 0) const = 0; */ 00106 00120 virtual void handleReplaceBetween(UTextOffset start, 00121 UTextOffset limit, 00122 const UnicodeString& text) = 0; 00123 // Note: All other methods in this class take the names of 00124 // existing UnicodeString methods. This method is the exception. 00125 // It is named differently because all replace methods of 00126 // UnicodeString return a UnicodeString&. The 'between' is 00127 // required in order to conform to the UnicodeString naming 00128 // convention; API taking start/length are named <operation>, and 00129 // those taking start/limit are named <operationBetween>. The 00130 // 'handle' is added because 'replaceBetween' and 00131 // 'doReplaceBetween' are already taken. 00132 00153 virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0; 00154 00155 protected: 00156 00160 Replaceable(); 00161 }; 00162 00163 inline Replaceable::Replaceable() {} 00164 00165 inline Replaceable::~Replaceable() {} 00166 00167 #endif