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
|
|
|
|
|
|
|
|
#include "unicode/unimatch.h"
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2001-07-27 00:18:53 +00:00
|
|
|
class Quantifier : public UnicodeMatcher {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2001-07-30 23:23:16 +00:00
|
|
|
enum { MAX = 0x7FFFFFFF };
|
|
|
|
|
2001-07-27 00:18:53 +00:00
|
|
|
Quantifier(UnicodeMatcher *adopted,
|
|
|
|
uint32_t minCount, uint32_t maxCount);
|
|
|
|
|
|
|
|
Quantifier(const Quantifier& o);
|
|
|
|
|
|
|
|
virtual ~Quantifier();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement UnicodeMatcher
|
|
|
|
*/
|
|
|
|
virtual UnicodeMatcher* clone() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2001-07-30 23:23:16 +00:00
|
|
|
static void appendNumber(UnicodeString& result, int32_t n);
|
|
|
|
|
2001-07-27 00:18:53 +00:00
|
|
|
UnicodeMatcher* matcher; // owned
|
|
|
|
|
|
|
|
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
|