Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DisplayTerminal.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "Props.hh"
5 #include "Storage.hh"
6 #include "DisplayBase.hh"
7 #include <ostream>
8 #include <map>
9 
10 typedef uint32_t kunichar;
11 
12 namespace cadabra {
13 
24 
25 class DisplayTerminal : public DisplayBase {
26  public:
27  DisplayTerminal(const Kernel&, const Ex&, bool use_unicode);
28 
29  protected:
31 
32  virtual void dispatch(std::ostream&, Ex::iterator) override;
33  virtual bool needs_brackets(Ex::iterator it) override;
34 
35  private:
36  void print_multiplier(std::ostream&, Ex::iterator, int mult=1);
39  void print_parent_rel(std::ostream&, str_node::parent_rel_t, bool first);
40  void print_children(std::ostream&, Ex::iterator, int skip=0);
41 
43 
49 
50  void print_productlike(std::ostream&, Ex::iterator, const std::string& inbetween);
51  void print_sumlike(std::ostream&, Ex::iterator);
52  void print_fraclike(std::ostream&, Ex::iterator);
53  void print_commalike(std::ostream&, Ex::iterator);
54  void print_arrowlike(std::ostream&, Ex::iterator);
55  void print_powlike(std::ostream&, Ex::iterator);
56  void print_intlike(std::ostream&, Ex::iterator);
57  void print_equalitylike(std::ostream&, Ex::iterator);
58  void print_commutator(std::ostream& str, Ex::iterator it, bool comm);
59  void print_components(std::ostream&, Ex::iterator);
60  void print_other(std::ostream&, Ex::iterator);
61 
62  bool children_have_brackets(Ex::iterator ch) const;
63 
64  std::map<std::string, std::string> symmap, greekmap;
65 };
66 
67 const char *unichar(kunichar c);
68 
69 }
void print_sumlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:418
void print_fraclike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:347
void print_closing_bracket(std::ostream &, str_node::bracket_t, str_node::parent_rel_t)
Definition: DisplayTerminal.cc:274
void print_intlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:458
Basic storage class for symbolic mathemematical expressions.
Definition: Storage.hh:130
void print_multiplier(std::ostream &, Ex::iterator, int mult=1)
Definition: DisplayTerminal.cc:197
Class to display expressions to the terminal.
Definition: DisplayTerminal.hh:25
void print_other(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:551
virtual bool needs_brackets(Ex::iterator it) override
Determine if a node needs extra brackets around it.
Definition: DisplayTerminal.cc:73
bool use_unicode
Definition: DisplayTerminal.hh:30
void print_equalitylike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:476
DisplayTerminal(const Kernel &, const Ex &, bool use_unicode)
Definition: DisplayTerminal.cc:8
int bracket_level
Definition: DisplayTerminal.hh:42
bool children_have_brackets(Ex::iterator ch) const
Definition: DisplayTerminal.cc:542
void print_components(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:503
void print_arrowlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:338
void print_powlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:439
Base class for all display classes.
Definition: DisplayBase.hh:18
uint32_t kunichar
Definition: DisplayMMA.hh:9
void print_commalike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:322
void print_opening_bracket(std::ostream &, str_node::bracket_t, str_node::parent_rel_t)
Definition: DisplayTerminal.cc:258
const char * unichar(kunichar c)
Definition: DisplayTeX.cc:747
uint32_t kunichar
Definition: DisplayTerminal.hh:10
std::map< std::string, std::string > greekmap
Definition: DisplayTerminal.hh:64
virtual void dispatch(std::ostream &, Ex::iterator) override
Definition: DisplayTerminal.cc:305
void print_commutator(std::ostream &str, Ex::iterator it, bool comm)
Definition: DisplayTerminal.cc:487
std::map< std::string, std::string > symmap
Definition: DisplayTerminal.hh:64
parent_rel_t
Child nodes are related to their parent node by a so-called parent relation, which can be one of thes...
Definition: Storage.hh:61
void print_parent_rel(std::ostream &, str_node::parent_rel_t, bool first)
Definition: DisplayTerminal.cc:290
Definition: Kernel.hh:15
void print_children(std::ostream &, Ex::iterator, int skip=0)
Definition: DisplayTerminal.cc:136
bracket_t
Definition: Storage.hh:57
void print_productlike(std::ostream &, Ex::iterator, const std::string &inbetween)
Printing members for various standard constructions, e.g.
Definition: DisplayTerminal.cc:375