Vcsn  2.8
Be Rational
vcsn::set_alphabet< L > Class Template Reference

A set of letters of type L. More...

#include <setalpha.hh>

Inheritance diagram for vcsn::set_alphabet< L >:
Collaboration diagram for vcsn::set_alphabet< L >:

Classes

struct  has_range
 Whether the genset supports the range concept: whether we can use '++' on letters. More...
 
struct  has_range< Letter, decltype((++std::declval< Letter & >(), void()))>
 

Public Types

using letter_t = typename L::letter_t
 
using word_t = typename L::word_t
 
using letters_t = boost::container::flat_set< letter_t, vcsn::less< L, letter_t > >
 
using value_type = letter_t
 The type of our values, when seen as a container. More...
 
using iterator = typename letters_t::const_iterator
 
using const_iterator = typename letters_t::const_iterator
 

Public Member Functions

 set_alphabet ()
 
 set_alphabet (const set_alphabet &)=default
 
 set_alphabet (std::initializer_list< letter_t > l)
 
 set_alphabet (const letters_t &l)
 
bool open (bool o) const
 Whether unknown letters should be added, or rejected. More...
 
set_alphabetadd_letter (letter_t l)
 Modify this by adding l, and return *this. More...
 
auto add_range (letter_t l1, letter_t l2) -> set_alphabet &
 Add a range of letters, if it is accepted by the labelset. More...
 
template<typename Letter >
auto add_range_ (Letter l1, Letter l2) -> std::enable_if_t< has_range< Letter >
 
set_alphabetif (L::equal(l1, l2)) add_letter(l1)
 
template<typename Letter >
auto add_range_ (Letter, Letter) -> std::enable_if_t<!has_range< Letter >
 
set_alphabet &bool has (letter_t l) const
 Whether l is a letter. More...
 
word_t get_word (std::istream &i) const
 Extract and return the next word from i. More...
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_iterator begin () const
 
const_iterator end () const
 
auto pregenerators () const
 All the "pregenerators", including the empty word. More...
 
auto generators () const
 All the generators. More...
 
bool empty () const
 Whether this alphabet has no letters. More...
 
size_t size () const
 Number of letters. More...
 
const_iterator find (letter_t l) const
 
std::ostream & print_set (std::ostream &o, format fmt={}) const
 

Static Public Member Functions

static symbol sname ()
 
static set_alphabet make (std::istream &is)
 

Public Attributes

return * this
 

Private Attributes

letters_t alphabet_
 
bool open_ = false
 

Friends

set_alphabet set_intersection (const set_alphabet &lhs, const set_alphabet &rhs)
 Compute the intersection with another alphabet. More...
 
set_alphabet set_union (const set_alphabet &lhs, const set_alphabet &rhs)
 Compute the union with another alphabet. More...
 

Detailed Description

template<typename L>
class vcsn::set_alphabet< L >

A set of letters of type L.

L is not simply char or so. Rather, see char_letters.

Definition at line 36 of file setalpha.hh.

Member Typedef Documentation

◆ const_iterator

template<typename L >
using vcsn::set_alphabet< L >::const_iterator = typename letters_t::const_iterator

Definition at line 253 of file setalpha.hh.

◆ iterator

template<typename L >
using vcsn::set_alphabet< L >::iterator = typename letters_t::const_iterator

Definition at line 252 of file setalpha.hh.

◆ letter_t

template<typename L >
using vcsn::set_alphabet< L >::letter_t = typename L::letter_t

Definition at line 39 of file setalpha.hh.

◆ letters_t

template<typename L >
using vcsn::set_alphabet< L >::letters_t = boost::container::flat_set<letter_t, vcsn::less<L, letter_t> >

Definition at line 42 of file setalpha.hh.

◆ value_type

template<typename L >
using vcsn::set_alphabet< L >::value_type = letter_t

The type of our values, when seen as a container.

Definition at line 44 of file setalpha.hh.

◆ word_t

template<typename L >
using vcsn::set_alphabet< L >::word_t = typename L::word_t

Definition at line 40 of file setalpha.hh.

Constructor & Destructor Documentation

◆ set_alphabet() [1/4]

template<typename L >
vcsn::set_alphabet< L >::set_alphabet ( )
inline

Definition at line 115 of file setalpha.hh.

References vcsn::set_alphabet< L >::alphabet_.

◆ set_alphabet() [2/4]

template<typename L >
vcsn::set_alphabet< L >::set_alphabet ( const set_alphabet< L > &  )
default

◆ set_alphabet() [3/4]

template<typename L >
vcsn::set_alphabet< L >::set_alphabet ( std::initializer_list< letter_t l)
inline

Definition at line 120 of file setalpha.hh.

References vcsn::set_alphabet< L >::alphabet_.

◆ set_alphabet() [4/4]

template<typename L >
vcsn::set_alphabet< L >::set_alphabet ( const letters_t l)
inline

Definition at line 129 of file setalpha.hh.

Member Function Documentation

◆ add_letter()

template<typename L >
set_alphabet& vcsn::set_alphabet< L >::add_letter ( letter_t  l)
inline

Modify this by adding l, and return *this.

Definition at line 144 of file setalpha.hh.

References vcsn::set_alphabet< L >::alphabet_, vcsn::str_escape(), and VCSN_REQUIRE.

Referenced by vcsn::set_alphabet< L >::add_range_(), vcsn::set_alphabet< L >::has(), and vcsn::set_alphabet< L >::make().

Here is the call graph for this function:

◆ add_range()

template<typename L >
auto vcsn::set_alphabet< L >::add_range ( letter_t  l1,
letter_t  l2 
) -> set_alphabet&
inline

Add a range of letters, if it is accepted by the labelset.

Definition at line 166 of file setalpha.hh.

Referenced by vcsn::set_alphabet< L >::make().

◆ add_range_() [1/2]

template<typename L >
template<typename Letter >
auto vcsn::set_alphabet< L >::add_range_ ( Letter  l1,
Letter  l2 
) -> std::enable_if_t<has_range<Letter>
inline

Definition at line 173 of file setalpha.hh.

References vcsn::set_alphabet< L >::add_letter().

Here is the call graph for this function:

◆ add_range_() [2/2]

template<typename L >
template<typename Letter >
auto vcsn::set_alphabet< L >::add_range_ ( Letter  ,
Letter   
) -> std::enable_if_t<!has_range<Letter>
inline

Definition at line 187 of file setalpha.hh.

◆ begin()

template<typename L >
const_iterator vcsn::set_alphabet< L >::begin ( ) const
inline

Definition at line 265 of file setalpha.hh.

References vcsn::set_alphabet< L >::cbegin().

Here is the call graph for this function:

◆ cbegin()

◆ cend()

◆ empty()

template<typename L >
bool vcsn::set_alphabet< L >::empty ( ) const
inline

Whether this alphabet has no letters.

Definition at line 288 of file setalpha.hh.

References vcsn::set_alphabet< L >::cbegin(), and vcsn::set_alphabet< L >::cend().

Here is the call graph for this function:

◆ end()

template<typename L >
const_iterator vcsn::set_alphabet< L >::end ( ) const
inline

Definition at line 270 of file setalpha.hh.

References vcsn::set_alphabet< L >::cend().

Here is the call graph for this function:

◆ find()

template<typename L >
const_iterator vcsn::set_alphabet< L >::find ( letter_t  l) const
inline

Definition at line 299 of file setalpha.hh.

References vcsn::set_alphabet< L >::alphabet_.

◆ generators()

template<typename L >
auto vcsn::set_alphabet< L >::generators ( ) const
inline

All the generators.

Definition at line 282 of file setalpha.hh.

References vcsn::set_alphabet< L >::cbegin(), and vcsn::set_alphabet< L >::cend().

Here is the call graph for this function:

◆ get_word()

template<typename L >
word_t vcsn::set_alphabet< L >::get_word ( std::istream &  i) const
inline

Extract and return the next word from i.

Definition at line 209 of file setalpha.hh.

References vcsn::set_alphabet< L >::has(), vcsn::require(), vcsn::res, vcsn::str_escape(), and VCSN_REQUIRE.

Here is the call graph for this function:

◆ has()

template<typename L >
set_alphabet& bool vcsn::set_alphabet< L >::has ( letter_t  l) const
inline

Whether l is a letter.

Definition at line 195 of file setalpha.hh.

References vcsn::set_alphabet< L >::add_letter(), vcsn::set_alphabet< L >::alphabet_, vcsn::has(), and vcsn::set_alphabet< L >::open_.

Referenced by vcsn::set_alphabet< L >::get_word().

Here is the call graph for this function:

◆ if()

template<typename L >
set_alphabet& vcsn::set_alphabet< L >::if ( L::equal(l1, l2)  )

◆ make()

template<typename L >
static set_alphabet vcsn::set_alphabet< L >::make ( std::istream &  is)
inlinestatic

Definition at line 52 of file setalpha.hh.

References vcsn::set_alphabet< L >::add_letter(), vcsn::set_alphabet< L >::add_range(), vcsn::eat(), vcsn::set_alphabet< L >::open_, vcsn::res, and vcsn::set_alphabet< L >::sname().

Here is the call graph for this function:

◆ open()

template<typename L >
bool vcsn::set_alphabet< L >::open ( bool  o) const
inline

Whether unknown letters should be added, or rejected.

Parameters
owhether to accept
Returns
the previous status.

Definition at line 136 of file setalpha.hh.

References vcsn::set_alphabet< L >::open_, and vcsn::detail::swap().

Here is the call graph for this function:

◆ pregenerators()

template<typename L >
auto vcsn::set_alphabet< L >::pregenerators ( ) const
inline

All the "pregenerators", including the empty word.

Definition at line 276 of file setalpha.hh.

References vcsn::set_alphabet< L >::alphabet_.

◆ print_set()

template<typename L >
std::ostream& vcsn::set_alphabet< L >::print_set ( std::ostream &  o,
format  fmt = {} 
) const
inline

Definition at line 305 of file setalpha.hh.

References vcsn::format::latex, vcsn::set_alphabet< L >::open_, vcsn::print(), vcsn::format::raw, vcsn::format::sname, vcsn::set_alphabet< L >::sname(), vcsn::format::text, and vcsn::format::utf8.

Here is the call graph for this function:

◆ size()

template<typename L >
size_t vcsn::set_alphabet< L >::size ( ) const
inline

Number of letters.

Definition at line 294 of file setalpha.hh.

References vcsn::set_alphabet< L >::alphabet_.

◆ sname()

template<typename L >
static symbol vcsn::set_alphabet< L >::sname ( )
inlinestatic

Definition at line 46 of file setalpha.hh.

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

Referenced by vcsn::set_alphabet< L >::make(), and vcsn::set_alphabet< L >::print_set().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ set_intersection

template<typename L >
set_alphabet set_intersection ( const set_alphabet< L > &  lhs,
const set_alphabet< L > &  rhs 
)
friend

Compute the intersection with another alphabet.

Definition at line 357 of file setalpha.hh.

◆ set_union

template<typename L >
set_alphabet set_union ( const set_alphabet< L > &  lhs,
const set_alphabet< L > &  rhs 
)
friend

Compute the union with another alphabet.

Definition at line 364 of file setalpha.hh.

Member Data Documentation

◆ alphabet_

◆ open_

template<typename L >
bool vcsn::set_alphabet< L >::open_ = false
mutableprivate

◆ this

template<typename L >
return* vcsn::set_alphabet< L >::this

Definition at line 183 of file setalpha.hh.


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