protocol/RangeArg: add IsAll()
This commit is contained in:
parent
590687fdea
commit
2915d2dd0f
@ -200,8 +200,7 @@ db_selection_print(Response &r, Partition &partition,
|
|||||||
: VisitPlaylist();
|
: VisitPlaylist();
|
||||||
|
|
||||||
if (sort == TAG_NUM_OF_ITEM_TYPES) {
|
if (sort == TAG_NUM_OF_ITEM_TYPES) {
|
||||||
if (window.start > 0 ||
|
if (!window.IsAll())
|
||||||
window.end < (unsigned)std::numeric_limits<int>::max())
|
|
||||||
s = [s, window, &i](const LightSong &song){
|
s = [s, window, &i](const LightSong &song){
|
||||||
const bool in_window = i >= window.start && i < window.end;
|
const bool in_window = i >= window.start && i < window.end;
|
||||||
++i;
|
++i;
|
||||||
|
@ -30,6 +30,18 @@ struct RangeArg {
|
|||||||
static constexpr RangeArg All() {
|
static constexpr RangeArg All() {
|
||||||
return { 0, std::numeric_limits<unsigned>::max() };
|
return { 0, std::numeric_limits<unsigned>::max() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr bool operator==(RangeArg other) const noexcept {
|
||||||
|
return start == other.start && end == other.end;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool operator!=(RangeArg other) const noexcept {
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr bool IsAll() const noexcept {
|
||||||
|
return *this == All();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user