00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2001, 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_OUTPUT_QUOTED_PRINT_H 00021 #define LIBAEGIS_OUTPUT_QUOTED_PRINT_H 00022 00023 #include <libaegis/output.h> 00024 00025 class output_quoted_printable: 00026 public output 00027 { 00028 public: 00032 virtual ~output_quoted_printable(); 00033 00034 private: 00044 output_quoted_printable(const output::pointer &deeper, 00045 bool allow_international_characters = false); 00046 00047 public: 00057 static pointer create(const output::pointer &deeper, 00058 bool allow_international_characters = false); 00059 00060 protected: 00061 // See base class for documentation. 00062 nstring filename() const; 00063 00064 // See base class for documentation. 00065 const char *type_name() const; 00066 00067 // See base class for documentation. 00068 long ftell_inner() const; 00069 00070 // See base class for documentation. 00071 void write_inner(const void *data, size_t length); 00072 00073 // See base class for documentation. 00074 void end_of_line_inner(); 00075 00076 // See base class for documentation. 00077 void flush_inner(); 00078 00079 // See base class for documentation. 00080 int page_width() const; 00081 00082 // See base class for documentation. 00083 int page_length() const; 00084 00085 private: 00090 output::pointer deeper; 00091 00097 bool allow_international_characters; 00098 00099 struct glyph_t 00100 { 00101 unsigned char text; 00102 bool quote_it; 00103 int width; 00104 int cumulative; 00105 }; 00106 00107 enum { MAX_LINE_LEN = 76 }; // As per RFC 1521 00108 00113 glyph_t glyph[MAX_LINE_LEN + 1]; 00114 00119 int pos; 00120 00129 void eoln(bool soft); 00130 00135 void eoln_partial(); 00136 00141 void eoln_hard(); 00142 00146 output_quoted_printable(); 00147 00151 output_quoted_printable(const output_quoted_printable &); 00152 00156 output_quoted_printable &operator=(const output_quoted_printable &); 00157 }; 00158 00159 #endif // LIBAEGIS_OUTPUT_QUOTED_PRINT_H