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

node Class Template Reference

#include <node.h>

List of all members.


Detailed Description

template<typename StringT = CTTL_STD_STRING>
class cttl::node< StringT >

Keeps track of a logical position inside user input text.

StringT
Template parameter specifying type of the encapsulated string. The default is std::string
See also:

Definition at line 56 of file node.h.

Public Types

typedef StringT string_T
 Defines type of encapsulated string.
typedef StringT::value_type char_T
 Defines type of encapsulated character.
typedef StringT::value_type value_type
 Defines node value type.

Public Member Functions

 node (input< StringT > &inp_, int identity_)
 Constructs node from @ cttl::input object and specific identity.
 node (node< StringT > const &other_, int identity_)
 Constructs node from another node of the same exact type, but different identity.
 node (node< StringT > const &other_)
 Copy constructor manufactures exact copy of the object.
node< StringT > & operator= (node< StringT > const &other_)
 Assignment matches behavior of the copy constructor.
node< StringT > & operator= (size_t offset_)
 Assignment of types convertible to size_t changes offset of the node.
node< StringT > & operator+= (StringT const &str_)
 Addition-assignment of string matches behavior of cttl::node::insert_go().
node< StringT > & operator-= (StringT const &str_)
 Subtraction-assignment of string matches behavior of cttl::node::insert_stay().
input< StringT > & parent ()
 Returns mutable reference to the parent cttl::input object.
input< StringT > const & parent () const
 Returns constant reference to the parent cttl::input object.
int identity () const
 Returns identity of the node.
int identity (int identity_)
 Changes identity of the node.
template<typename PredicateT>
bool find_class (PredicateT(*iswhat_)(PredicateT))
 Moves node position forward to the lower boundary of the specified character class.
template<typename PredicateT>
bool rfind_class (PredicateT(*iswhat_)(PredicateT))
 Moves node position backward to the upper boundary of the specified character class.
size_t offset () const
 Returns node offset.
size_t offset (size_t offset_)
 Changes offset of the node.
size_t line () const
 Returns line number corresponding to the current offset of the node.
size_t go_line (size_t line_)
 Moves node position to the beginning of the specified line.
size_t push ()
 Pushes node offset to the container's general purpose stack of offsets.
size_t pop ()
 Pops node offset from the container's general purpose stack of offsets.
void pop_discard ()
 Pops offset from the container's general purpose stack of offsets and throws it away.
size_t go_bof ()
 Moves node position to the beginning of the input text.
size_t go_eof ()
 Moves node position to the ending of the input text.
size_t go_line_next ()
 Moves node position to the beginning of the next line.
size_t go_line_previous ()
 Moves node position to the beginning of the previous line.
size_t go_line_home ()
 Moves node position to the beginning of the current line.
size_t go_line_home (size_t line_)
 Moves node position to the beginning of the specified line.
size_t go_line_end ()
 Moves node position to the ending of the current line.
size_t go_line_end (size_t line_)
 Moves node position to the ending of the specified line.
size_t insert_go (StringT const &str_)
 Inserts text at the current position of the node.
void insert_stay (StringT const &str_)
 Inserts text at the current position of the node.
char_T const & operator[] (int subscript_) const
 Returns character from the input character sequence at the offset relative to the current position of the node.
char_Toperator[] (int subscript_)
 Returns reference to the character in the input character sequence at the offset relative to the current position of the node.
template<typename ExprT>
xtl_wrap< xtl_node< node<
StringT >, xtl_wrap< ExprT > > > 
operator() (xtl_wrap< ExprT > const &expr_)
 Implements grammar expression adaptor behavior of the node.

Protected Attributes

int m_identity
 Identifies node inside offset identity vector of the parent cttl::input class.
input< StringT > & m_input
 Stores reference to the parent cttl::input object.


Member Function Documentation

bool find_class PredicateT(*)(PredicateT)  iswhat_  )  [inline]
 

Moves node position forward to the lower boundary of the specified character class.

Returns:
true if node offset was adjusted; false otherwise.

Definition at line 183 of file node.h.

References input::container(), and input::text().

size_t go_bof  )  [inline]
 

Moves node position to the beginning of the input text.

Returns:
new offset of the node.

Definition at line 299 of file node.h.

References input::container().

size_t go_eof  )  [inline]
 

Moves node position to the ending of the input text.

Returns:
new offset of the node.

Definition at line 310 of file node.h.

References input::container().

size_t go_line size_t  line_  )  [inline]
 

Moves node position to the beginning of the specified line.

Returns:
new offset of the node.

Definition at line 253 of file node.h.

References input::container().

size_t go_line_end size_t  line_  )  [inline]
 

Moves node position to the ending of the specified line.

Parameters:
line_ target line number.
Returns:
new offset of the node.

Definition at line 386 of file node.h.

References input::container().

size_t go_line_end  )  [inline]
 

Moves node position to the ending of the current line.

Returns:
new offset of the node.

Definition at line 372 of file node.h.

References input::container().

size_t go_line_home size_t  line_  )  [inline]
 

Moves node position to the beginning of the specified line.

Parameters:
line_ target line number.
Returns:
new offset of the node.

Definition at line 360 of file node.h.

References input::container().

size_t go_line_home  )  [inline]
 

Moves node position to the beginning of the current line.

Returns:
new offset of the node.

Definition at line 346 of file node.h.

References input::container().

size_t go_line_next  )  [inline]
 

Moves node position to the beginning of the next line.

Returns:
new offset of the node.

Definition at line 321 of file node.h.

References input::container().

size_t go_line_previous  )  [inline]
 

Moves node position to the beginning of the previous line.

Returns:
new offset of the node.

Definition at line 332 of file node.h.

size_t insert_go StringT const &  str_  )  [inline]
 

Inserts text at the current position of the node.

Parameters:
str_ reference to the source string.
Postcondition:
node position is adjusted to the end of the inserted text. Positions of all nodes at the same position and at higher offset positions are also adjusted.
Returns:
new offset of the node.

Definition at line 406 of file node.h.

Referenced by node_insert_go::operator()().

void insert_stay StringT const &  str_  )  [inline]
 

Inserts text at the current position of the node.

Parameters:
str_ reference to the source string.
Postcondition:
node position remains unchanged. Positions of all nodes at higher offset positions are adjusted.

Definition at line 423 of file node.h.

Referenced by node_insert_stay::operator()().

size_t offset size_t  offset_  )  [inline]
 

Changes offset of the node.

Returns:
old offset of the node.

Definition at line 236 of file node.h.

References input::container().

xtl_wrap< xtl_node< node< StringT >, xtl_wrap< ExprT > > > operator() xtl_wrap< ExprT > const &  expr_  )  [inline]
 

Implements grammar expression adaptor behavior of the node.

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 476 of file node.h.

node< StringT >& operator= node< StringT > const &  other_  )  [inline]
 

Assignment matches behavior of the copy constructor.

Only identity of another node is assigned.

Definition at line 111 of file node.h.

References node::m_identity.

char_T& operator[] int  subscript_  )  [inline]
 

Returns reference to the character in the input character sequence at the offset relative to the current position of the node.

Parameters:
subscript_ relative offset adjustment value.

Definition at line 447 of file node.h.

References input::container(), and input::text().

char_T const& operator[] int  subscript_  )  const [inline]
 

Returns character from the input character sequence at the offset relative to the current position of the node.

Parameters:
subscript_ relative offset adjustment value.

Definition at line 435 of file node.h.

References input::container(), and input::text().

size_t push  )  [inline]
 

Pushes node offset to the container's general purpose stack of offsets.

Returns:
Stack identity of the element, which can be accessed directly by parent().container().stack_offset( stack_identity );

Definition at line 269 of file node.h.

References input::container().

Referenced by const_edge::push().

bool rfind_class PredicateT(*)(PredicateT)  iswhat_  )  [inline]
 

Moves node position backward to the upper boundary of the specified character class.

Returns:
true if node offset was adjusted; false otherwise.

Definition at line 208 of file node.h.

References input::container(), and input::text().


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