Frobby 0.9.5
ColumnPrinter.h
Go to the documentation of this file.
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2009 Bjarke Hammersholt Roune (www.broune.com)
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see http://www.gnu.org/licenses/.
16*/
17#ifndef COLUMN_PRINTER_GUARD
18#define COLUMN_PRINTER_GUARD
19
20#include "ElementDeleter.h"
21
22#include <sstream>
23#include <vector>
24
26
28 public:
29 ColumnPrinter(size_t columnCount = 0);
30
31 void setPrefix(const string& prefix);
32 void addColumn(bool flushLeft = true,
33 const string& prefix = " ", const string& suffix = "");
34 size_t getColumnCount() const;
35
36 ostream& operator[](size_t col);
37
38 void print(ostream& out) const;
39 void print(FrobbyStringStream& out) const;
40
41 private:
42 struct Col {
43 string prefix;
45 string suffix;
47 };
50 string _prefix;
51};
52
54void print(FILE* out, const ColumnPrinter& pr);
55
56#endif
ostream & operator<<(ostream &out, const ColumnPrinter &printer)
void print(FILE *out, const ColumnPrinter &pr)
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
ostream & operator[](size_t col)
void print(ostream &out) const
size_t getColumnCount() const
void addColumn(bool flushLeft=true, const string &prefix=" ", const string &suffix="")
ElementDeleter< vector< Col * > > _colsDeleter
vector< Col * > _cols
void setPrefix(const string &prefix)
A replacement for stringstream.
stringstream text