Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcsn::string_letters Class Reference

Represent alphabets whose "letters" are strings. More...

#include <string.hh>

Collaboration diagram for vcsn::string_letters:

Public Types

using letter_t = boost::flyweight< std::string, boost::flyweights::no_tracking >
 Internalize the letters to save trees. More...
 
using word_t = std::vector< letter_t >
 

Public Member Functions

virtual std::string vname (bool=true) const
 
word_t to_word (const letter_t l) const
 
const word_tto_word (const word_t &l) const
 
word_t concat (const letter_t l, const letter_t r) const
 
word_t concat (const word_t &l, const letter_t r) const
 
word_t concat (const letter_t l, const word_t &r) const
 
word_t concat (const word_t &l, const word_t &r) const
 
word_t delimit (const word_t &w) const
 Add the special character first and last. More...
 
word_t undelimit (const word_t &w) const
 Remove first and last characters, that must be "special". More...
 
word_t transpose (const word_t &w) const
 
letter_t transpose (letter_t l) const
 
bool equals (const letter_t &l1, const letter_t &l2) const
 
bool equals (const word_t &w1, const word_t &w2) const
 
bool is_letter (const letter_t &) const
 
bool is_letter (const word_t &w) const
 
std::ostream & print (const letter_t &l, std::ostream &o, const std::string &format="text") const
 
std::ostream & print (const word_t &w, std::ostream &o, const std::string &format="text") const
 

Static Public Member Functions

static std::string sname ()
 
static word_t empty_word ()
 
static bool is_empty_word (const word_t &w)
 
static letter_t one_letter ()
 The reserved letter used to forge the "one" label (the unit, the identity). More...
 
static char get_char (std::istream &i)
 FIXME: coding duplication with char.hh. Move to misc? More...
 
static letter_t get_letter (std::istream &i)
 Read one letter from i. More...
 
template<typename T = letter_t>
static T special ()
 Special character, used to label transitions from pre() and to post(). More...
 

Static Private Member Functions

static letter_t special_letter ()
 The reserved letter used to forge the labels for initial and final transitions. More...
 

Detailed Description

Represent alphabets whose "letters" are strings.

This is useful for linguistics where sometimes letters are words ("it is beautiful" has three letters: "it" "is" and "beautiful") but also to deal with UTF-8, since graphemes then have various width.

Definition at line 18 of file string.hh.

Member Typedef Documentation

using vcsn::string_letters::letter_t = boost::flyweight<std::string, boost::flyweights::no_tracking>

Internalize the letters to save trees.

Definition at line 23 of file string.hh.

using vcsn::string_letters::word_t = std::vector<letter_t>

Definition at line 24 of file string.hh.

Member Function Documentation

word_t vcsn::string_letters::concat ( const letter_t  l,
const letter_t  r 
) const
inline

Definition at line 49 of file string.hh.

References one_letter().

Referenced by delimit().

Here is the call graph for this function:

word_t vcsn::string_letters::concat ( const word_t l,
const letter_t  r 
) const
inline

Definition at line 65 of file string.hh.

References one_letter().

Here is the call graph for this function:

word_t vcsn::string_letters::concat ( const letter_t  l,
const word_t r 
) const
inline

Definition at line 80 of file string.hh.

References one_letter().

Here is the call graph for this function:

word_t vcsn::string_letters::concat ( const word_t l,
const word_t r 
) const
inline

Definition at line 95 of file string.hh.

References is_empty_word().

Here is the call graph for this function:

word_t vcsn::string_letters::delimit ( const word_t w) const
inline

Add the special character first and last.

Definition at line 112 of file string.hh.

References concat(), and special_letter().

Here is the call graph for this function:

static word_t vcsn::string_letters::empty_word ( )
inlinestatic

Definition at line 128 of file string.hh.

bool vcsn::string_letters::equals ( const letter_t l1,
const letter_t l2 
) const
inline

Definition at line 153 of file string.hh.

bool vcsn::string_letters::equals ( const word_t w1,
const word_t w2 
) const
inline

Definition at line 159 of file string.hh.

static char vcsn::string_letters::get_char ( std::istream &  i)
inlinestatic

FIXME: coding duplication with char.hh. Move to misc?

Read a single char, with possible -escape support. EOF is an error.

Definition at line 192 of file string.hh.

Referenced by get_letter().

static letter_t vcsn::string_letters::get_letter ( std::istream &  i)
inlinestatic

Read one letter from i.

Either a single char, or a "letter" enclosed in single-quotes.

Definition at line 210 of file string.hh.

References get_char().

Here is the call graph for this function:

static bool vcsn::string_letters::is_empty_word ( const word_t w)
inlinestatic

Definition at line 134 of file string.hh.

Referenced by concat().

bool vcsn::string_letters::is_letter ( const letter_t ) const
inline

Definition at line 165 of file string.hh.

bool vcsn::string_letters::is_letter ( const word_t w) const
inline

Definition at line 171 of file string.hh.

static letter_t vcsn::string_letters::one_letter ( )
inlinestatic

The reserved letter used to forge the "one" label (the unit, the identity).

Definition at line 178 of file string.hh.

Referenced by concat(), and print().

std::ostream& vcsn::string_letters::print ( const letter_t l,
std::ostream &  o,
const std::string &  format = "text" 
) const
inline

Definition at line 231 of file string.hh.

References one_letter(), and special_letter().

Referenced by print().

Here is the call graph for this function:

std::ostream& vcsn::string_letters::print ( const word_t w,
std::ostream &  o,
const std::string &  format = "text" 
) const
inline

Definition at line 250 of file string.hh.

References print().

Here is the call graph for this function:

static std::string vcsn::string_letters::sname ( )
inlinestatic

Definition at line 26 of file string.hh.

Referenced by vname().

template<typename T = letter_t>
static T vcsn::string_letters::special ( )
static

Special character, used to label transitions from pre() and to post().

static letter_t vcsn::string_letters::special_letter ( )
inlinestaticprivate

The reserved letter used to forge the labels for initial and final transitions.

Use the public special() interface.

Definition at line 185 of file string.hh.

Referenced by delimit(), print(), vcsn::string_letters::special< string_letters::letter_t >(), vcsn::string_letters::special< string_letters::word_t >(), and undelimit().

word_t vcsn::string_letters::to_word ( const letter_t  l) const
inline

Definition at line 37 of file string.hh.

const word_t& vcsn::string_letters::to_word ( const word_t l) const
inline

Definition at line 43 of file string.hh.

word_t vcsn::string_letters::transpose ( const word_t w) const
inline

Definition at line 140 of file string.hh.

letter_t vcsn::string_letters::transpose ( letter_t  l) const
inline

Definition at line 147 of file string.hh.

word_t vcsn::string_letters::undelimit ( const word_t w) const
inline

Remove first and last characters, that must be "special".

Definition at line 118 of file string.hh.

References special_letter().

Here is the call graph for this function:

virtual std::string vcsn::string_letters::vname ( bool  = true) const
inlinevirtual

Definition at line 31 of file string.hh.

References sname().

Here is the call graph for this function:


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