Vcsn  2.2
Be Rational
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 = symbol
 Internalize the letters to save trees. More...
 
using word_t = std::vector< letter_t >
 

Public Member Functions

word_t to_word (const letter_t l) const
 
const word_tto_word (const word_t &l) const
 
word_t mul (const letter_t l, const letter_t r) const
 
word_t mul (const word_t &l, const letter_t r) const
 
word_t mul (const letter_t l, const word_t &r) const
 
word_t mul (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 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 format &fmt={}) const
 
std::ostream & print (const word_t &w, std::ostream &o, const format &fmt={}) const
 

Static Public Member Functions

static symbol sname ()
 
static word_t empty_word ()
 
static bool is_empty_word (const word_t &w)
 
static bool equal (const letter_t l, const letter_t r)
 Whether l == r. More...
 
static bool equal (const word_t &l, const word_t &r)
 Whether l == r. More...
 
static bool less (const letter_t l, const letter_t r)
 Whether l < r. More...
 
static bool less (const word_t &l, const word_t &r)
 Whether l < r. More...
 
static letter_t one_letter ()
 The reserved letter used to forge the "one" label (the unit, the identity). More...
 
static letter_t get_letter (std::istream &i, bool quoted=true)
 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 widths.

Definition at line 19 of file string.hh.

Member Typedef Documentation

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::delimit ( const word_t w) const
inline

Add the special character first and last.

Definition at line 108 of file string.hh.

References mul(), and special_letter().

Here is the call graph for this function:

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

Definition at line 124 of file string.hh.

static bool vcsn::string_letters::equal ( const letter_t  l,
const letter_t  r 
)
inlinestatic

Whether l == r.

Definition at line 149 of file string.hh.

static bool vcsn::string_letters::equal ( const word_t l,
const word_t r 
)
inlinestatic

Whether l == r.

Definition at line 155 of file string.hh.

static letter_t vcsn::string_letters::get_letter ( std::istream &  i,
bool  quoted = true 
)
inlinestatic

Read one letter from i.

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

Definition at line 199 of file string.hh.

References vcsn::get_char(), and sname().

Here is the call graph for this function:

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

Definition at line 130 of file string.hh.

Referenced by mul().

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

Definition at line 173 of file string.hh.

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

Definition at line 179 of file string.hh.

static bool vcsn::string_letters::less ( const letter_t  l,
const letter_t  r 
)
inlinestatic

Whether l < r.

Definition at line 161 of file string.hh.

static bool vcsn::string_letters::less ( const word_t l,
const word_t r 
)
inlinestatic

Whether l < r.

Definition at line 167 of file string.hh.

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

Definition at line 45 of file string.hh.

References one_letter().

Referenced by delimit().

Here is the call graph for this function:

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

Definition at line 61 of file string.hh.

References one_letter().

Here is the call graph for this function:

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

Definition at line 76 of file string.hh.

References one_letter().

Here is the call graph for this function:

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

Definition at line 91 of file string.hh.

References is_empty_word().

Here is the call graph for this function:

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 186 of file string.hh.

Referenced by mul().

std::ostream& vcsn::string_letters::print ( const letter_t  l,
std::ostream &  o,
const format fmt = {} 
) const
inline

Definition at line 232 of file string.hh.

std::ostream& vcsn::string_letters::print ( const word_t w,
std::ostream &  o,
const format fmt = {} 
) const
inline

Definition at line 261 of file string.hh.

static symbol vcsn::string_letters::sname ( )
inlinestatic

Definition at line 26 of file string.hh.

Referenced by get_letter().

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 193 of file string.hh.

Referenced by delimit(), 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 33 of file string.hh.

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

Definition at line 39 of file string.hh.

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

Definition at line 136 of file string.hh.

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

Definition at line 143 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 114 of file string.hh.

References special_letter().

Here is the call graph for this function:


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