qBittorrent
IndexRange< Index, IndexDiff > Class Template Reference

#include <indexrange.h>

Classes

class  Iterator
 

Public Types

using IndexType = Index
 
using IndexDiffType = IndexDiff
 

Public Member Functions

constexpr IndexRange ()
 
constexpr IndexRange (const IndexType first, const IndexDiffType size)
 
constexpr IndexRange (const IndexInterval< IndexType > &interval)
 
constexpr Iterator begin () const
 
constexpr Iterator end () const
 
constexpr IndexDiffType size () const
 
constexpr IndexType first () const
 
constexpr IndexType last () const
 
constexpr bool isEmpty () const
 

Private Attributes

IndexType m_first
 
IndexDiffType m_size
 

Detailed Description

template<typename Index, typename IndexDiff = Index>
class IndexRange< Index, IndexDiff >

Definition at line 70 of file indexrange.h.

Member Typedef Documentation

◆ IndexDiffType

template<typename Index , typename IndexDiff = Index>
using IndexRange< Index, IndexDiff >::IndexDiffType = IndexDiff

Definition at line 74 of file indexrange.h.

◆ IndexType

template<typename Index , typename IndexDiff = Index>
using IndexRange< Index, IndexDiff >::IndexType = Index

Definition at line 73 of file indexrange.h.

Constructor & Destructor Documentation

◆ IndexRange() [1/3]

template<typename Index , typename IndexDiff = Index>
constexpr IndexRange< Index, IndexDiff >::IndexRange ( )
inlineconstexpr

Definition at line 118 of file indexrange.h.

119  : m_first {0}
120  , m_size {0}
121  {
122  }
IndexType m_first
Definition: indexrange.h:167
IndexDiffType m_size
Definition: indexrange.h:168

◆ IndexRange() [2/3]

template<typename Index , typename IndexDiff = Index>
constexpr IndexRange< Index, IndexDiff >::IndexRange ( const IndexType  first,
const IndexDiffType  size 
)
inlineconstexpr

Definition at line 124 of file indexrange.h.

125  : m_first {first}
126  , m_size {size}
127  {
128  }
constexpr IndexDiffType size() const
Definition: indexrange.h:146
constexpr IndexType first() const
Definition: indexrange.h:151

◆ IndexRange() [3/3]

template<typename Index , typename IndexDiff = Index>
constexpr IndexRange< Index, IndexDiff >::IndexRange ( const IndexInterval< IndexType > &  interval)
inlineconstexpr

Definition at line 130 of file indexrange.h.

131  : m_first {interval.first()}
132  , m_size {interval.last() - interval.first() + 1}
133  {
134  }
constexpr IndexType last() const
Definition: indexrange.h:52
constexpr IndexType first() const
Definition: indexrange.h:47

Member Function Documentation

◆ begin()

template<typename Index , typename IndexDiff = Index>
constexpr Iterator IndexRange< Index, IndexDiff >::begin ( ) const
inlineconstexpr

Definition at line 136 of file indexrange.h.

137  {
138  return Iterator {m_first};
139  }

References IndexRange< Index, IndexDiff >::m_first.

◆ end()

template<typename Index , typename IndexDiff = Index>
constexpr Iterator IndexRange< Index, IndexDiff >::end ( ) const
inlineconstexpr

Definition at line 141 of file indexrange.h.

142  {
143  return Iterator {m_first + m_size};
144  }

References IndexRange< Index, IndexDiff >::m_first, and IndexRange< Index, IndexDiff >::m_size.

◆ first()

template<typename Index , typename IndexDiff = Index>
constexpr IndexType IndexRange< Index, IndexDiff >::first ( ) const
inlineconstexpr

◆ isEmpty()

template<typename Index , typename IndexDiff = Index>
constexpr bool IndexRange< Index, IndexDiff >::isEmpty ( ) const
inlineconstexpr

Definition at line 161 of file indexrange.h.

162  {
163  return (m_size == 0);
164  }

References IndexRange< Index, IndexDiff >::m_size.

Referenced by BitTorrent::TorrentImpl::availableFileFractions().

Here is the caller graph for this function:

◆ last()

template<typename Index , typename IndexDiff = Index>
constexpr IndexType IndexRange< Index, IndexDiff >::last ( ) const
inlineconstexpr

◆ size()

template<typename Index , typename IndexDiff = Index>
constexpr IndexDiffType IndexRange< Index, IndexDiff >::size ( ) const
inlineconstexpr

Definition at line 146 of file indexrange.h.

147  {
148  return m_size;
149  }

References IndexRange< Index, IndexDiff >::m_size.

Referenced by BitTorrent::TorrentImpl::availableFileFractions().

Here is the caller graph for this function:

Member Data Documentation

◆ m_first

template<typename Index , typename IndexDiff = Index>
IndexType IndexRange< Index, IndexDiff >::m_first
private

◆ m_size

template<typename Index , typename IndexDiff = Index>
IndexDiffType IndexRange< Index, IndexDiff >::m_size
private

The documentation for this class was generated from the following file: