17 #ifndef AWALI_ALPHABETS_SETALPHA_HH
18 # define AWALI_ALPHABETS_SETALPHA_HH
20 # include <initializer_list>
28 #include <awali/common/json/node.cc>
57 virtual std::string
vname(
bool full =
true)
const override
59 std::ostringstream res;
165 assert(l != this->special_letter());
173 assert(l != this->special_letter());
179 return alphabet_.size();
200 return alphabet_.find(l)!=alphabet_.end();
255 using iterator =
typename letters_t::const_iterator;
260 return alphabet_.begin();
265 return alphabet_.end();
270 return alphabet_.begin();
275 return alphabet_.end();
280 return alphabet_.find(l);
288 const char *sep =
"\\{";
297 else if (
format ==
"text")
300 raise(
"invalid format: ",
format);
305 template<
unsigned version = version::fsm_json>
308 version::check_fsmjson<version>();
312 obj->
push_back(
"letterType", L::to_json());
315 l->
push_back(this->
template letter_to_json<version>(x));
341 template <
typename L2>
346 template <
typename L2>
352 mutable bool open_ =
false;
355 template <
typename L2>
362 template <
typename L2>
array_t * push_back(node_t *p)
object_t * push_back(std::string key, node_t *node)
The semiring of complex numbers.
Definition: c.hh:44
objets that represent the alphabets of letters as char
Definition: setalpha.hh:44
set_alphabet(const std::initializer_list< letter_t > &l)
Definition: setalpha.hh:143
json::object_t * to_json() const
Definition: setalpha.hh:307
const_iterator cend() const
Definition: setalpha.hh:273
const_iterator begin() const
Definition: setalpha.hh:258
virtual std::string vname(bool full=true) const override
Definition: setalpha.hh:57
bool open(bool o) const
Whether unknown letters should be added, or rejected.
Definition: setalpha.hh:154
typename letters_t::const_iterator iterator
Definition: setalpha.hh:255
set_alphabet & clear()
Definition: setalpha.hh:183
const_iterator end() const
Definition: setalpha.hh:263
letter_t value_type
The type of our values, when seen as a container.
Definition: setalpha.hh:50
unsigned size() const
Definition: setalpha.hh:178
typename L::letter_t letter_t
Definition: setalpha.hh:46
std::set< letter_t > letters_t
Definition: setalpha.hh:48
set_alphabet(const letters_t &l)
Definition: setalpha.hh:147
typename letters_t::const_iterator const_iterator
Definition: setalpha.hh:256
std::ostream & print_set(std::ostream &o, const std::string &format="text") const
Definition: setalpha.hh:284
const_iterator cbegin() const
Definition: setalpha.hh:268
set_alphabet & remove_letter(letter_t l)
Definition: setalpha.hh:171
static std::string sname()
Definition: setalpha.hh:52
friend set_alphabet< L2 > intersection(const set_alphabet< L2 > &lhs, const set_alphabet< L2 > &rhs)
Compute the intersection with another alphabet.
Definition: setalpha.hh:357
bool has(letter_t l) const
Whether l is a letter.
Definition: setalpha.hh:191
set_alphabet(const set_alphabet &)=default
const_iterator find(letter_t l) const
Definition: setalpha.hh:278
set_alphabet & add_letter(letter_t l)
Modify this by adding l, and return *this.
Definition: setalpha.hh:163
friend set_alphabet< L2 > get_union(const set_alphabet< L2 > &lhs, const set_alphabet< L2 > &rhs)
Compute the union with another alphabet.
Definition: setalpha.hh:364
std::ostream & print(const std::tuple< Args... > &args, std::ostream &o)
Definition: tuple.hh:254
std::set< T, Compare, Alloc > intersection(const std::set< T, Compare, Alloc > &set1, const std::set< T, Compare, Alloc > &set2)
The intersection of two sets.
std::set< T, Compare, Alloc > get_union(const std::set< T, Compare, Alloc > &set1, const std::set< T, Compare, Alloc > &set2)
The union of two sets.
set_alphabet< L2 > get_union(const set_alphabet< L2 > &lhs, const set_alphabet< L2 > &rhs)
Definition: setalpha.hh:364
set_alphabet< L2 > intersection(const set_alphabet< L2 > &lhs, const set_alphabet< L2 > &rhs)
Definition: setalpha.hh:357
auto format(const ValueSet &vs, const typename ValueSet::value_t &v, Args &&... args) -> std::string
Format v via vs.print.
Definition: stream.hh:109
static const std::string full
Completely version of Awali as a std::string.
Definition: version.hh:42
Main namespace of Awali.
Definition: ato.hh:22