#include <range.hpp>
Public Types | |
typedef TSet::value_type | value_type |
typedef TSet::const_reference | reference |
typedef TSet::const_reference | const_reference |
typedef TSet::const_iterator | iterator |
typedef TSet::const_iterator | const_iterator |
typedef TSet::size_type | size_type |
typedef TSet::difference_type | difference_type |
typedef TSet::const_reverse_iterator | reverse_iterator |
typedef TSet::const_reverse_iterator | const_reverse_iterator |
Public Methods | |
const_iterator | begin () const |
const_iterator | end () const |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
bool | empty () const |
size_type | size () const |
size_type | max_size () const |
bool | insert (const value_type &) |
void | erase (iterator i) |
void | erase (const value_type &) |
void | erase (iterator a, iterator b) |
void | swap (range_set< T > &rhs) |
Private Types | |
typedef std::vector< range< T > > | TSet |
Private Attributes | |
TSet | set |
|
Definition at line 63 of file range.hpp. Referenced by range_set< long >::begin(), and range_set< long >::end(). |
|
|
|
Definition at line 67 of file range.hpp. Referenced by range_set< long >::rbegin(), and range_set< long >::rend(). |
|
|
|
Definition at line 62 of file range.hpp. Referenced by range_set< long >::erase(). |
|
|
|
|
|
Definition at line 64 of file range.hpp. Referenced by range_set< long >::max_size(), and range_set< long >::size(). |
|
|
|
Definition at line 59 of file range.hpp. Referenced by range_set< T >::erase(). |
|
Definition at line 71 of file range.hpp. Referenced by CodeParser::CheckCodeRecursively(), range_set< T >::erase(), and CodeParser::ExcludeFileRange().
00071 { return set.begin(); } |
|
Definition at line 77 of file range.hpp.
00077 { return set.empty(); } |
|
Definition at line 72 of file range.hpp. Referenced by CodeParser::CheckCodeRecursively(), CodeParser::ExcludeFileRange(), and range_set< T >::insert().
00072 { return set.end(); } |
|
Definition at line 88 of file range.hpp.
00089 { set.erase(const_cast<typename TSet::iterator>(a),const_cast<typename TSet::iterator>(b)); } |
|
Definition at line 172 of file range.hpp. References range_set< T >::begin(), range_set< T >::set, and range_set< T >::value_type.
00173 { 00174 // testa range invalido o vuoto 00175 if (value.begin >= value.end) 00176 return; 00177 00178 typename TSet::iterator i = std::lower_bound(set.begin(),set.end(),value,range_comp()); 00179 00180 if (i==set.end()) 00181 return; 00182 00183 // se non interseca con nessuno esci 00184 if ( value.end <= (*i).begin ) 00185 return; 00186 00187 // tronca successivo 00188 if ( value.begin > (*i).begin ) 00189 { 00190 // sdoppia range 00191 if ( value.end < (*i).end) 00192 { 00193 T begin = (*i).begin; 00194 (*i).begin = value.end; 00195 set.insert(i,value_type(begin,value.begin)); 00196 return; 00197 } 00198 (*i).end = value.begin; 00199 ++i; 00200 } 00201 00202 // cerca tutti i range che si devono togliere del tutto 00203 typename TSet::iterator ii = i; 00204 while( ii != set.end() && value.end >= (*ii).end ) 00205 ++ii; 00206 00207 // toglie parte in eccesso al range corrente 00208 if ( value.end >= (*ii).begin ) 00209 (*ii).begin = value.end; 00210 00211 // toglie ranges in eccesso 00212 set.erase(i,ii); 00213 } |
|
Definition at line 85 of file range.hpp.
00086 { set.erase(const_cast<typename TSet::iterator>(i)); } |
|
Definition at line 122 of file range.hpp. References range_set< T >::end(), and range_set< T >::set. Referenced by CodeParser::CheckCodeRecursively().
00123 { 00124 // testa range invalido o vuoto 00125 if (value.begin >= value.end) 00126 return true; 00127 00128 typename TSet::iterator i = std::lower_bound(set.begin(),set.end(),value,range_comp()); 00129 00130 // se fuori range inserisce e basta 00131 if (i==set.end() || value.end < (*i).begin) 00132 { 00133 set.insert(i,value); 00134 return false; 00135 } 00136 00137 // estende inizio se necessario 00138 bool res = true; 00139 if (value.begin < (*i).begin) 00140 { 00141 (*i).begin = value.begin; 00142 res = false; 00143 } 00144 00145 // estende fine se necessario 00146 if (value.end >= (*i).end) 00147 { 00148 // calcola fine range e range in eccesso 00149 T end = value.end; 00150 typename TSet::iterator ii = i; 00151 while(++ii != set.end()) 00152 { 00153 if (end >=(*ii).begin && end<=(*ii).end) 00154 end = (*ii).end; 00155 if (end < (*ii).end) 00156 break; 00157 } 00158 00159 // estendi range finale 00160 (*i).end = end; 00161 00162 // cancella ranges in eccesso 00163 set.erase(++i,ii); 00164 00165 // il range non era interamente presente 00166 return false; 00167 } 00168 return res; 00169 } |
|
Definition at line 79 of file range.hpp.
00079 { return set.max_size(); } |
|
Definition at line 73 of file range.hpp.
00073 { return set.rbegin(); } |
|
Definition at line 74 of file range.hpp.
00074 { return set.rend(); } |
|
Definition at line 78 of file range.hpp.
00078 { return set.size(); } |
|
Definition at line 90 of file range.hpp.
|
|
Definition at line 51 of file range.hpp. Referenced by range_set< long >::begin(), range_set< long >::empty(), range_set< long >::end(), range_set< T >::erase(), range_set< long >::erase(), range_set< T >::insert(), range_set< long >::max_size(), range_set< long >::rbegin(), range_set< long >::rend(), range_set< long >::size(), and range_set< long >::swap(). |