Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

xtl_region_map Class Reference

#include <xtl_region_map.h>

List of all members.


Detailed Description

Manages user-defined regions of user input text.

Region map encapsulates private instance of the STL std::map object.

Definition at line 51 of file xtl_region_map.h.

Public Member Functions

 xtl_region_map ()
 Default constructor required by node::get_region_none().
void adjust (size_t after_offset_, int delta_offset_)
 Adjusts map of regions accordingly to the specified position and delta.
void insert (size_t from_offset_, size_t to_offset_)
 Create new client region.
void erase (size_t from_offset_, size_t to_offset_)
 Erase region(s) within the specified region of offsets.
bool intersection (size_t offset_) const
 Tests if offset falls inside any region.
size_t find_not_region (size_t offset_, size_t str_length_) const
 Calculates lower boundary of intersecting range.
size_t find_upper_boundary (size_t offset_, size_t str_length_, size_t default_offset_) const
 Finds upper boundary of next region.
size_t find_lower_boundary (size_t offset_, size_t str_length_, size_t default_offset_) const
 Finds lower boundary of next region.
std::pair< size_t, size_t > find_region (size_t offset_, size_t str_length_, size_t default_offset_) const
 Finds offset pair corresponding to the next region.
void clear ()
 Clears region map.
bool empty () const
 Returns true if map of regions is empty, false otherwise.
bool intersection (size_t from_offset_, size_t to_offset_) const
 Returns true if region specified by two offsets intersects with any existing regions.
bool contains (size_t from_offset_, size_t to_offset_) const
 Returns true if region specified by two offsets is contained entirely by an existing region.
template<typename StringT>
StringT text_difference (StringT const &str_, size_t from_offset_, size_t to_offset_) const
 Returns substring pointed by two offsets but excludes existing ranges.


Member Function Documentation

void adjust size_t  after_offset_,
int  delta_offset_
[inline]
 

Adjusts map of regions accordingly to the specified position and delta.

Adjustments guarantee integrity of regions as long as insertions and deletions are made outside of any existing region.

Precondition:
if deletion has been made such that it included existing region(s), the caller is responsible for calling xtl_region_map::erase() prior to calling this function.

Definition at line 75 of file xtl_region_map.h.

Referenced by policy_mapped_space::region_adjust(), policy_mapped_space::text_insert_go(), and policy_mapped_space::text_insert_stay().

size_t find_lower_boundary size_t  offset_,
size_t  str_length_,
size_t  default_offset_
const [inline]
 

Finds lower boundary of next region.

If no such region exist, function returns default_offset_ provided by the caller (e.g. StringT::npos).

Definition at line 281 of file xtl_region_map.h.

size_t find_not_region size_t  offset_,
size_t  str_length_
const [inline]
 

Calculates lower boundary of intersecting range.

Returns:
new offset
Remarks:
If specified offset is outside of any region to begin with, it remains unchanged. Otherwise, the function calculates and returns new offset guaranteed to be in the space of the input outside of any region. Such position could be the EOF position. ( EOF position is always outside any region. ) If offset is beyond the actual size of the user input (specified by str_length_), the function returns the str_length_ provided by the user.

Definition at line 216 of file xtl_region_map.h.

Referenced by policy_mapped_space::lower_bound().

std::pair< size_t, size_t > find_region size_t  offset_,
size_t  str_length_,
size_t  default_offset_
const [inline]
 

Finds offset pair corresponding to the next region.

If specified offset_ is located inside one of the regions, that particular region is chosen. If no such region is found, the function returns a pair of default_offset_ values, provided by the user. (e.g. StringT::npos).

Definition at line 311 of file xtl_region_map.h.

size_t find_upper_boundary size_t  offset_,
size_t  str_length_,
size_t  default_offset_
const [inline]
 

Finds upper boundary of next region.

If specified offset_ is located inside a region, that particular region is chosen, therefore offset returned by this function can be less then the offset_ specified. If no such region exist, function returns default_offset_ provided by the user (such as npos, for example).

Definition at line 252 of file xtl_region_map.h.

void insert size_t  from_offset_,
size_t  to_offset_
[inline]
 

Create new client region.

Precondition:
Function assumes that the current state of the map is such that no offset regions overlap.
Postcondition:
Existing regions are unionized if necessary.

Definition at line 112 of file xtl_region_map.h.

Referenced by policy_mapped_space::region_insert().

bool intersection size_t  offset_  )  const [inline]
 

Tests if offset falls inside any region.

Returns:
true if given offset is outside of any region, false otherwise.

Definition at line 179 of file xtl_region_map.h.


The documentation for this class was generated from the following file:
Generated on Thu Nov 2 17:46:58 2006 for Common Text Transformation Library by  doxygen 1.3.9.1