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

const_edge Class Template Reference

#include <const_edge.h>

Inheritance diagram for const_edge:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<typename PolicyT = policy_default, typename StringT = CTTL_STD_STRING>
class cttl::const_edge< PolicyT, StringT >

Implements concept of a logical immutable substring inside user input text.

PolicyT
Template parameter specifying white space policy. Default policy is cttl::policy_default.
StringT
Template parameter specifying type of the encapsulated string. The default is std::string
See also:

Definition at line 210 of file const_edge.h.

Public Types

typedef xtl_const_offset_manager offset_manager_T
 Defines offset manager type for this type of edge.
typedef StringT string_T
 Defines type of encapsulated string.
typedef StringT::value_type char_T
 Defines type of encapsulated character.
typedef StringT value_type
 Defines type of encapsulated substring value.
typedef PolicyT policy_T
 Defines type of space policy.
typedef PolicyT::strict_policy_T strict_policy_T
 Defines type of policy for strict universe.
typedef const_edge< strict_policy_T,
StringT > 
strict_edge_T
 Defines type of edge template specialization for strict grammar evaluation.
typedef node< StringT > node_T
 Defines type of the encapsulated cttl::node objects.

Public Member Functions

PolicyT & space_policy ()
 Returns mutable reference to the encapsulated instance of the white space policy class.
PolicyT const & space_policy () const
 Returns constant reference to the encapsulated instance of the white space policy class.
 const_edge (input< StringT > &inp_, int start_, int finish_)
 Constructs new const_edge from the instance of cttl::input object.
 const_edge (node< StringT > &node_first_, node< StringT > &node_second_)
 Constructs new const_edge from two cttl::node objects.
template<typename Other_policyT>
 const_edge (const_edge< Other_policyT, StringT > const &other_)
 Constructs new const_edge from another edge with different policy type.
 const_edge (const_edge< PolicyT, StringT > const &other_)
 Constructs exact copy of the existing edge.
template<typename Other_policyT>
 const_edge (const_edge< Other_policyT, StringT > const &other_, PolicyT &policy_)
 Constructs new const_edge from another edge with policy type explicitly provided by the user.
const_edge< PolicyT, StringT > & operator= (const_edge< PolicyT, StringT > const &other_)
 Edge assignment.
 operator StringT () const
 Extracts underlying text from the substring pointed by this edge.
input< StringT > & parent ()
 Returns reference to the parent cttl::input object.
input< StringT > const & parent () const
 Returns constant reference to the parent cttl::input object.
StringT text () const
 Returns the underlying substring of text.
int length () const
 Calculates and returns length of the encapsulated substring.
void push ()
 Pushes offsets of const_edge to the stack maintained by the parent cttl::input object.
void pop ()
 Pops offsets of const_edge from the stack maintained by the parent cttl::input object.
void pop_discard ()
 Pops and discards offsets of const_edge from the stack maintained by the parent cttl::input object.
void region_insert ()
 Inserts region described by the current positions of the edge into white space policy object that supports client-defined regions.
void region_erase ()
 Erases region(s) described by the current positions of the edge from white space policy object that supports client-defined regions.
StringT region_difference ()
 Extracts and returns text corresponding to the the current positions of the edge, excluding client regions that intersect with the edge offset range.
void text_tolower ()
 Converts underlying text to lowercase.
void text_toupper ()
 Converts underlying text to uppercase.
template<typename ExprT>
xtl_wrap< xtl_edge< const_edge<
PolicyT, StringT >, xtl_wrap<
ExprT > > > 
operator() (xtl_wrap< ExprT > const &expr_)
 Implements grammar expression adaptor behavior of the edge object.

Public Attributes

node< StringT > first
 Stores first cttl::node of the edge, representing the upper boundary.
node< StringT > second
 Stores second cttl::node of the edge, representing the lower boundary.

Static Protected Member Functions

PolicyT & default_policy ()
 Creates static instance of the white space policy.

Protected Attributes

PolicyT & m_space_policy
 Stores reference to the white space policy instance supported by this particular edge.


Member Typedef Documentation

typedef const_edge< strict_policy_T, StringT > strict_edge_T
 

Defines type of edge template specialization for strict grammar evaluation.

For more information, see strict universe overview.

Reimplemented in edge.

Definition at line 242 of file const_edge.h.

typedef PolicyT::strict_policy_T strict_policy_T
 

Defines type of policy for strict universe.

C++ type designated as strict policy type must provide a default constructor. The strict policy is always constructed as a static member of the strict universe using the default constructor, and therefore, the strict policy must have stateless implementation.

Reimplemented in edge.

Definition at line 236 of file const_edge.h.


Constructor & Destructor Documentation

const_edge input< StringT > &  inp_,
int  start_,
int  finish_
[inline]
 

Constructs new const_edge from the instance of cttl::input object.

Parameters:
inp_ Mutable reference to cttl::input object
start_ Identity of the first node.
finish_ Identity of the second node.

Definition at line 319 of file const_edge.h.

References cttl::first().

const_edge node< StringT > &  node_first_,
node< StringT > &  node_second_
[inline]
 

Constructs new const_edge from two cttl::node objects.

Parameters:
node_first_ Upper boundary of the edge.
node_second_ Lower boundary of the edge.

Definition at line 336 of file const_edge.h.

References cttl::first(), and node::parent().

const_edge const_edge< Other_policyT, StringT > const &  other_  )  [inline]
 

Constructs new const_edge from another edge with different policy type.

Other_policyT
Template parameter specifying white space policy of another edge.
Parameters:
other_ instance of existing edge.
Postcondition:
This particular constructor allows to convert existing edge to an edge with const_edge::default_policy().

Definition at line 361 of file const_edge.h.

References cttl::first().

const_edge const_edge< Other_policyT, StringT > const &  other_,
PolicyT &  policy_
[inline]
 

Constructs new const_edge from another edge with policy type explicitly provided by the user.

Other_policyT
Template parameter specifying white space policy of another edge.
Parameters:
other_ instance of existing edge.
policy_ mutable reference to an instance of the policy object that will be retained for the lifetime of this edge.
Postcondition:
The program should not let the policy_ to go out of scope while this instance of const_edge is in service.

Definition at line 400 of file const_edge.h.

References cttl::first().


Member Function Documentation

PolicyT& default_policy  )  [inline, static, protected]
 

Creates static instance of the white space policy.

Precondition:
Multi-threaded environments can rely on default policy only if the policy is stateless. Otherwise, each thread should create its own instance of the policy object and explicitly provide it to the constructor of the edge class, since construction of local static object is not thread-safe. PolicyT must be default constructible.

Definition at line 273 of file const_edge.h.

int length  )  const [inline]
 

Calculates and returns length of the encapsulated substring.

Returns:
This function may return negative value of the length, if the following precondition is false:
U.first.offset() <= U.second.offset()

where U is an instance of the edge object.

Definition at line 470 of file const_edge.h.

References cttl::first(), and node::identity().

operator StringT  )  const [inline]
 

Extracts underlying text from the substring pointed by this edge.

Precondition:
0 <= first.offset() <= second.offset() <= inp.length()
where inp.length() is the length of the parent cttl::input.

Definition at line 437 of file const_edge.h.

xtl_wrap< xtl_edge< const_edge< PolicyT, StringT >, xtl_wrap< ExprT > > > operator() xtl_wrap< ExprT > const &  expr_  )  [inline]
 

Implements grammar expression adaptor behavior of the edge object.

ExprT
Template parameter specifying type of grammar expression, which is determined by the C++ compiler at compile time.
Parameters:
expr_ CTTL grammar expression

Definition at line 594 of file const_edge.h.

const_edge< PolicyT, StringT >& operator= const_edge< PolicyT, StringT > const &  other_  )  [inline]
 

Edge assignment.

Parameters:
other_ instance of existing edge.
Edge assignment mathces the behavior of the copy constructor.

See also:

Reimplemented in edge.

Definition at line 419 of file const_edge.h.

References const_edge::first, cttl::first(), and const_edge::second.

StringT region_difference  )  [inline]
 

Extracts and returns text corresponding to the the current positions of the edge, excluding client regions that intersect with the edge offset range.

For example of the client region-aware policy, see documentation for pre-defined policy specialized for "<A href="parsing.html#policy_flag_follow_region">follow region</A>" flag.

Definition at line 553 of file const_edge.h.

References cttl::first(), and node::offset().

void region_erase  )  [inline]
 

Erases region(s) described by the current positions of the edge from white space policy object that supports client-defined regions.

For example of the client region-aware policy, see documentation for pre-defined policy specialized for "<A href="parsing.html#policy_flag_follow_region">follow region</A>" flag.

Definition at line 535 of file const_edge.h.

References cttl::first(), and node::offset().

void region_insert  )  [inline]
 

Inserts region described by the current positions of the edge into white space policy object that supports client-defined regions.

For example of the client region-aware policy, see documentation for pre-defined policy specialized for "<A href="parsing.html#policy_flag_follow_region">follow region</A>" flag.

Definition at line 516 of file const_edge.h.

References cttl::first(), and node::offset().


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