Vcsn  2.3
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

Definition at line 16 of file format.hh.

Member Enumeration Documentation

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

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

Definition at line 35 of file format.hh.

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

Definition at line 13 of file format.cc.

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

Member Function Documentation

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_.

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.

format vcsn::format::for_labels ( ) const
inline

A copy of this format, but to print labels.

Definition at line 42 of file format.hh.

References vcsn::res.

Referenced by vcsn::rat::dot_printer< ExpSet >::print_(), and vcsn::detail::polynomialset_impl< Context, Kind >::print_with_classes_().

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::printer< ExpSet >::print_(), and vcsn::rat::dot_printer< ExpSet >::print_().

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_.

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_.

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().

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

Characters that need to be escaped.

Definition at line 72 of file format.hh.

References meta_.

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.

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:

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

Definition at line 103 of file format.hh.

References format_.

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

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_t vcsn::format::format_
private

Definition at line 119 of file format.hh.

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

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().

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: