Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vgastreambuf.h

Go to the documentation of this file.
00001 
00006 /*
00007  *  Copyright (C) 2004 Bregmasoft
00008  * 
00009  * This program is free software; you can redistribute it and/or modify it under
00010  * the terms of the GNU General Public License as published by the Free Software
00011  * Foundation; either version 2 of the License, or (at your option) any later
00012  * version.
00013  * 
00014  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
00015  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00016  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License along with
00019  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00020  * Place, Suite 330, Boston, MA 02111-1307 USA
00021  */
00022 #ifndef ZYGOMA_IA32_VGASTREAMBUF_H_
00023 #define ZYGOMA_IA32_VGASTREAMBUF_H_
00024 
00025 #include <streambuf>
00026 
00027 namespace Zygoma
00028 {
00029   namespace ia32
00030   {
00037     int vgaWriteChar(char c);
00038 
00039 
00046     template<typename Char, typename Traits = std::char_traits<Char> >
00047       class VgaStreambuf
00048       : public std::basic_streambuf<Char, Traits>
00049       {
00050       public:
00051         typedef typename std::basic_streambuf<Char, Traits>::traits_type traits_type;
00052         typedef typename std::basic_streambuf<Char, Traits>::int_type    int_type;
00053 
00054       public:
00058         VgaStreambuf() { }
00059 
00060       protected:
00069         int_type
00070         overflow(int_type c = traits_type::eof());
00071 
00072       private:
00073         VgaStreambuf(const VgaStreambuf&);
00074         VgaStreambuf& operator=(const VgaStreambuf&);
00075       };
00076 
00077 
00078     template<typename Char, typename Traits>
00079       typename VgaStreambuf<Char, Traits>::int_type VgaStreambuf<Char, Traits>::
00080       overflow(int_type c)
00081       {
00082         if (!traits_type::eq_int_type(c, traits_type::eof()))
00083         {
00084           if (vgaWriteChar(traits_type::to_char_type(c)) < 0)
00085           {
00086             return traits_type::eof();
00087           }
00088           else
00089           {
00090             return c;
00091           }
00092         }
00093         return traits_type::not_eof(c);
00094       }
00095 
00096   } // namespace ia32
00097 } // namespace Zygoma
00098 
00099 #endif // ZYGOMA_IA32_VGASTREAMBUF_H_

Generated on Fri Sep 2 10:44:36 2005 for zygoma by doxygen 1.4.2