Vcsn
2.0
Be Rational
|
Represent alphabets whose "letters" are strings. More...
#include <string.hh>
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_t & | to_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... | |
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.
using vcsn::string_letters::letter_t = boost::flyweight<std::string, boost::flyweights::no_tracking> |
using vcsn::string_letters::word_t = std::vector<letter_t> |
Definition at line 49 of file string.hh.
References one_letter().
Referenced by delimit().
Definition at line 65 of file string.hh.
References one_letter().
Definition at line 80 of file string.hh.
References one_letter().
Definition at line 95 of file string.hh.
References is_empty_word().
Add the special character first and last.
Definition at line 112 of file string.hh.
References concat(), and special_letter().
|
inlinestatic |
|
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().
|
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().
|
inlinestatic |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
Definition at line 231 of file string.hh.
References one_letter(), and special_letter().
Referenced by print().
|
inline |
|
inlinestatic |
|
static |
Special character, used to label transitions from pre() and to post().
|
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().
Remove first and last characters, that must be "special".
Definition at line 118 of file string.hh.
References special_letter().
|
inlinevirtual |