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

policy_mapped_space Class Reference

#include <policy.h>

Inheritance diagram for policy_mapped_space:

Inheritance graph
[legend]
Collaboration diagram for policy_mapped_space:

Collaboration graph
[legend]
List of all members.

Detailed Description

This a base class for region-based white space policy classes.

Definition at line 65 of file policy.h.

Public Types

typedef policy_default strict_policy_T
 Defines type of strict policy for grammar evaluations in strict mode.

Public Member Functions

template<typename ExprT, typename UniverseT>
size_t match (xtl_wrap< ExprT > derived_expr_, UniverseT &universe_)
 Greedy match mixer of custom white space and user-defined regions.
template<typename UniverseT>
bool lower_bound (size_t old_offset_, UniverseT &universe_)
 Moves upper boundary of the universe outside of any region that was specified by the user.
size_t lower_bound (size_t offset_, size_t universe_length_)
 Computes lower boundary of the region provided by the user, if specified offset_ intersects with one of the client regions.
template<typename StringT, typename CharT>
void text_insert_go (node< StringT > &node_, CharT const *pchar_)
 Inserts substring at the position specified by the node.
template<typename StringT>
void text_insert_go (node< StringT > &node_, StringT const &str_)
 Inserts substring at the position specified by the node.
template<typename StringT, typename PolicyT>
void text_insert_go (node< StringT > &node_target_, const_edge< PolicyT, StringT > const &edge_source_)
 Inserts substring specified by the edge_source_ at position specified by the node_target_.
template<typename StringT, typename CharT>
void text_insert_stay (node< StringT > &node_, CharT const *pchar_)
 Inserts substring at the position specified by the node.
template<typename StringT>
void text_insert_stay (node< StringT > &node_, StringT const &str_)
 Inserts substring at the position specified by the node.
template<typename StringT, typename PolicyT>
void text_insert_stay (node< StringT > &node_target_, const_edge< PolicyT, StringT > const &edge_source_)
 Inserts substring at the position specified by the node.
void region_clear ()
 Erases all existing regions from the internal map of client regions.
void region_adjust (size_t after_offset_, int delta_offset_)
 Adjusts internal map of client regions accordingly to the specified position and delta offset.
void region_insert (size_t first_offset_, size_t second_offset_)
 Adds new region to the internal map of client regions.
void region_erase (size_t first_offset_, size_t second_offset_)
 Erase region(s) from the internal map of client regions.
template<typename StringT>
StringT region_difference (StringT const &str_, size_t first_offset_, size_t second_offset_)
 Extracts and returns the substring pointed by two offsets, but excludes client regions intersecting with the offset range specified by input parameters first_offset_ and second_offset_.

Protected Attributes

xtl_region_map m_region_map
 instance of the region map class


Member Typedef Documentation

typedef policy_default strict_policy_T
 

Defines type of strict policy for grammar evaluations in strict mode.

In strict evaluation mode, any white space as well as user-defined regions will are no longer recognized by the lexer. For more information, see strict universe overview.

Definition at line 78 of file policy.h.


Member Function Documentation

size_t lower_bound size_t  offset_,
size_t  universe_length_
[inline]
 

Computes lower boundary of the region provided by the user, if specified offset_ intersects with one of the client regions.

If no intersection is found, or if no client regions exist, function returns unchanged offset_.

Definition at line 144 of file policy.h.

References xtl_region_map::find_not_region().

bool lower_bound size_t  old_offset_,
UniverseT &  universe_
[inline]
 

Moves upper boundary of the universe outside of any region that was specified by the user.

The function returns true if offset was adjusted. The specified old_offset_ is *not* the same as the universe_.first.offset(). If this function returns true, the node universe_.first *must* be relocated to the lower boundary of the region that was found, even if the universe length becomes negative. Therefore, the caller is responsible for checking whether the universe has negative length upon return.

Definition at line 127 of file policy.h.

size_t match xtl_wrap< ExprT >  derived_expr_,
UniverseT &  universe_
[inline]
 

Greedy match mixer of custom white space and user-defined regions.

During grammar evaluation, the CTTL lexer invokes match() function of the derived policy class. The derived class gets a chance to modify upper boundary of the universe accordingly to its definition of white space. However, the user wants to mix the white space with pre-defined regions. This match() function implements the algorithm that mixes up white space grammar expression derived_expr_ with user-defined regions.

This policy implements greedy evaluation algorithm.

Definition at line 95 of file policy.h.

References xtl_wrap::match().

void text_insert_go node< StringT > &  node_target_,
const_edge< PolicyT, StringT > const &  edge_source_
[inline]
 

Inserts substring specified by the edge_source_ at position specified by the node_target_.

All nodes at the insertion point and after are advanced forward as follows: if node position is greater or equal than node_.offset(), the node position is adjusted by the length of the inserted text.

Postcondition: client ranges are also adjusted and remain in sync with the actual text. Any insertions inside client regions are prohibited.

Definition at line 213 of file policy.h.

References xtl_identity_insert_go::adjust(), xtl_region_map::adjust(), const_edge::first, node::offset(), node::parent(), const_edge::parent(), const_edge::second, and const_edge::text().

void text_insert_go node< StringT > &  node_,
StringT const &  str_
[inline]
 

Inserts substring at the position specified by the node.

All nodes at the insertion point and after are advanced forward as follows: if node position is greater or equal than node_.offset(), the node position is adjusted by the length of the inserted text.

Postcondition: client ranges are also adjusted and remain in sync with the actual text. Any insertions inside client regions are prohibited.

Definition at line 169 of file policy.h.

References xtl_identity_insert_go::adjust(), xtl_region_map::adjust(), node::offset(), and node::parent().

void text_insert_stay node< StringT > &  node_target_,
const_edge< PolicyT, StringT > const &  edge_source_
[inline]
 

Inserts substring at the position specified by the node.

All nodes after insertion point are advanced forward. if node position is greater or equal than node_.offset(), to the new position accordingly to the length of the inserted text.

Postcondition: client ranges are also adjusted and remain in sync with the actual text. Any insertions inside client regions are prohibited.

Definition at line 323 of file policy.h.

References xtl_identity_insert_stay::adjust(), xtl_region_map::adjust(), const_edge::first, node::offset(), node::parent(), const_edge::parent(), const_edge::second, and const_edge::text().

void text_insert_stay node< StringT > &  node_,
StringT const &  str_
[inline]
 

Inserts substring at the position specified by the node.

All nodes after insertion point are advanced forward. if node position is greater or equal than node_.offset(), to the new position accordingly to the length of the inserted text.

Postcondition: client ranges are also adjusted and remain in sync with the actual text. Any insertions inside client regions are prohibited.

Definition at line 279 of file policy.h.

References xtl_identity_insert_stay::adjust(), xtl_region_map::adjust(), node::offset(), and node::parent().

void text_insert_stay node< StringT > &  node_,
CharT const *  pchar_
[inline]
 

Inserts substring at the position specified by the node.

All nodes after insertion point are advanced forward. if node position is greater or equal than node_.offset(), to the new position accordingly to the length of the inserted text.

Postcondition: client ranges are also adjusted and remain in sync with the actual text. Any insertions inside client regions are prohibited.

Definition at line 263 of file policy.h.


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