24constexpr bool validRange(sal_uInt16 wid1, sal_uInt16 wid2) {
return wid1 != 0 && wid1 <= wid2; }
26constexpr bool validGap(sal_uInt16 wid1, sal_uInt16 wid2) {
return wid2 > wid1; }
28template <sal_uInt16 WID1, sal_uInt16 WID2>
constexpr bool validRanges()
33template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16 WID3, sal_uInt16... WIDs>
41constexpr std::size_t
rangeSize(sal_uInt16 wid1, sal_uInt16 wid2)
44 return wid2 - wid1 + 1;
48template <sal_uInt16... WIDs>
struct Items_t
51 template <sal_uInt16 WID1, sal_uInt16 WID2, sal_uInt16... Rest>
52 static constexpr void fill(
typename Array::iterator it)
56 if constexpr (
sizeof...(Rest) > 0)
61 assert(svl::detail::validRanges<WIDs...>());
63 fill<WIDs...>(
a.begin());
71template <sal_uInt16... WIDs>
inline static constexpr auto Items =
Items_t<WIDs...>{};
86 bool m_bOwnRanges =
false;
91 : m_pairs(wids.release())
96 template <sal_uInt16... WIDs>
98 : m_pairs(
svl::Items_t<WIDs...>::
value.data())
100 , m_bOwnRanges(false)
115 bool empty() const noexcept {
return m_size == 0; }
116 sal_Int32
size() const noexcept {
return m_size; }
119 assert(
idx >= 0 &&
idx <
size() &&
"index out of range");
enumrange< T >::Iterator begin(enumrange< T >)
constexpr bool validRange(sal_uInt16 wid1, sal_uInt16 wid2)
constexpr bool validRanges()
constexpr bool validGap(sal_uInt16 wid1, sal_uInt16 wid2)
constexpr std::size_t rangeSize(sal_uInt16 wid1, sal_uInt16 wid2)
static constexpr auto Items
Most of the time, the which ranges we point at are a compile-time literal.
bool empty() const noexcept
sal_Int32 size() const noexcept
WhichRangesContainer(WhichRangesContainer const &other)
WhichRangesContainer(std::unique_ptr< WhichPair[]> wids, sal_Int32 nSize)
const_iterator begin() const noexcept
WhichPair const * const_iterator
WhichRangesContainer(svl::Items_t< WIDs... >)
WhichPair const & operator[](sal_Int32 idx) const noexcept
WhichRangesContainer()=default
const_iterator end() const noexcept
static constexpr void fill(typename Array::iterator it)
static constexpr Array value
std::array< WhichPair, sizeof...(WIDs)/2 > Array
static constexpr Array make()
constexpr bool operator==(TypedWhichId< T > const &lhs, TypedWhichId< T > rhs)
#define SAL_WARN_UNUSED_RESULT
std::pair< sal_uInt16, sal_uInt16 > WhichPair