20 #ifndef RIPPLE_BASICS_RANGESET_H_INCLUDED
21 #define RIPPLE_BASICS_RANGESET_H_INCLUDED
23 #include <ripple/beast/core/LexicalCast.h>
25 #include <boost/algorithm/string.hpp>
26 #include <boost/icl/closed_interval.hpp>
27 #include <boost/icl/interval_set.hpp>
69 using RangeSet = boost::icl::interval_set<T, std::less, ClosedInterval<T>>;
84 if (ci.first() == ci.last())
105 for (
auto const& interval : rs)
130 boost::split(tokens, s, boost::algorithm::is_any_of(
","));
131 for (
auto const& t : tokens)
133 boost::split(intervals, t, boost::algorithm::is_any_of(
"-"));
134 switch (intervals.
size())
154 rs.insert(
range(front, back));
184 if (rs.empty() || t == minVal)
190 return boost::icl::last(tgt);
bool from_string(RangeSet< T > &rs, std::string const &s)
Convert the given styled string to a RangeSet.
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
std::optional< T > prevMissing(RangeSet< T > const &rs, T t, T minVal=0)
Find the largest value not in the set that is less than a given value.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
boost::icl::interval_set< T, std::less, ClosedInterval< T > > RangeSet
A set of closed intervals over the domain T.
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.