cttl::policy_default Struct Reference

Provides default implementation of CTTL space policy. More...

#include <policy_state.h>

Inheritance diagram for cttl::policy_default:

cttl::policy_space< flag_cpp_comments > cttl::policy_space< flag_follow_space > cttl::policy_space< flag_greedy|flag_cpp_comments > cttl::policy_space< flag_greedy|flag_follow_space > cttl::policy_space< flag_greedy >

List of all members.

Public Types

typedef policy_default strict_policy_T
 Defines space policy for strict-mode grammar evaluation.

Public Member Functions

 policy_default ()
 Default constructor.

Static Public Member Functions

static size_t lower_bound (size_t offset_, size_t)
 Validates offset_ position against void regions and adjusts the position accordigly.
template<typename SubstrT >
static bool lower_bound (size_t, SubstrT &)
 Moves upper boundary of the parseable substring outside of a void region specified by the user.
template<typename SubstrT >
static size_t match (SubstrT &substr_)
 Defines CTTL grammar production rule to evaluate grammar expression matching the white space.
static void region_adjust (size_t, int)
 Adjusts map of void regions according to the specified position and delta offset.
template<typename StringT >
static StringT region_difference (StringT const &str_, size_t first_offset_, size_t second_offset_)
 Returns substring pointed by the range of offsets, excluding existing void regions.
static void region_erase (size_t, size_t)
 Erases void region(s).
static void region_insert (size_t, size_t)
 Creates new void region.


Detailed Description

Provides default implementation of CTTL space policy.

Remarks:
All user-defined policy classes should directly or indirectly derive from this class.
See also:

Definition at line 59 of file policy_state.h.


Member Typedef Documentation

Defines space policy for strict-mode grammar evaluation.

Remarks:
  • Strict policy must provide default constructor.
  • Strict policy is allocated statically.
  • For thread safety concerns, strict policy class must have stateless implementation.

Definition at line 70 of file policy_state.h.


Constructor & Destructor Documentation

cttl::policy_default::policy_default (  ) 

Default constructor.

Definition at line 202 of file policy_state.h.

00204             :
00205         m_flags( xtl_flag_default )
00206 #endif //CTTL_STATEFUL_RUNTIME_MATCH
00207         {
00208         }


Member Function Documentation

static size_t cttl::policy_default::lower_bound ( size_t  offset_,
size_t   
) [static]

Validates offset_ position against void regions and adjusts the position accordigly.

Parameters:
offset_ specifies entry position into the map of void regions.
Returns:
Adjusted position, if intersection with a void region was found, unchanged position otherwise.

Definition at line 139 of file policy_state.h.

00140         {
00141             return offset_;
00142         }

template<typename SubstrT >
static bool cttl::policy_default::lower_bound ( size_t  ,
SubstrT &   
) [static]

Moves upper boundary of the parseable substring outside of a void region specified by the user.

Template Parameters:
SubstrT specifies type of the parseable substring, such as cttl::const_edge or cttl::edge.
Returns:
true if offset is adjusted, false otherwise.
Postcondition:
If this function returns true, the upper boundary of the substr_ is relocated even if the substring length becomes invalid. Therefore, the caller is responsible for checking whether the substr_ has valid length upon return.

Definition at line 123 of file policy_state.h.

00124         {
00125             return false;
00126         }

template<typename SubstrT >
static size_t cttl::policy_default::match ( SubstrT &  substr_  )  [static]

Defines CTTL grammar production rule to evaluate grammar expression matching the white space.

Template Parameters:
SubstrT specifies type of the parseable substring, such as cttl::const_edge or cttl::edge.
Parameters:
substr_ references to the parseable substring.
Returns:
absolute position of the substring upper boundary after expression that matches white space is evaluated.
Postcondition:
The function must
  • always succeed
  • return a valid offset within the specified substring.
Remarks:
Default policy implements strict parsing of the user input. This implementation of match is empty. It does no white space recognition whatsoever.

Reimplemented in cttl::policy_space< flag_follow_space >, cttl::policy_space< flag_greedy|flag_follow_space >, cttl::policy_space< flag_cpp_comments >, and cttl::policy_space< flag_greedy|flag_cpp_comments >.

Definition at line 100 of file policy_state.h.

00101         {
00102             return substr_.first.offset();
00103         }

static void cttl::policy_default::region_adjust ( size_t  ,
int   
) [static]

Adjusts map of void regions according to the specified position and delta offset.

Definition at line 148 of file policy_state.h.

00149         {
00150         }

template<typename StringT >
static StringT cttl::policy_default::region_difference ( StringT const &  str_,
size_t  first_offset_,
size_t  second_offset_ 
) [static]

Returns substring pointed by the range of offsets, excluding existing void regions.

Definition at line 167 of file policy_state.h.

00168         {
00169             return str_.substr(
00170                 first_offset_,
00171                 second_offset_ - first_offset_
00172                 );
00173         }

static void cttl::policy_default::region_erase ( size_t  ,
size_t   
) [static]

Erases void region(s).

Definition at line 158 of file policy_state.h.

00159         {
00160         }

static void cttl::policy_default::region_insert ( size_t  ,
size_t   
) [static]

Creates new void region.

Definition at line 153 of file policy_state.h.

00154         {
00155         }


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

Generated on Sun Aug 23 13:43:45 2009 for Common Text Transformation Library by  doxygen 1.5.9