summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/i18n/quant.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /intl/icu/source/i18n/quant.h
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'intl/icu/source/i18n/quant.h')
-rw-r--r--intl/icu/source/i18n/quant.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/intl/icu/source/i18n/quant.h b/intl/icu/source/i18n/quant.h
new file mode 100644
index 0000000000..427a6b0480
--- /dev/null
+++ b/intl/icu/source/i18n/quant.h
@@ -0,0 +1,126 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+ **********************************************************************
+ * Copyright (C) 2001-2011, 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/utypes.h"
+
+#if !UCONFIG_NO_TRANSLITERATION
+
+#include "unicode/unifunct.h"
+#include "unicode/unimatch.h"
+
+U_NAMESPACE_BEGIN
+
+class Quantifier : public UnicodeFunctor, public UnicodeMatcher {
+
+ public:
+
+ enum { MAX = 0x7FFFFFFF };
+
+ Quantifier(UnicodeFunctor *adoptedMatcher,
+ uint32_t minCount, uint32_t maxCount);
+
+ Quantifier(const Quantifier& o);
+
+ virtual ~Quantifier();
+
+ /**
+ * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
+ * and return the pointer.
+ * @return the UnicodeMatcher pointer.
+ */
+ virtual UnicodeMatcher* toMatcher() const override;
+
+ /**
+ * Implement UnicodeFunctor
+ * @return a copy of the object.
+ */
+ virtual Quantifier* clone() const override;
+
+ /**
+ * Implement UnicodeMatcher
+ * @param text the text to be matched
+ * @param offset on input, the index into text at which to begin
+ * matching. On output, the limit of the matched text. The
+ * number of matched characters is the output value of offset
+ * minus the input value. Offset should always point to the
+ * HIGH SURROGATE (leading code unit) of a pair of surrogates,
+ * both on entry and upon return.
+ * @param limit the limit index of text to be matched. Greater
+ * than offset for a forward direction match, less than offset for
+ * a backward direction match. The last character to be
+ * considered for matching will be text.charAt(limit-1) in the
+ * forward direction or text.charAt(limit+1) in the backward
+ * direction.
+ * @param incremental if true, then assume further characters may
+ * be inserted at limit and check for partial matching. Otherwise
+ * assume the text as given is complete.
+ * @return a match degree value indicating a full match, a partial
+ * match, or a mismatch. If incremental is false then
+ * U_PARTIAL_MATCH should never be returned.
+ */
+ virtual UMatchDegree matches(const Replaceable& text,
+ int32_t& offset,
+ int32_t limit,
+ UBool incremental) override;
+
+ /**
+ * Implement UnicodeMatcher
+ * @param result Output param to receive the pattern.
+ * @param escapeUnprintable if True then escape the unprintable characters.
+ * @return A reference to 'result'.
+ */
+ virtual UnicodeString& toPattern(UnicodeString& result,
+ UBool escapeUnprintable = false) const override;
+
+ /**
+ * Implement UnicodeMatcher
+ * @param v the given index value.
+ * @return true if this rule matches the given index value.
+ */
+ virtual UBool matchesIndexValue(uint8_t v) const override;
+
+ /**
+ * Implement UnicodeMatcher
+ */
+ virtual void addMatchSetTo(UnicodeSet& toUnionTo) const override;
+
+ /**
+ * UnicodeFunctor API
+ */
+ virtual void setData(const TransliterationRuleData*) override;
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ */
+ virtual UClassID getDynamicClassID() const override;
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for this class.
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+
+ private:
+
+ UnicodeFunctor* matcher; // owned
+
+ uint32_t minCount;
+
+ uint32_t maxCount;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_TRANSLITERATION */
+
+#endif