00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 1992-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 OUTPUT_PAGER_H 00021 #define OUTPUT_PAGER_H 00022 00023 #include <common/nstring.h> 00024 #include <libaegis/output.h> 00025 00031 class output_pager: 00032 public output 00033 { 00034 public: 00038 virtual ~output_pager(); 00039 00040 private: 00045 output_pager(); 00046 00047 public: 00057 static void set(int flag, void(*usage)(void)); 00058 00064 static pointer open(void); 00065 00071 static void cleanup(void); 00072 00073 protected: 00074 // See base class for documentation. 00075 nstring filename() const; 00076 00077 // See base class for documentation. 00078 const char *type_name() const; 00079 00080 // See base class for documentation. 00081 long ftell_inner() const; 00082 00083 // See base class for documentation. 00084 void write_inner(const void *data, size_t length); 00085 00086 // See base class for documentation. 00087 void end_of_line_inner(); 00088 00089 // See base class for documentation. 00090 void flush_inner(); 00091 00092 private: 00093 void *vdeeper; 00094 int pid; 00095 nstring pager; 00096 bool bol; 00097 00098 void pipe_open(); 00099 void pager_error(); 00100 00104 output_pager(const output_pager &); 00105 00109 output_pager &operator=(const output_pager &); 00110 }; 00111 00120 void option_pager_set(int flag, void(*usage)(void)); 00121 00122 #endif // OUTPUT_PAGER_H