24#ifndef MYSQL_STRCONV_DECODE_REPEAT_H
25#define MYSQL_STRCONV_DECODE_REPEAT_H
45template <
class Repeat_optional_t>
52 [[nodiscard]]
static Repeat_optional_t
optional() {
53 return Repeat_optional_t{1};
58 [[nodiscard]]
static Repeat_optional_t
at_most(std::integral
auto max_arg) {
59 return Repeat_optional_t{max_arg};
64 [[nodiscard]]
static Repeat_optional_t
any() {
69 [[nodiscard]] std::size_t
max()
const {
return m_max; }
105 [[nodiscard]]
constexpr std::size_t
min()
const {
return 0; }
129 template <std::
integral Int_t>
130 explicit Repeat(Int_t min_arg, Int_t max_arg)
132 if constexpr (std::signed_integral<Int_t>) {
133 assert(min_arg >= 0);
135 assert(max_arg >= min_arg);
144 template <std::
integral Int_t>
150 return Repeat{std::size_t(min_arg),
156 template <std::
integral Int_t>
158 return Repeat{min_arg, max_arg};
171 [[nodiscard]] std::size_t
min()
const {
return m_min; }
181 std::same_as<Test, Repeat> || std::same_as<Test, Repeat_optional>;
Represents a range of integers for which the lower bound is 0, representing the number of repetitions...
Definition: repeat.h:93
Repeat_optional(std::integral auto max)
Construct an object representing a range of 0 up to the given number of repetitions.
Definition: repeat.h:101
constexpr std::size_t min() const
Return the mimimum number of repetitions, inclusive; the return value is always 0.
Definition: repeat.h:105
Repeat_optional()
Default-construct a Repeat_optional object representing a range of 0..1 repetitions,...
Definition: repeat.h:97
Represents a range of integers specifying the number of times a token or pattern should be repeated w...
Definition: repeat.h:119
static Repeat range(Int_t min_arg, Int_t max_arg)
Return a Repeat object representing a range of at least min_arg and at most max_arg repetitions.
Definition: repeat.h:157
static Repeat exact(std::integral auto count)
Return a Repeat object representing exactly the given number of repetitions.
Definition: repeat.h:163
std::size_t min() const
Return the mimimum number of repetitions, inclusive.
Definition: repeat.h:171
static Repeat at_least(Int_t min_arg)
Return a Repeat object representing min_arg or more repetitions (bounded only by std::numeric_limits)
Definition: repeat.h:145
Repeat(Int_t min_arg, Int_t max_arg)
Construct an object representing a range of at least min_arg and at most max_arg repetitions.
Definition: repeat.h:130
std::size_t m_min
The mimimum number of repetitions, inclusive.
Definition: repeat.h:175
static Repeat one()
Return a Repeat object representing exactly one repetition.
Definition: repeat.h:168
Repeat()
Default-construct a Repeat object representing exactly 1 repetition.
Definition: repeat.h:122
Repeat(std::integral auto count)
Construct an object representing exactly the given number of repetitions.
Definition: repeat.h:125
Common base class for the Repeat and Repeat_optional classes, providing functionality for representin...
Definition: repeat.h:46
std::size_t m_max
The maximum number of repetitions, inclusive.
Definition: repeat.h:73
Repeat_base(std::integral auto max)
Construct a new object with the given maximum.
Definition: repeat.h:49
static Repeat_optional_t at_most(std::integral auto max_arg)
Return a Repeat object representing between 0 and min_arg repetitions.
Definition: repeat.h:58
std::size_t max() const
Return the maximum number of repetitions, inclusive.
Definition: repeat.h:69
static Repeat_optional_t any()
Return a Repeat_optional object representing any number of repetitions from 0 and up (bounded only by...
Definition: repeat.h:64
static Repeat_optional_t optional()
Return a Repeat_optional object representing zero or one instances.
Definition: repeat.h:52
True if Test is either Repeat or Repeat_optional.
Definition: repeat.h:180
static int count
Definition: myisam_ftdump.cc:45
Definition: fts0fts.cc:236
ValueType max(X &&first)
Definition: gtid.h:103
Definition: gtid_binary_format.h:41
Define std::hash<Gtid>.
Definition: gtid.h:355
static const char digits[]
Definition: stacktrace.cc:644