Make it possible to format SERE.

* src/ltlvisit/tostring.hh, src/ltlvisit/tostring.cc (to_string):
Add third option to enable formating suitable for SERE.
This commit is contained in:
Alexandre Duret-Lutz 2011-02-13 22:35:11 +01:00
parent fe7d7473ed
commit cc889a7f66
2 changed files with 19 additions and 13 deletions

View file

@ -61,9 +61,11 @@ namespace spot
class to_string_visitor: public const_visitor
{
public:
to_string_visitor(std::ostream& os, bool full_parent = false)
to_string_visitor(std::ostream& os,
bool full_parent = false,
bool ratexp = false)
: os_(os), top_level_(true),
full_parent_(full_parent), in_ratexp_(false)
full_parent_(full_parent), in_ratexp_(ratexp)
{
}
@ -552,18 +554,19 @@ namespace spot
} // anonymous
std::ostream&
to_string(const formula* f, std::ostream& os, bool full_parent)
to_string(const formula* f, std::ostream& os, bool full_parent,
bool ratexp)
{
to_string_visitor v(os, full_parent);
to_string_visitor v(os, full_parent, ratexp);
f->accept(v);
return os;
}
std::string
to_string(const formula* f, bool full_parent)
to_string(const formula* f, bool full_parent, bool ratexp)
{
std::ostringstream os;
to_string(f, os, full_parent);
to_string(f, os, full_parent, ratexp);
return os.str();
}

View file

@ -1,4 +1,4 @@
// Copyright (C) 2010 Laboratoire de Recherche et Développement de
// Copyright (C) 2010, 2011 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -39,30 +39,33 @@ namespace spot
/// \param f The formula to translate.
/// \param os The stream where it should be output.
/// \param full_parent Whether or not the string should by fully
/// parenthesized.
/// parenthesized.
/// \param ratexp Whether we are printing a SERE.
std::ostream&
to_string(const formula* f, std::ostream& os, bool full_parent = false);
to_string(const formula* f, std::ostream& os, bool full_parent = false,
bool ratexp = false);
/// \brief Output a formula as a string which is parsable unless the formula
/// contains automaton operators (used in ELTL formulae).
/// \param f The formula to translate.
/// \param full_parent Whether or not the string should by fully
/// parenthesized.
/// parenthesized.
/// \param ratexp Whether we are printing a SERE.
std::string
to_string(const formula* f, bool full_parent = false);
to_string(const formula* f, bool full_parent = false, bool ratexp = false);
/// \brief Output a formula as a (parsable by Spin) string.
/// \param f The formula to translate.
/// \param os The stream where it should be output.
/// \param full_parent Whether or not the string should by fully
/// parenthesized.
/// parenthesized.
std::ostream& to_spin_string(const formula* f, std::ostream& os,
bool full_parent = false);
/// \brief Convert a formula into a (parsable by Spin) string.
/// \param f The formula to translate.
/// \param full_parent Whether or not the string should by fully
/// parenthesized.
/// parenthesized.
std::string to_spin_string(const formula* f, bool full_parent = false);
/// @}