Vcsn  2.8
Be Rational
vcsn::format Class Reference

An input/output format for valuesets. More...

#include <format.hh>

Collaboration diagram for vcsn::format:

Public Types

enum  format_t {
  latex, raw, sname, text,
  utf8, deflt = text
}
 Type of format. More...
 
using self_t = format
 

Public Member Functions

 format (format_t f=deflt)
 
 format (const std::string &f)
 
format for_labels () const
 A copy of this format, but to print labels. More...
 
format for_weights () const
 A copy of this format, but to print weights. More...
 
bool delimit () const
 Whether we should delimit: (1, 2) instead of 1, 2. More...
 
format delimit (bool d) const
 Set whether we should delimit: (1, 2) instead of 1, 2. More...
 
const charmeta () const
 Characters that need to be escaped. More...
 
format meta (const char *m) const
 Set the list of additional meta characters that need to be escaped. More...
 
bool is_for_labels () const
 Whether to use the syntax for labels (e.g., "a|x"). More...
 
bool is_for_weights () const
 Whether to use the syntax for weights (e.g., "(1, 1/2)"). More...
 
format_t kind () const
 
bool operator< (self_t that) const
 
bool operator== (self_t that) const
 
bool operator!= (self_t that) const
 

Private Attributes

format_t format_
 
bool label_ = false
 Whether printed as a label (e.g., a|x), or as a weight (e.g., (1, 1/2)). More...
 
bool delimit_ = false
 Whether we should delimit. E.g., 1, 2 or (1, 2). More...
 
const charmeta_ = nullptr
 Additional characters to escape. More...
 

Detailed Description

An input/output format for valuesets.

For instance, whether text or latex, and other syntactic issues.

Definition at line 13 of file format.hh.

Member Typedef Documentation

◆ self_t

Definition at line 16 of file format.hh.

Member Enumeration Documentation

◆ format_t

Type of format.

Enumerator
latex 

Print for LaTeX.

raw 

Print as is. For instance, don't try to escape labels.

sname 

Print as a parsable type string.

text 

Print as plain (ASCII) text, escaped.

utf8 

Print as rich UTF-8 text, escaped.

deflt 

By default, print for text.

Definition at line 19 of file format.hh.

Constructor & Destructor Documentation

◆ format() [1/2]

vcsn::format::format ( format_t  f = deflt)
inline

Definition at line 35 of file format.hh.

Referenced by vcsn::operator>>().

◆ format() [2/2]

vcsn::format::format ( const std::string &  f)

Definition at line 10 of file format.cc.

References deflt, format_, latex, vcsn::map, raw, sname, text, and utf8.

Member Function Documentation

◆ delimit() [1/2]

bool vcsn::format::delimit ( ) const
inline

Whether we should delimit: (1, 2) instead of 1, 2.

Definition at line 58 of file format.hh.

References delimit_.

Referenced by vcsn::detail::random_expression_impl< ExpressionSet, RandomGenerator >::print_label_().

◆ delimit() [2/2]

format vcsn::format::delimit ( bool  d) const
inline

Set whether we should delimit: (1, 2) instead of 1, 2.

Definition at line 64 of file format.hh.

References vcsn::res.

◆ for_labels()

◆ for_weights()

format vcsn::format::for_weights ( ) const
inline

A copy of this format, but to print weights.

Definition at line 50 of file format.hh.

References vcsn::res.

Referenced by vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::random_expression_impl< ExpressionSet, RandomGenerator >::print_weight_().

◆ is_for_labels()

bool vcsn::format::is_for_labels ( ) const
inline

Whether to use the syntax for labels (e.g., "a|x").

Definition at line 87 of file format.hh.

References label_.

◆ is_for_weights()

bool vcsn::format::is_for_weights ( ) const
inline

Whether to use the syntax for weights (e.g., "(1, 1/2)").

Definition at line 93 of file format.hh.

References label_.

◆ kind()

format_t vcsn::format::kind ( ) const
inline

Definition at line 98 of file format.hh.

References format_.

Referenced by vcsn::detail::tupleset_impl< ValueSets >::print_set_(), and vcsn::to_string().

◆ meta() [1/2]

const char* vcsn::format::meta ( ) const
inline

Characters that need to be escaped.

Definition at line 72 of file format.hh.

References meta_.

◆ meta() [2/2]

format vcsn::format::meta ( const char m) const
inline

Set the list of additional meta characters that need to be escaped.

Definition at line 79 of file format.hh.

References vcsn::res.

◆ operator!=()

bool vcsn::format::operator!= ( self_t  that) const
inline

Definition at line 113 of file format.hh.

References operator==().

Here is the call graph for this function:

◆ operator<()

bool vcsn::format::operator< ( self_t  that) const
inline

Definition at line 103 of file format.hh.

References format_.

◆ operator==()

bool vcsn::format::operator== ( self_t  that) const
inline

Definition at line 108 of file format.hh.

References format_.

Referenced by operator!=().

Member Data Documentation

◆ delimit_

bool vcsn::format::delimit_ = false
private

Whether we should delimit. E.g., 1, 2 or (1, 2).

Definition at line 124 of file format.hh.

Referenced by delimit().

◆ format_

format_t vcsn::format::format_
private

Definition at line 119 of file format.hh.

Referenced by format(), kind(), operator<(), and operator==().

◆ label_

bool vcsn::format::label_ = false
private

Whether printed as a label (e.g., a|x), or as a weight (e.g., (1, 1/2)).

Definition at line 122 of file format.hh.

Referenced by is_for_labels(), and is_for_weights().

◆ meta_

const char* vcsn::format::meta_ = nullptr
private

Additional characters to escape.

Definition at line 126 of file format.hh.

Referenced by meta().


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