1 /********************* */
2 /*! \file set_language.h
4 ** Top contributors (to current version):
5 ** Morgan Deters, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2019 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief Definition of input and output languages
14 ** Definition of input and output languages.
17 #include "cvc4_public.h"
19 #ifndef CVC4__OPTIONS__SET_LANGUAGE_H
20 #define CVC4__OPTIONS__SET_LANGUAGE_H
23 #include "options/language.h"
29 * IOStream manipulator to set the output language for Exprs.
31 class CVC4_PUBLIC SetLanguage
{
34 * Set a language on the output stream for the current stack scope.
35 * This makes sure the old language is reset on the stream after
36 * normal OR exceptional exit from the scope, using the RAII C++
41 Scope(std::ostream
& out
, OutputLanguage language
);
45 OutputLanguage d_oldLanguage
;
46 };/* class SetLanguage::Scope */
49 * Construct a ExprSetLanguage with the given setting.
51 SetLanguage(OutputLanguage l
);
53 void applyLanguage(std::ostream
& out
);
55 static OutputLanguage
getLanguage(std::ostream
& out
);
57 static void setLanguage(std::ostream
& out
, OutputLanguage l
);
62 * The allocated index in ios_base for our depth setting.
64 static const int s_iosIndex
;
67 * The default language to use, for ostreams that haven't yet had a
68 * setlanguage() applied to them and where the current Options
69 * information isn't available.
71 static const int s_defaultOutputLanguage
= language::output::LANG_AUTO
;
74 * When this manipulator is used, the setting is stored here.
76 OutputLanguage d_language
;
77 };/* class SetLanguage */
81 * Sets the output language when pretty-printing a Expr to an ostream.
82 * This is used liek this:
84 * // let out be an ostream, e an Expr
85 * out << language::SetLanguage(LANG_SMTLIB_V2_5) << e << endl;
87 * This used to be used like this:
89 * // let out be an ostream, e an Expr
90 * out << Expr::setlanguage(LANG_SMTLIB_V2_5) << e << endl;
92 * The setting stays permanently (until set again) with the stream.
94 std::ostream
& operator<<(std::ostream
& out
, SetLanguage l
) CVC4_PUBLIC
;
96 }/* CVC4::language namespace */
99 #endif /* CVC4__OPTIONS__SET_LANGUAGE_H */