X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fsymbol.cpp;h=e7eb9c92317b5d53b55e333b9ec206e4ae4605a3;hb=f5abf61d2cb1a1d1809d270a24fa098575b172c4;hp=c9db110fdc43a1cfb581128d48f592553644cfae;hpb=00507499530d90533cf029bd503be326d9018138;p=ginac.git diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index c9db110f..e7eb9c92 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -150,12 +150,21 @@ static const std::string& get_default_TeX_name(const std::string& name); // public +std::string symbol::get_name() const +{ + if (name.empty()) { + std::ostringstream s; + s << "symbol" << serial; + name = s.str(); + } + return name; +} + +// protected + void symbol::do_print(const print_context & c, unsigned level) const { - if (!name.empty()) - c.s << name; - else - c.s << "symbol" << serial; + c.s << get_name(); } void symbol::do_print_latex(const print_latex & c, unsigned level) const