Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:59

0001 //
0002 // Copyright 2009 Christian Henning
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 #ifndef BOOST_GIL_EXTENSION_IO_TIFF_DETAIL_LOG_HPP
0009 #define BOOST_GIL_EXTENSION_IO_TIFF_DETAIL_LOG_HPP
0010 
0011 #include <iostream>
0012 
0013 extern "C" {
0014 #include "tiffio.h"
0015 }
0016 
0017 namespace boost { namespace gil {
0018 
0019 class tiff_no_log
0020 {
0021 public:
0022 
0023     tiff_no_log()
0024     {
0025         TIFFSetErrorHandler  ( nullptr );
0026         TIFFSetWarningHandler( nullptr );
0027     }
0028 };
0029 
0030 class console_log
0031 {
0032 public:
0033 
0034     console_log()
0035     {
0036         TIFFSetErrorHandler  ( console_log::error   );
0037         TIFFSetWarningHandler( console_log::warning );
0038     }
0039 
0040 private:
0041 
0042     static void error( const char* /* module */
0043                      , const char* fmt
0044                      , va_list ap
0045                      )
0046     {
0047         char buf[1000];
0048         sprintf(buf, fmt, ap);
0049         std::cout << "error: " << buf << std::endl;
0050     }
0051 
0052     static void warning( char const* /* module */
0053                        , char const* fmt
0054                        , va_list ap
0055                        )
0056     {
0057         char buf[1000];
0058         sprintf(buf, fmt, ap);
0059         std::cout << "warning: " << fmt << std::endl;
0060     }
0061 };
0062 
0063 } // namespace gil
0064 } // namespace boost
0065 
0066 #endif