00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 1999, 2002, 2005, 2006, 2008 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 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, see 00017 // <http://www.gnu.org/licenses/>. 00018 // 00019 00020 #ifndef LIBAEGIS_COL_PRETTY_H 00021 #define LIBAEGIS_COL_PRETTY_H 00022 00023 #include <libaegis/col.h> 00024 #include <libaegis/output.h> 00025 #include <libaegis/wide_output/column.h> 00026 00032 class col_pretty: 00033 public col 00034 { 00035 public: 00039 virtual ~col_pretty(); 00040 00041 private: 00049 col_pretty(const wide_output::pointer &deeper); 00050 00051 public: 00059 static pointer create(const wide_output::pointer &deeper); 00060 00061 protected: 00062 // See base class for documentation. 00063 output::pointer create(int, int, const char *); 00064 00065 // See base class for documentation. 00066 void title(const char *, const char *); 00067 00068 // See base class for documentation. 00069 void eoln(); 00070 00071 // See base class for documentation. 00072 void need(int); 00073 00074 // See base class for documentation. 00075 void eject(); 00076 00077 // See base class for documentation. 00078 void flush(); 00079 00080 // See base class for documentation. 00081 void forget(const output::pointer &op); 00082 00083 private: 00084 wide_output::pointer deeper; 00085 bool need_to_emit_headers; 00086 size_t ncolumns; 00087 size_t ncolumns_max; 00088 00089 struct column_ty 00090 { 00091 ~column_ty(); 00092 column_ty(); 00093 column_ty(const column_ty &); 00094 column_ty &operator=(const column_ty &); 00095 00096 wide_output_column::cpointer header; 00097 wide_output_column::cpointer content; 00098 output::pointer content_filter; 00099 int left; 00100 int right; 00101 00102 void clear(); 00103 }; 00104 00105 column_ty *column; 00106 00107 struct emit_ty 00108 { 00109 emit_ty() : left(0) { } 00110 00111 wide_output_column::cpointer content; 00112 int left; 00113 }; 00114 00121 void emit(size_t argc, emit_ty *argv, int minlines, bool is_the_header); 00122 00128 void emit_header(); 00129 00140 void emit_content(); 00141 00145 col_pretty(); 00146 00150 col_pretty(const col_pretty &); 00151 00155 col_pretty &operator=(const col_pretty &); 00156 }; 00157 00158 #endif // LIBAEGIS_COL_PRETTY_H