Aegis  4.25.D505
libaegis/wide_output/to_narrow.h
Go to the documentation of this file.
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_WIDE_OUTPUT_TO_NARROW_H
00021 #define LIBAEGIS_WIDE_OUTPUT_TO_NARROW_H
00022 
00023 #include <libaegis/output.h>
00024 #include <libaegis/wide_output.h>
00025 
00031 class wide_output_to_narrow:
00032     public wide_output
00033 {
00034 public:
00038     virtual ~wide_output_to_narrow();
00039 
00040 private:
00048     wide_output_to_narrow(const output::pointer &deeper);
00049 
00050 public:
00058     static pointer open(const output::pointer &deeper);
00059 
00060 protected:
00061     // See base class for documentation.
00062     nstring filename();
00063 
00064     // See base class for documentation.
00065     int page_width();
00066 
00067     // See base class for documentation.
00068     int page_length();
00069 
00070     // See base class for documentation.
00071     const char *type_name() const;
00072 
00073     // See base class for documentation.
00074     void write_inner(const wchar_t *data, size_t len);
00075 
00076     // See base class for documentation.
00077     void flush_inner();
00078 
00079     // See base class for documentation.
00080     void end_of_line_inner();
00081 
00082 private:
00083     output::pointer deeper;
00084     mbstate_t state;
00085     bool prev_was_newline;
00086 
00090     wide_output_to_narrow();
00091 
00095     wide_output_to_narrow(const wide_output_to_narrow &);
00096 
00100     wide_output_to_narrow &operator=(const wide_output_to_narrow &);
00101 };
00102 
00103 #endif // LIBAEGIS_WIDE_OUTPUT_TO_NARROW_H