Cadabra
Computer algebra system for field theory problems
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_dot(std::ostream&, Ex::iterator);
56  void print_powlike(std::ostream&, Ex::iterator);
57  void print_intlike(std::ostream&, Ex::iterator);
58  void print_conditional(std::ostream&, Ex::iterator);
59  void print_relation(std::ostream&, Ex::iterator);
60  void print_equalitylike(std::ostream&, Ex::iterator);
61  void print_commutator(std::ostream& str, Ex::iterator it, bool comm);
62  void print_components(std::ostream&, Ex::iterator);
63  void print_dots(std::ostream&, Ex::iterator);
64  void print_other(std::ostream&, Ex::iterator);
65 
66  bool children_have_brackets(Ex::iterator ch) const;
67 
68  std::map<std::string, std::string> symmap, greekmap;
69  };
70 
71  const char *unichar(kunichar c);
72 
73  }
Storage.hh
cadabra::DisplayTerminal::print_children
void print_children(std::ostream &, Ex::iterator, int skip=0)
Definition: DisplayTerminal.cc:146
cadabra::DisplayTerminal::children_have_brackets
bool children_have_brackets(Ex::iterator ch) const
Definition: DisplayTerminal.cc:620
DisplayBase.hh
cadabra::DisplayTerminal::needs_brackets
virtual bool needs_brackets(Ex::iterator it) override
Determine if a node needs extra brackets around it.
Definition: DisplayTerminal.cc:80
cadabra::DisplayTerminal::print_intlike
void print_intlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:536
cadabra::DisplayTerminal::print_parent_rel
void print_parent_rel(std::ostream &, str_node::parent_rel_t, bool first)
Definition: DisplayTerminal.cc:318
cadabra::Kernel
Definition: Kernel.hh:14
cadabra::DisplayTerminal::print_closing_bracket
void print_closing_bracket(std::ostream &, str_node::bracket_t, str_node::parent_rel_t)
Definition: DisplayTerminal.cc:293
cadabra::DisplayTerminal::print_other
void print_other(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:634
cadabra::DisplayTerminal::dispatch
virtual void dispatch(std::ostream &, Ex::iterator) override
Definition: DisplayTerminal.cc:342
cadabra::DisplayTerminal::symmap
std::map< std::string, std::string > symmap
Definition: DisplayTerminal.hh:68
cadabra::DisplayTerminal::print_powlike
void print_powlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:496
cadabra::DisplayTerminal::print_sumlike
void print_sumlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:475
cadabra::DisplayTerminal::print_conditional
void print_conditional(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:517
cadabra::unichar
const char * unichar(kunichar c)
Definition: DisplayTeX.cc:860
cadabra::DisplayTerminal::use_unicode
bool use_unicode
Definition: DisplayTerminal.hh:30
kunichar
uint32_t kunichar
Definition: DisplayMMA.hh:9
kunichar
uint32_t kunichar
Definition: DisplayTerminal.hh:10
cadabra::DisplayTerminal::print_arrowlike
void print_arrowlike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:380
cadabra::DisplayTerminal
Definition: DisplayTerminal.hh:25
cadabra::DisplayTerminal::print_commalike
void print_commalike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:364
cadabra::DisplayTerminal::print_multiplier
void print_multiplier(std::ostream &, Ex::iterator, int mult=1)
Definition: DisplayTerminal.cc:207
cadabra::DisplayTerminal::print_equalitylike
void print_equalitylike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:554
cadabra::DisplayBase
Definition: DisplayBase.hh:18
cadabra::DisplayTerminal::print_dot
void print_dot(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:392
cadabra::Ex
Definition: Storage.hh:140
cadabra::DisplayTerminal::print_fraclike
void print_fraclike(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:404
cadabra::DisplayTerminal::print_commutator
void print_commutator(std::ostream &str, Ex::iterator it, bool comm)
Definition: DisplayTerminal.cc:565
cadabra::DisplayTerminal::print_components
void print_components(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:581
cadabra
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:80
Props.hh
cadabra::str_node::bracket_t
bracket_t
Definition: Storage.hh:57
cadabra::DisplayTerminal::print_opening_bracket
void print_opening_bracket(std::ostream &, str_node::bracket_t, str_node::parent_rel_t)
Definition: DisplayTerminal.cc:268
cadabra::DisplayTerminal::DisplayTerminal
DisplayTerminal(const Kernel &, const Ex &, bool use_unicode)
Definition: DisplayTerminal.cc:8
cadabra::DisplayTerminal::bracket_level
int bracket_level
Definition: DisplayTerminal.hh:42
cadabra::DisplayTerminal::print_productlike
void print_productlike(std::ostream &, Ex::iterator, const std::string &inbetween)
Printing members for various standard constructions, e.g.
Definition: DisplayTerminal.cc:432
cadabra::str_node::parent_rel_t
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
cadabra::DisplayTerminal::print_dots
void print_dots(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:629
cadabra::DisplayTerminal::greekmap
std::map< std::string, std::string > greekmap
Definition: DisplayTerminal.hh:68
cadabra::DisplayTerminal::print_relation
void print_relation(std::ostream &, Ex::iterator)
Definition: DisplayTerminal.cc:526