00001 /* 00002 * Copyright (C) 2001, International Business Machines Corporation and others. All Rights Reserved. 00003 ********************************************************************** 00004 * Date Name Description 00005 * 07/18/01 aliu Creation. 00006 ********************************************************************** 00007 */ 00008 #ifndef UNIMATCH_H 00009 #define UNIMATCH_H 00010 00011 #include "unicode/utypes.h" 00012 00013 U_NAMESPACE_BEGIN 00014 00015 class Replaceable; 00016 class UnicodeString; 00017 00022 enum UMatchDegree { 00029 U_MISMATCH, 00030 00040 U_PARTIAL_MATCH, 00041 00049 U_MATCH 00050 }; 00051 00056 class U_I18N_API UnicodeMatcher { 00057 00058 public: 00059 00063 virtual ~UnicodeMatcher(); 00064 00070 virtual UnicodeMatcher* clone() const = 0; 00071 00117 virtual UMatchDegree matches(const Replaceable& text, 00118 int32_t& offset, 00119 int32_t limit, 00120 UBool incremental) = 0; 00121 00133 virtual UnicodeString& toPattern(UnicodeString& result, 00134 UBool escapeUnprintable = FALSE) const = 0; 00135 00142 virtual UBool matchesIndexValue(uint8_t v) const = 0; 00143 00155 static UClassID getStaticClassID(void) { return (UClassID)&fgClassID; } 00156 00179 virtual UClassID getDynamicClassID(void) const { return getStaticClassID(); }; 00180 00181 private: 00182 00187 static const char fgClassID; 00188 00189 protected: 00190 00191 UnicodeMatcher(); 00192 }; 00193 00194 inline UnicodeMatcher::UnicodeMatcher() {} 00195 inline UnicodeMatcher::~UnicodeMatcher() {} 00196 00197 U_NAMESPACE_END 00198 00199 #endif