|
Aegis
4.25.D505
|
00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 1999, 2001, 2002, 2005, 2006, 2008, 2011, 2012 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 (at 00008 // 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 GNU 00013 // 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 <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef LIBAEGIS_OUTPUT_FILE_H 00020 #define LIBAEGIS_OUTPUT_FILE_H 00021 00022 #include <common/nstring.h> 00023 #include <libaegis/output.h> 00024 00025 struct nstring; // forward 00026 00031 class output_file: 00032 public output 00033 { 00034 public: 00038 virtual ~output_file(); 00039 00040 private: 00051 output_file(const nstring &file_name, bool binary = false); 00052 00053 public: 00063 static output::pointer open(const nstring &fn, bool binary = false); 00064 00072 static inline output::pointer 00073 text_open(string_ty *fn) 00074 { 00075 return open(nstring(fn), false); 00076 } 00077 00085 static inline output::pointer 00086 text_open(const nstring &fn) 00087 { 00088 return open(fn, false); 00089 } 00090 00098 inline static output::pointer 00099 binary_open(string_ty *fn) 00100 { 00101 return open(nstring(fn), true); 00102 } 00103 00111 inline static output::pointer 00112 binary_open(const nstring &fn) 00113 { 00114 return open(fn, true); 00115 } 00116 00134 static output::pointer compressed_text_open(const nstring &filename); 00135 00136 protected: 00137 // See base class for documentation. 00138 nstring filename(void) const; 00139 00140 // See base class for documentation. 00141 nstring type_name(void) const; 00142 00143 // See base class for documentation. 00144 long ftell_inner(void) const; 00145 00146 // See base class for documentation. 00147 void write_inner(const void *data, size_t length); 00148 00149 // See base class for documentation. 00150 void end_of_line_inner(void); 00151 00152 // See base class for documentation. 00153 int page_width(void) const; 00154 00155 // See base class for documentation. 00156 int page_length(void) const; 00157 00158 private: 00163 nstring file_name; 00164 00169 int fd; 00170 00175 bool bol; 00176 00181 size_t pos; 00182 00186 output_file(); 00187 00191 output_file(const output_file &); 00192 00196 output_file &operator=(const output_file &); 00197 }; 00198 00199 #endif // LIBAEGIS_OUTPUT_FILE_H 00200 // vim: set ts=8 sw=4 et :
1.7.6.1