chromium/third_party/icu/source/i18n/numparse_types.h

// © 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 __NUMPARSE_TYPES_H__
#define __NUMPARSE_TYPES_H__

#include "unicode/uobject.h"
#include "number_decimalquantity.h"
#include "string_segment.h"

U_NAMESPACE_BEGIN
namespace numparse {
namespace impl {

// Forward-declarations
class ParsedNumber;

result_flags_t;
parse_flags_t;

/** Flags for the type result_flags_t */
enum ResultFlags {};

/** Flags for the type parse_flags_t */
enum ParseFlags {};


// TODO: Is this class worthwhile?
template<int32_t stackCapacity>
class CompactUnicodeString {};


/**
 * Struct-like class to hold the results of a parsing routine.
 *
 * @author sffc
 */
// Exported as U_I18N_API for tests
class U_I18N_API ParsedNumber {};


/**
 * The core interface implemented by all matchers used for number parsing.
 *
 * Given a string, there should NOT be more than one way to consume the string with the same matcher
 * applied multiple times. If there is, the non-greedy parsing algorithm will be unhappy and may enter an
 * exponential-time loop. For example, consider the "A Matcher" that accepts "any number of As". Given
 * the string "AAAA", there are 2^N = 8 ways to apply the A Matcher to this string: you could have the A
 * Matcher apply 4 times to each character; you could have it apply just once to all the characters; you
 * could have it apply to the first 2 characters and the second 2 characters; and so on. A better version
 * of the "A Matcher" would be for it to accept exactly one A, and allow the algorithm to run it
 * repeatedly to consume a string of multiple As. The A Matcher can implement the Flexible interface
 * below to signal that it can be applied multiple times in a row.
 *
 * @author sffc
 */
// Exported as U_I18N_API for tests
class U_I18N_API NumberParseMatcher {};


/**
 * Interface for use in arguments.
 */
// Exported as U_I18N_API for tests
class U_I18N_API MutableMatcherCollection {};


} // namespace impl
} // namespace numparse
U_NAMESPACE_END

#endif //__NUMPARSE_TYPES_H__
#endif /* #if !UCONFIG_NO_FORMATTING */