protocol/RangeArg: add static method OpenEnded()
This commit is contained in:
parent
103194e32d
commit
6e1940e930
|
@ -94,7 +94,7 @@ ParseCommandArgRange(const char *s)
|
|||
s);
|
||||
|
||||
if (test == test2)
|
||||
value = std::numeric_limits<int>::max();
|
||||
return RangeArg::OpenEnded(range.start);
|
||||
|
||||
if (value < 0)
|
||||
throw FormatProtocolError(ACK_ERROR_ARG,
|
||||
|
|
|
@ -25,8 +25,15 @@
|
|||
struct RangeArg {
|
||||
unsigned start, end;
|
||||
|
||||
/**
|
||||
* Construct an open-ended range starting at the given index.
|
||||
*/
|
||||
static constexpr RangeArg OpenEnded(unsigned start) noexcept {
|
||||
return { start, std::numeric_limits<unsigned>::max() };
|
||||
}
|
||||
|
||||
static constexpr RangeArg All() noexcept {
|
||||
return { 0, std::numeric_limits<unsigned>::max() };
|
||||
return OpenEnded(0);
|
||||
}
|
||||
|
||||
constexpr bool operator==(RangeArg other) const noexcept {
|
||||
|
|
Loading…
Reference in New Issue