      1  #ifndef SIMPLEINVOICEPRINTER_H
      2  #define SIMPLEINVOICEPRINTER_H
      3
      4  #include <string>
      5  #include <vector>
      6
      7  using namespace std;
      8
      9  #include "invoiceprinter.h"
     10
     11  /**
     12     Prints an invoice in a monospaced font, using spaces to
     13     align the columns.
     14  */
     15  class SimpleInvoicePrinter : public InvoicePrinter
     16  {
     17  public:
     18     /**
     19        Constructs a simple invoice printer and sets the colum widths.
     20        @param widths an array of column widths
     21     */
     22     SimpleInvoicePrinter(vector<int> widths);
     23     virtual void print_header(string s);
     24     virtual void print_string(string value, bool pad_right);
     25     virtual void print_number(double value, int precision);
     26     virtual void print_footer(string s, double total);
     27  private:
     28     void next_column();
     29     int column;
     30     vector<int> column_widths;
     31  };
     32
     33  #endif