3 * Definition of helper classes for expression output. */
6 * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __GINAC_PRINT_H__
24 #define __GINAC_PRINT_H__
31 /** Context for default (ginsh-parsable) output. */
36 print_context(std::ostream &, unsigned options = 0);
38 std::ostream & s; /**< stream to output to */
39 unsigned options; /**< option flags */
41 // dummy virtual function to make the class polymorphic
42 virtual void dummy(void) {}
45 /** Context for latex-parsable output. */
46 class print_latex : public print_context
50 print_latex(std::ostream &, unsigned options = 0);
53 /** Context for python pretty-print output. */
54 class print_python : public print_context
58 print_python(std::ostream &, unsigned options = 0);
61 /** Context for python-parsable output. */
62 class print_python_repr : public print_context
66 print_python_repr(std::ostream &, unsigned options = 0);
69 /** Context for tree-like output for debugging. */
70 class print_tree : public print_context
73 print_tree(unsigned d = 4);
74 print_tree(std::ostream &, unsigned options = 0, unsigned d = 4);
75 const unsigned delta_indent; /**< size of indentation step */
78 /** Base context for C source output. */
79 class print_csrc : public print_context
83 print_csrc(std::ostream &, unsigned options = 0);
86 /** Context for C source output using float numbers. */
87 class print_csrc_float : public print_csrc
91 print_csrc_float(std::ostream &, unsigned options = 0);
94 /** Context for C source output using double numbers. */
95 class print_csrc_double : public print_csrc
99 print_csrc_double(std::ostream &, unsigned options = 0);
102 /** Context for C source output using CLN numbers. */
103 class print_csrc_cl_N : public print_csrc
107 print_csrc_cl_N(std::ostream &, unsigned options = 0);
110 /** Check if obj is a T, including base classes. */
112 inline bool is_a(const print_context & obj)
113 { return dynamic_cast<const T *>(&obj)!=0; }
117 #endif // ndef __GINAC_BASIC_H__