2001-07-27 00:18:53 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2001, International Business Machines Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 07/26/01 aliu Creation.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
#ifndef QUANT_H
|
|
|
|
#define QUANT_H
|
|
|
|
|
2002-02-07 01:07:55 +00:00
|
|
|
#include "unicode/unifunct.h"
|
2001-07-27 00:18:53 +00:00
|
|
|
#include "unicode/unimatch.h"
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2002-02-07 01:07:55 +00:00
|
|
|
class Quantifier : public UnicodeFunctor, public UnicodeMatcher {
|
2001-07-27 00:18:53 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2001-07-30 23:23:16 +00:00
|
|
|
enum { MAX = 0x7FFFFFFF };
|
|
|
|
|
2002-02-07 01:07:55 +00:00
|
|
|
Quantifier(UnicodeFunctor *adoptedMatcher,
|
2001-07-27 00:18:53 +00:00
|
|
|
uint32_t minCount, uint32_t maxCount);
|
|
|
|
|
|
|
|
Quantifier(const Quantifier& o);
|
|
|
|
|
|
|
|
virtual ~Quantifier();
|
|
|
|
|
|
|
|
/**
|
2002-02-07 01:07:55 +00:00
|
|
|
* UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
|
|
|
|
* and return the pointer.
|
|
|
|
*/
|
|
|
|
virtual UnicodeMatcher* toMatcher() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement UnicodeFunctor
|
2001-07-27 00:18:53 +00:00
|
|
|
*/
|
2002-02-07 01:07:55 +00:00
|
|
|
virtual UnicodeFunctor* clone() const;
|
2001-07-27 00:18:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement UnicodeMatcher
|
|
|
|
*/
|
|
|
|
virtual UMatchDegree matches(const Replaceable& text,
|
|
|
|
int32_t& offset,
|
|
|
|
int32_t limit,
|
2001-10-30 23:55:09 +00:00
|
|
|
UBool incremental);
|
2001-07-27 00:18:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement UnicodeMatcher
|
|
|
|
*/
|
|
|
|
virtual UnicodeString& toPattern(UnicodeString& result,
|
|
|
|
UBool escapeUnprintable = FALSE) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement UnicodeMatcher
|
|
|
|
*/
|
|
|
|
virtual UBool matchesIndexValue(uint8_t v) const;
|
|
|
|
|
2002-03-20 00:42:02 +00:00
|
|
|
/**
|
|
|
|
* UnicodeFunctor API
|
|
|
|
*/
|
|
|
|
virtual void setData(const TransliterationRuleData*);
|
|
|
|
|
2001-07-27 00:18:53 +00:00
|
|
|
private:
|
|
|
|
|
2001-07-30 23:23:16 +00:00
|
|
|
static void appendNumber(UnicodeString& result, int32_t n);
|
|
|
|
|
2002-02-07 01:07:55 +00:00
|
|
|
UnicodeFunctor* matcher; // owned
|
2001-07-27 00:18:53 +00:00
|
|
|
|
|
|
|
uint32_t minCount;
|
|
|
|
|
|
|
|
uint32_t maxCount;
|
|
|
|
};
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2001-07-27 00:18:53 +00:00
|
|
|
#endif
|