Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
util::Range< T > Class Template Reference

represents a "Range" w/ notion of ordering. A range is defined by a pair of "start" and "end" values. This is stored in std::pair
attribute util::Range::_window. This attribute is protected so that the start/end cannot
be changed w/o a check that start is always less than end. Note the specialization
requires a template class T to have less operator implemented.
More...

#include <Range.h>

Public Member Functions

 Range (const T &start, const T &end)
 Enforced ctor. start must be less than end. More...
 
 ~Range ()
 Default dtor. More...
 
const T & Start () const
 "start" accessor More...
 
const T & End () const
 "end" accessor More...
 
void Set (const T &s, const T &e)
 Setter. More...
 
bool operator< (const Range &rhs) const
 
bool operator> (const Range &rhs) const
 
bool operator== (const Range &rhs) const
 
bool operator!= (const Range &rhs) const
 
bool operator< (const T &rhs) const
 
bool operator> (const T &rhs) const
 
void Merge (const Range &a)
 Merge two util::Range into 1. More...
 

Protected Attributes

std::pair< T, T > _window
 Protected to avoid user's illegal modification on first/second (sorry users!) More...
 

Private Member Functions

 Range ()
 Default ctor is hidden. More...
 

Friends

class UniqueRangeSet< T >
 

Detailed Description

template<class T>
class util::Range< T >

represents a "Range" w/ notion of ordering. A range is defined by a pair of "start" and "end" values. This is stored in std::pair
attribute util::Range::_window. This attribute is protected so that the start/end cannot
be changed w/o a check that start is always less than end. Note the specialization
requires a template class T to have less operator implemented.

Definition at line 34 of file Range.h.

Constructor & Destructor Documentation

template<class T>
util::Range< T >::Range ( )
inlineprivate

Default ctor is hidden.

Definition at line 40 of file Range.h.

40 {}
template<class T>
util::Range< T >::Range ( const T &  start,
const T &  end 
)
inline

Enforced ctor. start must be less than end.

Definition at line 44 of file Range.h.

46  : _window(start,end)
47  { if(start>end) throw std::runtime_error("Inserted invalid range: end before start."); }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
template<class T>
util::Range< T >::~Range ( )
inline

Default dtor.

Definition at line 50 of file Range.h.

50 {}

Member Function Documentation

template<class T>
const T& util::Range< T >::End ( void  ) const
inline

"end" accessor

Definition at line 55 of file Range.h.

55 { return _window.second; }
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
template<class T>
void util::Range< T >::Merge ( const Range< T > &  a)
inline

Merge two util::Range into 1.

Definition at line 85 of file Range.h.

85  {
86  _window.first = std::min( _window.first, a.Start() );
87  _window.second = std::max( _window.second, a.End() );
88  }
static int max(int a, int b)
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
template<class T>
bool util::Range< T >::operator!= ( const Range< T > &  rhs) const
inline

Definition at line 73 of file Range.h.

74  {return !( (*this) == rhs ); }
template<class T>
bool util::Range< T >::operator< ( const Range< T > &  rhs) const
inline

Definition at line 67 of file Range.h.

68  {return ( _window.second < rhs.Start() ); }
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
template<class T>
bool util::Range< T >::operator< ( const T &  rhs) const
inline

Definition at line 79 of file Range.h.

80  {return (_window.second < rhs); }
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
template<class T>
bool util::Range< T >::operator== ( const Range< T > &  rhs) const
inline

Definition at line 71 of file Range.h.

72  {return ( _window.first == rhs.Start() && _window.second == rhs.End() ); }
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
template<class T>
bool util::Range< T >::operator> ( const Range< T > &  rhs) const
inline

Definition at line 69 of file Range.h.

70  {return ( _window.first > rhs.End() ); }
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
template<class T>
bool util::Range< T >::operator> ( const T &  rhs) const
inline

Definition at line 81 of file Range.h.

82  {return (_window.first > rhs); }
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
template<class T>
void util::Range< T >::Set ( const T &  s,
const T &  e 
)
inline

Setter.

Definition at line 57 of file Range.h.

58  {
59  if(s>=e) throw std::runtime_error("Inserted invalid range: end before start.");
60  _window.first = s;
61  _window.second = e;
62  }
const double e
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92
static QCString * s
Definition: config.cpp:1042
template<class T>
const T& util::Range< T >::Start ( ) const
inline

"start" accessor

Definition at line 53 of file Range.h.

53 { return _window.first; }
std::pair< T, T > _window
Protected to avoid user&#39;s illegal modification on first/second (sorry users!)
Definition: Range.h:92

Friends And Related Function Documentation

template<class T>
friend class UniqueRangeSet< T >
friend

Definition at line 36 of file Range.h.

Member Data Documentation

template<class T>
std::pair<T,T> util::Range< T >::_window
protected

Protected to avoid user's illegal modification on first/second (sorry users!)

Definition at line 92 of file Range.h.


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