Commit 6e1940e9 authored by Max Kellermann's avatar Max Kellermann

protocol/RangeArg: add static method OpenEnded()

parent 103194e3
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment