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

xtl_text_container Class Template Reference

#include <xtl_container.h>

Inheritance diagram for xtl_text_container:

Inheritance graph
[legend]
Collaboration diagram for xtl_text_container:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename StringT = CTTL_STD_STRING>
class cttl_impl::xtl_text_container< StringT >

Encapsulates user input text and offset identity vector.

Class implements functionality that supports fundamental CTTL concepts:

Definition at line 76 of file xtl_container.h.

Public Types

typedef xtl_text_container_impl<
StringT >::string_T 
string_T
 Defines type of encapsulated string.
typedef xtl_text_container_impl<
StringT >::char_T 
char_T
 Defines type of encapsulated characters.

Public Member Functions

 xtl_text_container (xtl_bitflags::value_type flags_=xtl_flag_default, size_t vector_size_=xtl_identity_vector_default_size)
 Implements default constructor of xtl_text_container.
template<typename CharT>
 xtl_text_container (CharT const *pchar_, xtl_bitflags::value_type flags_=xtl_flag_default, size_t vector_size_=xtl_identity_vector_default_size)
 Implements constructor which accepts null-terminated character string.
 xtl_text_container (StringT const &str_, xtl_bitflags::value_type flags_=xtl_flag_default, size_t vector_size_=xtl_identity_vector_default_size)
 Implements constructor which accepts STL string.
std::vector< size_t > & identity_vector ()
 Returns mutable reference to the identity vector.
std::vector< size_t > & offset_stack ()
 Returns mutable reference to the general purpose stack.
size_t identity_vector_size () const
 Returns current size of the identity vector.
size_t identity_vector_size (size_t new_size_)
 Sets size of the identity vector.
size_t identity_vector_push_back (size_t offset_)
 Creates new identity.
void text (char_T const *pchar_)
 Sets user input text.
void text (StringT const &str_)
 Sets user input text.
StringT const & text () const
 Returns const reference to the encapsulated user text.
StringT & text ()
 Returns mutable reference to the encapsulated user text.
void text_tolower (int from_id_, int to_id_)
 Converts substring pointed by two identities to lowercase.
void text_toupper (int from_id_, int to_id_)
 Converts substring pointed by two identities to UPPERCASE.
StringT text_substring (int from_id_, int to_id_) const
 Returns substring pointed by two identities.
StringT text_absolute_substring (size_t from_offset_, size_t to_offset_) const
 Returns substring pointed by two offsets.
size_t identity_go_bof (int id_)
 Moves identity to the position equal to zero.
size_t identity_go_eof (int id_)
 Moves identity to the position equal to the length of the encapsulated user text.
size_t identity_offset (int id_) const
 Returns offset of the specified identity.
size_t identity_go_offset (int id_, size_t offset_)
 Moves identity id_ to the position equal to the offset_ specified by the user.
size_t identity_add_offset (int id_, size_t offset_)
 Adds offset to the specified identity.
void push_offset (size_t x_)
 Pushes offset to the stack.
size_t pop_offset ()
 Pops offset from the stack.
size_t push_identity (int id_)
 Pushes identity offset to the stack.
void pop_identity ()
 Pops offset from the stack and throws it away.
size_t pop_identity (int id_)
 Pops identity offset from the stack.
size_t stack_size () const
 Returns current size of the offset stack.
size_t stack_offset (int sp_) const
 Returns offset of the offset stored on the stack by direct access to the element.
void stack_offset (int sp_, size_t offset_)
 Assigns new offset to the offset stored on the stack by direct access to the element.
void identity_assign (int target_i_, int source_i_)
 Assigns offset of the source identity to the target identity.
size_t identity_get_line (int id_) const
 Returns line number corresponding to the current offset of the identity.
size_t identity_go_line (int id_, int line_)
 Moves identity offset to the line home position of the specified line.
size_t identity_go_next_line (int id_)
 Moves identity offset to home position of the next line.
size_t identity_go_line_home (int id_)
 Moves identity offset to the home position of the current line.
size_t identity_go_line_end (int id_)
 Moves identity offset to the end position of the current line.

Public Attributes

xtl_bitflags m_flags
 Stores flags defining run-time behavior of runtime_match() grammar evaluation method of CTTL rule()grammar rule adaptors.


Member Function Documentation

size_t identity_add_offset int  id_,
size_t  offset_
[inline]
 

Adds offset to the specified identity.

Returns:
new identity offset.

Definition at line 370 of file xtl_container.h.

size_t identity_get_line int  id_  )  const [inline]
 

Returns line number corresponding to the current offset of the identity.

Complexity
At least O(N). It may be expensive to casually obtain line numbers via this function for identities pointing to offsets inside large texts.

Definition at line 455 of file xtl_container.h.

size_t identity_go_bof int  id_  )  [inline]
 

Moves identity to the position equal to zero.

Returns:
new identity offset.

Definition at line 333 of file xtl_container.h.

size_t identity_go_eof int  id_  )  [inline]
 

Moves identity to the position equal to the length of the encapsulated user text.

Returns:
new identity offset.

Definition at line 343 of file xtl_container.h.

size_t identity_go_line int  id_,
int  line_
[inline]
 

Moves identity offset to the line home position of the specified line.

Complexity
At least O(N).

Definition at line 466 of file xtl_container.h.

size_t identity_go_line_end int  id_  )  [inline]
 

Moves identity offset to the end position of the current line.

Complexity
O(1).

Definition at line 499 of file xtl_container.h.

size_t identity_go_line_home int  id_  )  [inline]
 

Moves identity offset to the home position of the current line.

Complexity
O(1).

Definition at line 488 of file xtl_container.h.

size_t identity_go_next_line int  id_  )  [inline]
 

Moves identity offset to home position of the next line.

Complexity
O(1).

Definition at line 477 of file xtl_container.h.

size_t identity_vector_push_back size_t  offset_  )  [inline]
 

Creates new identity.

Parameters:
offset_ offset of the new identity
Returns:
identity of the new element.
Postcondition:
The new identity is added to the identity vector.

Definition at line 222 of file xtl_container.h.

size_t identity_vector_size size_t  new_size_  )  [inline]
 

Sets size of the identity vector.

Forces new size of the offset identity vector. Can either expand or shorten the size of the vector.

Parameters:
new_size_ new size
Returns:
new size of identity vector.

Definition at line 198 of file xtl_container.h.

size_t identity_vector_size  )  const [inline]
 

Returns current size of the identity vector.

Returns:
current size of the identity vector.

Definition at line 180 of file xtl_container.h.

Referenced by input::vector_size().

size_t pop_identity int  id_  )  [inline]
 

Pops identity offset from the stack.

Returns:
new identity offset.

Definition at line 417 of file xtl_container.h.

size_t pop_offset  )  [inline]
 

Pops offset from the stack.

Returns:
offset from the top of the stack.

Definition at line 386 of file xtl_container.h.

Referenced by xtl_mutable_offset_manager::~xtl_mutable_offset_manager().

size_t push_identity int  id_  )  [inline]
 

Pushes identity offset to the stack.

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

Definition at line 400 of file xtl_container.h.


Member Data Documentation

xtl_bitflags m_flags
 

Stores flags defining run-time behavior of runtime_match() grammar evaluation method of CTTL rule()grammar rule adaptors.

Acceptable modes are

Definition at line 97 of file xtl_container.h.


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