blob: 9bb4b482b55f1697b06688d5ac64cc66aedb0566 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#ifndef __SOURCE_NUMPARSE_VALIDATORS_H__
#define __SOURCE_NUMPARSE_VALIDATORS_H__
#include "numparse_types.h"
#include "static_unicode_sets.h"
U_NAMESPACE_BEGIN namespace numparse {
namespace impl {
class ValidationMatcher : public NumberParseMatcher {
public:
bool match(StringSegment&, ParsedNumber&, UErrorCode&) const override {
// No-op
return false;
}
bool smokeTest(const StringSegment&) const override {
// No-op
return false;
}
void postProcess(ParsedNumber& result) const override = 0;
};
class RequireAffixValidator : public ValidationMatcher, public UMemory {
public:
void postProcess(ParsedNumber& result) const override;
UnicodeString toString() const override;
};
class RequireCurrencyValidator : public ValidationMatcher, public UMemory {
public:
void postProcess(ParsedNumber& result) const override;
UnicodeString toString() const override;
};
class RequireDecimalSeparatorValidator : public ValidationMatcher, public UMemory {
public:
RequireDecimalSeparatorValidator() = default; // leaves instance in valid but undefined state
RequireDecimalSeparatorValidator(bool patternHasDecimalSeparator);
void postProcess(ParsedNumber& result) const override;
UnicodeString toString() const override;
private:
bool fPatternHasDecimalSeparator;
};
class RequireNumberValidator : public ValidationMatcher, public UMemory {
public:
void postProcess(ParsedNumber& result) const override;
UnicodeString toString() const override;
};
/**
* Wraps a {@link Multiplier} for use in the number parsing pipeline.
*/
class MultiplierParseHandler : public ValidationMatcher, public UMemory {
public:
MultiplierParseHandler() = default; // leaves instance in valid but undefined state
MultiplierParseHandler(::icu::number::Scale multiplier);
void postProcess(ParsedNumber& result) const override;
UnicodeString toString() const override;
private:
::icu::number::Scale fMultiplier;
};
} // namespace impl
} // namespace numparse
U_NAMESPACE_END
#endif //__SOURCE_NUMPARSE_VALIDATORS_H__
#endif /* #if !UCONFIG_NO_FORMATTING */
|