/usr/include/cvc4/expr/expr_iomanip.h is in libcvc4-dev 1.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | /********************* */
/*! \file expr_iomanip.h
** \verbatim
** Top contributors (to current version):
** Tim King, Paul Meng
** This file is part of the CVC4 project.
** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
** in the top-level source directory) and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
**
** \brief Expr IO manipulation classes.
**
** Expr IO manipulation classes.
**/
#include <cvc4/cvc4_public.h>
#ifndef __CVC4__EXPR__EXPR_IOMANIP_H
#define __CVC4__EXPR__EXPR_IOMANIP_H
#include <iosfwd>
namespace CVC4 {
namespace expr {
/**
* IOStream manipulator to set the maximum depth of Exprs when
* pretty-printing. -1 means print to any depth. E.g.:
*
* // let a, b, c, and d be VARIABLEs
* Expr e = em->mkExpr(OR, a, b, em->mkExpr(AND, c, em->mkExpr(NOT, d)))
* out << setdepth(3) << e;
*
* gives "(OR a b (AND c (NOT d)))", but
*
* out << setdepth(1) << [same expr as above]
*
* gives "(OR a b (...))".
*
* The implementation of this class serves two purposes; it holds
* information about the depth setting (such as the index of the
* allocated word in ios_base), and serves also as the manipulator
* itself (as above).
*/
class CVC4_PUBLIC ExprSetDepth {
public:
/**
* Construct a ExprSetDepth with the given depth.
*/
ExprSetDepth(long depth);
void applyDepth(std::ostream& out);
static long getDepth(std::ostream& out);
static void setDepth(std::ostream& out, long depth);
/**
* Set the expression depth on the output stream for the current
* stack scope. This makes sure the old depth is reset on the stream
* after normal OR exceptional exit from the scope, using the RAII
* C++ idiom.
*/
class Scope {
public:
Scope(std::ostream& out, long depth);
~Scope();
private:
std::ostream& d_out;
long d_oldDepth;
};/* class ExprSetDepth::Scope */
private:
/**
* The allocated index in ios_base for our depth setting.
*/
static const int s_iosIndex;
/**
* The default depth to print, for ostreams that haven't yet had a
* setdepth() applied to them.
*/
static const int s_defaultPrintDepth = -1;
/**
* When this manipulator is used, the depth is stored here.
*/
long d_depth;
};/* class ExprSetDepth */
/**
* IOStream manipulator to print type ascriptions or not.
*
* // let a, b, c, and d be variables of sort U
* Expr e = em->mkExpr(OR, a, b, em->mkExpr(AND, c, em->mkExpr(NOT, d)))
* out << e;
*
* gives "(OR a:U b:U (AND c:U (NOT d:U)))", but
*/
class CVC4_PUBLIC ExprPrintTypes {
public:
/**
* Construct a ExprPrintTypes with the given setting.
*/
ExprPrintTypes(bool printTypes);
void applyPrintTypes(std::ostream& out);
static bool getPrintTypes(std::ostream& out);
static void setPrintTypes(std::ostream& out, bool printTypes);
/**
* Set the print-types state on the output stream for the current
* stack scope. This makes sure the old state is reset on the
* stream after normal OR exceptional exit from the scope, using the
* RAII C++ idiom.
*/
class Scope {
public:
Scope(std::ostream& out, bool printTypes);
~Scope();
private:
std::ostream& d_out;
bool d_oldPrintTypes;
};/* class ExprPrintTypes::Scope */
private:
/**
* The allocated index in ios_base for our setting.
*/
static const int s_iosIndex;
/**
* When this manipulator is used, the setting is stored here.
*/
bool d_printTypes;
};/* class ExprPrintTypes */
/**
* IOStream manipulator to print expressions as a dag (or not).
*/
class CVC4_PUBLIC ExprDag {
public:
/**
* Construct a ExprDag with the given setting (dagification on or off).
*/
explicit ExprDag(bool dag);
/**
* Construct a ExprDag with the given setting (letify only common
* subexpressions that appear more than 'dag' times). dag <= 0 means
* don't dagify.
*/
explicit ExprDag(int dag);
void applyDag(std::ostream& out);
static size_t getDag(std::ostream& out);
static void setDag(std::ostream& out, size_t dag);
/**
* Set the dag state on the output stream for the current
* stack scope. This makes sure the old state is reset on the
* stream after normal OR exceptional exit from the scope, using the
* RAII C++ idiom.
*/
class Scope {
public:
Scope(std::ostream& out, size_t dag);
~Scope();
private:
std::ostream& d_out;
size_t d_oldDag;
};/* class ExprDag::Scope */
private:
/**
* The allocated index in ios_base for our setting.
*/
static const int s_iosIndex;
/**
* The default setting, for ostreams that haven't yet had a
* dag() applied to them.
*/
static const size_t s_defaultDag = 1;
/**
* When this manipulator is used, the setting is stored here.
*/
size_t d_dag;
};/* class ExprDag */
/**
* Sets the default dag setting when pretty-printing a Expr to an ostream.
* Use like this:
*
* // let out be an ostream, e an Expr
* out << Expr::dag(true) << e << endl;
*
* The setting stays permanently (until set again) with the stream.
*/
std::ostream& operator<<(std::ostream& out, ExprDag d) CVC4_PUBLIC;
/**
* Sets the default print-types setting when pretty-printing an Expr
* to an ostream. Use like this:
*
* // let out be an ostream, e an Expr
* out << Expr::printtypes(true) << e << endl;
*
* The setting stays permanently (until set again) with the stream.
*/
std::ostream& operator<<(std::ostream& out, ExprPrintTypes pt) CVC4_PUBLIC;
/**
* Sets the default depth when pretty-printing a Expr to an ostream.
* Use like this:
*
* // let out be an ostream, e an Expr
* out << Expr::setdepth(n) << e << endl;
*
* The depth stays permanently (until set again) with the stream.
*/
std::ostream& operator<<(std::ostream& out, ExprSetDepth sd) CVC4_PUBLIC;
}/* namespace CVC4::expr */
}/* CVC4 namespace */
#endif /* __CVC4__EXPR__EXPR_IOMANIP_H */
|