libwreport
2.4
|
00001 /* 00002 * bulletin/dds-printer - Print a DDS using the interpreter 00003 * 00004 * Copyright (C) 2011 ARPA-SIM <urpsim@smr.arpa.emr.it> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * Author: Enrico Zini <enrico@enricozini.com> 00020 */ 00021 00022 #ifndef WREPORT_BULLETIN_DDS_PRINTER_H 00023 #define WREPORT_BULLETIN_DDS_PRINTER_H 00024 00025 #include <wreport/bulletin.h> 00026 #include <wreport/bulletin/internals.h> 00027 #include <vector> 00028 #include <cstdio> 00029 00030 namespace wreport { 00031 namespace bulletin { 00032 00036 class DDSPrinter : public ConstBaseVisitor 00037 { 00038 std::vector<Varcode> stack; 00039 FILE* out; 00040 00041 void print_context(Varinfo info, unsigned var_pos); 00042 void print_context(Varcode code, unsigned var_pos); 00043 00044 public: 00053 DDSPrinter(const Bulletin& b, FILE* out); 00054 virtual ~DDSPrinter(); 00055 00056 virtual void do_start_subset(unsigned subset_no, const Subset& current_subset); 00057 virtual void do_attr(Varinfo info, unsigned var_pos, Varcode attr_code); 00058 virtual void do_var(Varinfo info); 00059 virtual const Var& do_semantic_var(Varinfo info); 00060 virtual const Var& do_bitmap(Varcode code, Varcode rep_code, Varcode delayed_code, const Opcodes& ops); 00061 virtual void do_char_data(Varcode code); 00062 void do_associated_field(unsigned bit_count, unsigned significance); 00063 00064 virtual void r_replication(Varcode code, Varcode delayed_code, const Opcodes& ops); 00065 virtual void d_group_begin(Varcode code); 00066 virtual void d_group_end(Varcode code); 00067 }; 00068 00069 } 00070 } 00071 00072 #endif