X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fwildcard.cpp;h=fa4153f1b5bff0b5fc5009ad1afa5f48c74f597a;hb=7dfed2bf4fb42d23410332576dc9fbe14ea154f8;hp=97fab9e919e101895a52d13d7cb9058886236906;hpb=68fdf425abf14d016d5f95ee7b9d06a19a3c5926;p=ginac.git diff --git a/ginac/wildcard.cpp b/ginac/wildcard.cpp index 97fab9e9..fa4153f1 100644 --- a/ginac/wildcard.cpp +++ b/ginac/wildcard.cpp @@ -23,13 +23,15 @@ #include #include "wildcard.h" -#include "print.h" #include "archive.h" #include "utils.h" namespace GiNaC { -GINAC_IMPLEMENT_REGISTERED_CLASS(wildcard, basic) +GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(wildcard, basic, + print_func(&wildcard::do_print). + print_func(&wildcard::do_print_tree). + print_func(&wildcard::do_print_python_repr)) ////////// // default constructor @@ -82,16 +84,21 @@ int wildcard::compare_same_type(const basic & other) const return label < o.label ? -1 : 1; } -void wildcard::print(const print_context & c, unsigned level) const +void wildcard::do_print(const print_context & c, unsigned level) const { - if (is_a(c)) { - c.s << std::string(level, ' ') << class_name() << " (" << label << ")" - << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec - << std::endl; - } else if (is_a(c)) { - c.s << class_name() << '(' << label << ')'; - } else - c.s << "$" << label; + c.s << "$" << label; +} + +void wildcard::do_print_tree(const print_tree & c, unsigned level) const +{ + c.s << std::string(level, ' ') << class_name() << "(" << label << ")" << " @" << this + << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec + << std::endl; +} + +void wildcard::do_print_python_repr(const print_python_repr & c, unsigned level) const +{ + c.s << class_name() << '(' << label << ')'; } unsigned wildcard::calchash() const