omanips.hpp

Go to the documentation of this file.
00001 #ifndef IOF_OUT_MANIPS_HPP_
00002 #define IOF_OUT_MANIPS_HPP_
00003 
00004 
00018 #include <ostream>
00019 
00020 
00021 namespace iof 
00022 {
00023 
00024 
00025 /*  Allow flushing with prints(stream, fmt, arg1..argN, flush) and
00026     endlining with prints(stream, fmt, arg1..argN, eol). The proper
00027     way would be to define e.g. 
00028     ostream& eol(ostream& output) {return output << endl;}
00029     but VC++ doesn't handle passing function pointers as template 
00030     parameters in the prints(), tostr(), etc overloads.  So enum 
00031     is used. 
00032     */
00033     
00034 namespace iof_private_manips
00035 {
00036     enum HideEol {eol};
00037     enum HideFlush {flush};
00038 };
00040 static const iof_private_manips::HideEol   eol   = iof_private_manips::eol;
00042 static const iof_private_manips::HideFlush flush = iof_private_manips::flush;
00043 
00044 // allow sending eol to stream, causing std::endl to be sent
00045 inline std::ostream& 
00046 operator<<(std::ostream& out, iof_private_manips::HideEol)
00047 {
00048     return out << std::endl;
00049 }
00050 // allow sending flush to stream, causing stream to be flushed
00051 inline std::ostream& 
00052 operator<<(std::ostream& out, iof_private_manips::HideFlush)
00053 {
00054     return out.flush();
00055 }
00056 
00057 
00058 } // namespace 
00059 
00060 
00061 #endif // IOF_OUT_MANIPS_HPP_

Generated on Fri Nov 24 16:16:01 2006 for IOF Library by doxygen 1.5.1-p1
Thanks to SourceForge.net Logo for hosting