okteta
numberrange.h
Go to the documentation of this file.
51 // FIXME: gcc 3.4.5 on windows gives an internal_compiler_error if ctor/dtor are defined with the keyword inline
130 inline NumberRange<N,S> NumberRange<N,S>::fromWidth( N startIndex, S width ) { return NumberRange(startIndex,startIndex+width-1); }
132 inline NumberRange<N,S> NumberRange<N,S>::fromWidth( S width ) { return NumberRange<N,S>(0,width-1); }
135 inline bool NumberRange<N,S>::operator==( const NumberRange<N,S>& other ) const { return Range<N>::operator==(other); }
138 inline NumberRange<N,S>& NumberRange<N,S>::operator=( const NumberRange<N,S>& other ) { Range<N>::operator=(other); return *this; }
141 inline S NumberRange<N,S>::width() const { return Range<N>::isValid() ? Range<N>::end()-Range<N>::start()+1 : 0; }
148 inline void NumberRange<N,S>::setByWidth( N other, S width ) { Range<N>::setStart( other ); Range<N>::setEnd( other+width-1 ); }
150 inline void NumberRange<N,S>::setStartByWidth( S width ) { Range<N>::setStart( Range<N>::end()-width+1 ); }
152 inline void NumberRange<N,S>::setEndByWidth( S width ) { Range<N>::setEnd( Range<N>::start()+width-1 ); }
154 inline void NumberRange<N,S>::setStartNextBehind( const NumberRange<N,S>& other ) { Range<N>::setStart( other.nextBehindEnd() ); }
158 inline void NumberRange<N,S>::setEndNextBefore( const NumberRange<N,S>& other ) { Range<N>::setEnd( other.nextBeforeStart() ); }
162 inline void NumberRange<N,S>::restrictEndByWidth( S width ) { Range<N>::restrictEndTo( Range<N>::start()+width-1 ); }
165 inline void NumberRange<N,S>::moveToStart( N other ) { Range<N>::setEnd( other+width()-1 ); Range<N>::setStart( other ); }
167 inline void NumberRange<N,S>::moveToEnd( N end ) { Range<N>::setStart( end-width()+1 ); Range<N>::setEnd( end ); }
205 { return NumberRange<N,S>( localRange.start()+Range<N>::start(), localRange.end()+Range<N>::start() ); }
216 { return Range<N>::start() <= other.nextBehindEnd() && other.nextBeforeStart() <= Range<N>::end(); }
220 { const bool mergeable = ( other.nextBehindEnd() == Range<N>::start() ); if( mergeable ) Range<N>::setStart( other.start() ); return mergeable; }
223 { const bool mergeable = ( nextBehindEnd() == other.start() ); if( mergeable ) Range<N>::setEnd( other.end() ); return mergeable; }
void setEndNextBefore(const NumberRange &other)
sets the first index of the range's range one behind the other's end If one of both is invalid or the...
Definition: numberrange.h:158
describes a range of numbers which have a distance of 1 each
Definition: numberrange.h:37
NumberRange localRange(const NumberRange &other) const
Definition: numberrange.h:201
bool isJoinable(const NumberRange &other) const
Definition: numberrange.h:215
NumberRange removeLocal(const NumberRange &removeRange)
Definition: numberrange.h:191
NumberRange subRange(const NumberRange &localRange) const
Definition: numberrange.h:204
void setStartByWidth(S width)
sets the first index of the range's range to be width-1 before the end If the range is invalid the be...
Definition: numberrange.h:150
void adaptToReplacement(N offset, S removedLength, S insertedLength)
Definition: numberrange.h:226
static NumberRange fromWidth(N startIndex, S width)
constructs a range by width
Definition: numberrange.h:130
N startForInclude(const NumberRange &other) const
Definition: numberrange.h:208
void setEndByWidth(S width)
sets the last index of the range's range to be width-1 behind the start If the range is invalid the b...
Definition: numberrange.h:152
void setStartNextBehind(const NumberRange &other)
sets the first index of the range's range one behind the other's end If one of both is invalid the be...
Definition: numberrange.h:154
NumberRange remove(const NumberRange &removeRange)
Definition: numberrange.h:184
bool operator==(const NumberRange &other) const
Definition: numberrange.h:135
NumberRange & operator=(const NumberRange &other)
Definition: numberrange.h:138
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.