Commit 74956dd4 authored by Sofus Rose's avatar Sofus Rose

Included OpenImageIO libs. Eventually want to statically link.

parent ac19b7be
......@@ -9,9 +9,10 @@ build:
# instead of calling g++ directly you can also use some build toolkit like make
# install the necessary build tools when needed
before_script:
- apt update && apt -y install make autoconf libopenimageio-dev
- apt update && apt -y install make autoconf
-
script:
- make
- LD_LIBRARY_PATH=./libs make
artifacts:
paths:
- march
......
/*
100% free public domain implementation of the SHA-1 algorithm
by Dominik Reichl <dominik.reichl@t-online.de>
Web: http://www.dominik-reichl.de/
Version 1.8 - 2008-03-16
- Converted project files to Visual Studio 2008 format.
- Added Unicode support for HashFile utility method.
- Added support for hashing files using the HashFile method that are
larger than 2 GB.
- HashFile now returns an error code instead of copying an error
message into the output buffer.
- GetHash now returns an error code and validates the input parameter.
- Added ReportHashStl STL utility method.
- Added REPORT_HEX_SHORT reporting mode.
- Improved Linux compatibility of test program.
Version 1.7 - 2006-12-21
- Fixed buffer underrun warning that appeared when compiling with
Borland C Builder (thanks to Rex Bloom and Tim Gallagher for the
patch).
- Breaking change: ReportHash writes the final hash to the start
of the buffer, i.e. it's not appending it to the string anymore.
- Made some function parameters const.
- Added Visual Studio 2005 project files to demo project.
Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
- You can set the endianness in your files, no need to modify the
header file of the CSHA1 class anymore.
- Aligned data support.
- Made support/compilation of the utility functions (ReportHash and
HashFile) optional (useful when bytes count, for example in embedded
environments).
Version 1.5 - 2005-01-01
- 64-bit compiler compatibility added.
- Made variable wiping optional (define SHA1_WIPE_VARIABLES).
- Removed unnecessary variable initializations.
- ROL32 improvement for the Microsoft compiler (using _rotl).
Version 1.4 - 2004-07-22
- CSHA1 now compiles fine with GCC 3.3 under MacOS X (thanks to Larry
Hastings).
Version 1.3 - 2003-08-17
- Fixed a small memory bug and made a buffer array a class member to
ensure correct working when using multiple CSHA1 class instances at
one time.
Version 1.2 - 2002-11-16
- Borlands C++ compiler seems to have problems with string addition
using sprintf. Fixed the bug which caused the digest report function
not to work properly. CSHA1 is now Borland compatible.
Version 1.1 - 2002-10-11
- Removed two unnecessary header file includes and changed BOOL to
bool. Fixed some minor bugs in the web page contents.
Version 1.0 - 2002-06-20
- First official release.
======== Test Vectors (from FIPS PUB 180-1) ========
SHA1("abc") =
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
SHA1(A million repetitions of "a") =
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
*/
#ifndef ___SHA1_HDR___
#define ___SHA1_HDR___
#include <climits>
#include "export.h"
#include "oiioversion.h"
#include "platform.h"
#if !defined(SHA1_UTILITY_FUNCTIONS) && !defined(SHA1_NO_UTILITY_FUNCTIONS)
#define SHA1_UTILITY_FUNCTIONS
#endif
#if !defined(SHA1_STL_FUNCTIONS) && !defined(SHA1_NO_STL_FUNCTIONS)
#define SHA1_STL_FUNCTIONS
#if !defined(SHA1_UTILITY_FUNCTIONS)
#error STL functions require SHA1_UTILITY_FUNCTIONS.
#endif
#endif
#include <memory.h>
#ifdef SHA1_UTILITY_FUNCTIONS
#include <stdio.h>
#include <string.h>
#endif
#ifdef SHA1_STL_FUNCTIONS
#include <string>
#endif
#ifdef _MSC_VER
#include <stdlib.h>
#endif
// You can define the endian mode in your files without modifying the SHA-1
// source files. Just #define SHA1_LITTLE_ENDIAN or #define SHA1_BIG_ENDIAN
// in your files, before including the SHA1.h header file. If you don't
// define anything, the class defaults to little endian.
#if !defined(SHA1_LITTLE_ENDIAN) && !defined(SHA1_BIG_ENDIAN)
#define SHA1_LITTLE_ENDIAN
#endif
// If you want variable wiping, #define SHA1_WIPE_VARIABLES, if not,
// #define SHA1_NO_WIPE_VARIABLES. If you don't define anything, it
// defaults to wiping.
#if !defined(SHA1_WIPE_VARIABLES) && !defined(SHA1_NO_WIPE_VARIABLES)
#define SHA1_WIPE_VARIABLES
#endif
#if defined(SHA1_HAS_TCHAR)
#include <tchar.h>
#else
#ifdef _MSC_VER
#include <tchar.h>
#else
#ifndef TCHAR
#define TCHAR char
#endif
#ifndef _T
#define _T(__x) (__x)
#define _tmain main
#define _tprintf printf
#define _getts gets
#define _tcslen strlen
#define _tfopen fopen
#define _tcscpy strcpy
#define _tcscat strcat
#define _sntprintf snprintf
#endif
#endif
#endif
// Fallback, if no 64-bit support
#ifndef _fseeki64
#define _fseeki64 fseek
#endif
#ifndef _ftelli64
#define _ftelli64 ftell
#endif
///////////////////////////////////////////////////////////////////////////
// Define variable types
#define UINT_8 uint8_t
#define UINT_32 uint32_t
#define UINT_64 uint64_t
#define INT_64 int64_t
///////////////////////////////////////////////////////////////////////////
// Declare SHA-1 workspace
OIIO_NAMESPACE_BEGIN
typedef union
{
UINT_8 c[64];
UINT_32 l[16];
} SHA1_WORKSPACE_BLOCK;
class CSHA1
{
public:
#ifdef SHA1_UTILITY_FUNCTIONS
// Different formats for ReportHash
enum REPORT_TYPE
{
REPORT_HEX = 0,
REPORT_DIGIT = 1,
REPORT_HEX_SHORT = 2
};
#endif
// Constructor and destructor
CSHA1();
~CSHA1();
UINT_32 m_state[5];
UINT_32 m_count[2];
UINT_32 m_reserved0[1]; // Memory alignment padding
UINT_8 m_buffer[64];
UINT_8 m_digest[20];
UINT_32 m_reserved1[3]; // Memory alignment padding
void Reset();
// Update the hash value
void Update(const UINT_8* pbData, UINT_32 uLen);
#ifdef SHA1_UTILITY_FUNCTIONS
// Hash in file contents
bool HashFile(const TCHAR* tszFileName);
#endif
// Finalize hash, call before using ReportHash(Stl)
void Final();
#ifdef SHA1_UTILITY_FUNCTIONS
bool ReportHash(TCHAR* tszReport, REPORT_TYPE rtReportType = REPORT_HEX) const;
#endif
#ifdef SHA1_STL_FUNCTIONS
bool ReportHashStl(std::basic_string<TCHAR>& strOut, REPORT_TYPE rtReportType =
REPORT_HEX) const;
#endif
bool GetHash(UINT_8* pbDest) const;
private:
// Private SHA-1 transformation
void Transform(UINT_32* pState, const UINT_8* pBuffer);
// Member variables
UINT_8 m_workspace[64];
SHA1_WORKSPACE_BLOCK* m_block; // SHA1 pointer to the byte array above
};
OIIO_NAMESPACE_END
#endif // ___SHA1_HDR___
/*
Copyright 2008 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Based on BSD-licensed software Copyright 2004 NVIDIA Corp.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
/// \file
/// \brief Simple parsing of program command-line arguments.
#ifndef OPENIMAGEIO_ARGPARSE_H
#define OPENIMAGEIO_ARGPARSE_H
#if defined(_MSC_VER)
// Ignore warnings about DLL exported classes with member variables that are template classes.
// This happens with the std::string m_errmessage member of ArgParse below.
# pragma warning (disable : 4251)
#endif
#include <vector>
#include "export.h"
#include "oiioversion.h"
#include "tinyformat.h"
OIIO_NAMESPACE_BEGIN
class ArgOption; // Forward declaration
/////////////////////////////////////////////////////////////////////////////
///
/// \class ArgParse
///
/// Argument Parsing
///
/// The parse function takes a list of options and variables or functions
/// for storing option values and return <0 on failure:
///
/// \code
/// static int parse_files (int argc, const char *argv[])
/// {
/// for (int i = 0; i < argc; i++)
/// filenames.push_back (argv[i]);
/// return 0;
/// }
///
/// static int blah_callback (int argc, const char *argv[])
/// {
/// std::cout << "blah argument was " << argv[1] << "\n";
/// return 0;
/// }
///
/// ...
///
/// ArgParse ap;
///
/// ap.options ("Usage: myapp [options] filename...",
/// "%*", parse_objects, "",
/// "-camera %f %f %f", &camera[0], &camera[1], &camera[2],
/// "set the camera position",
/// "-lookat %f %f %f", &lx, &ly, &lz,
/// "set the position of interest",
/// "-oversampling %d", &oversampling, "oversamping rate",
/// "-passes %d", &passes, "number of passes",
/// "-lens %f %f %f", &aperture, &focalDistance, &focalLength,
/// "set aperture, focal distance, focal length",
/// "-format %d %d %f", &width, &height, &aspect,
/// "set width, height, aspect ratio",
/// "-v", &verbose, "verbose output",
/// "-q %!", &verbose, "quiet mode",
/// "--blah %@ %s", blahcallback, "Make the callback",
/// NULL);
///
/// if (ap.parse (argc, argv) < 0) {
/// std::cerr << ap.geterror() << std::endl;
/// ap.usage ();
/// return EXIT_FAILURE;
/// }
/// \endcode
///
/// The available argument types are:
/// - no \% argument - bool flag
/// - \%! - a bool flag, but set it to false if the option is set
/// - \%d - 32bit integer
/// - \%f - 32bit float
/// - \%F - 64bit float (double)
/// - \%s - std::string
/// - \%L - std::vector<std::string> (takes 1 arg, appends to list)
/// - \%@ - a function pointer for a callback function will be invoked
/// immediately. The prototype for the callback is
/// int callback (int argc, char *argv[])
/// - \%* - catch all non-options and pass individually as an (argc,argv)
/// sublist to a callback, each immediately after it's found
///
/// There are several special format tokens:
/// - "<SEPARATOR>" - not an option at all, just a description to print
/// in the usage output.
///
/// Notes:
/// - If an option doesn't have any arguments, a bool flag argument is
/// assumed.
/// - No argument destinations are initialized.
/// - The empty string, "", is used as a global sublist (ie. "%*").
/// - Sublist functions are all of the form "int func(int argc, char **argv)".
/// - If a sublist function returns -1, parse() will terminate early.
/// - It is perfectly legal for the user to append ':' and more characters
/// to the end of an option name, it will match only the portion before
/// the semicolon (but a callback can detect the full string, this is
/// useful for making arguments: myprog --flag:myopt=1 foobar
///
/////////////////////////////////////////////////////////////////////////////
class OIIO_API ArgParse {
public:
ArgParse (int argc=0, const char **argv=NULL);
~ArgParse ();
/// Declare the command line options. After the introductory
/// message, parameters are a set of format strings and variable
/// pointers. Each string contains an option name and a scanf-like
/// format string to enumerate the arguments of that option
/// (eg. "-option %d %f %s"). The format string is followed by a
/// list of pointers to the argument variables, just like scanf. A
/// NULL terminates the list. Multiple calls to options() will
/// append additional options.
int options (const char *intro, ...);
/// With the options already set up, parse the command line.
/// Return 0 if ok, -1 if it's a malformed command line.
int parse (int argc, const char **argv);
/// Return any error messages generated during the course of parse()
/// (and clear any error flags). If no error has occurred since the
/// last time geterror() was called, it will return an empty string.
std::string geterror () const;
/// Print the usage message to stdout. The usage message is
/// generated and formatted automatically based on the command and
/// description arguments passed to parse().
void usage () const;
/// Print a brief usage message to stdout. The usage message is
/// generated and formatted automatically based on the command and
/// description arguments passed to parse().
void briefusage () const;
/// Return the entire command-line as one string.
///
std::string command_line () const;
private:
int m_argc; // a copy of the command line argc
const char **m_argv; // a copy of the command line argv
mutable std::string m_errmessage; // error message
ArgOption *m_global; // option for extra cmd line arguments
std::string m_intro;
std::vector<ArgOption *> m_option;
ArgOption *find_option(const char *name);
// void error (const char *format, ...)
TINYFORMAT_WRAP_FORMAT (void, error, /**/,
std::ostringstream msg;, msg, m_errmessage = msg.str();)
int found (const char *option); // number of times option was parsed
};
// Define symbols that let client applications determine if newly added
// features are supported.
#define OIIO_ARGPARSE_SUPPORTS_BRIEFUSAGE 1
OIIO_NAMESPACE_END
#endif // OPENIMAGEIO_ARGPARSE_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
Copyright 2008 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
#ifndef OPENIMAGEIO_DASSERT_H
#define OPENIMAGEIO_DASSERT_H
#include <cstdio>
#include <cstdlib>
#include "platform.h"
/// \file
///
/// Handy macros for debugging assertions.
///
/// - ASSERT (if not already defined) is defined to check if a condition
/// is met, and if not, calls ABORT with an error message
/// indicating the module and line where it occurred.
/// - ASSERT_MSG: like ASSERT, but takes printf-like extra arguments
/// - DASSERT is the same as ASSERT when NDEBUG is not defined but a
/// no-op when not in debug mode.
/// - DASSERT_MSG: like DASSERT, but takes printf-like extra arguments
/// - OIIO_STATIC_ASSERT(cond) : static assertion
/// - OIIO_STATIC_ASSERT_MSG(cond,msg) : static assertion + message
///
/// The presumed usage is that you want ASSERT for dire conditions that
/// must be checked at runtime even in an optimized build. DASSERT is
/// for checks we should do for debugging, but that we don't want to
/// bother with in a shipping optimized build.
///
/// In both cases, these are NOT a substitute for actual error checking
/// and recovery! Never ASSERT or DASSERT to check invalid user input,
/// for example. They should be used only to verify that there aren't
/// errors in the *code* that are so severe that there is no point even
/// trying to recover gracefully.
/// ASSERT(condition) checks if the condition is met, and if not, prints
/// an error message indicating the module and line where the error
/// occurred and then aborts.
#ifndef ASSERT
# define ASSERT(x) \
(OIIO_LIKELY(x) ? ((void)0) \
: (fprintf (stderr, "%s:%u: failed assertion '%s'\n", \
__FILE__, __LINE__, #x), abort()))
#endif
/// ASSERT_MSG(condition,msg,...) is like ASSERT, but lets you add
/// formatted output (a la printf) to the failure message.
#ifndef ASSERT_MSG
# define ASSERT_MSG(x,msg,...) \
(OIIO_LIKELY(x) ? ((void)0) \
: (fprintf (stderr, "%s:%u: failed assertion '%s': " msg "\n", \
__FILE__, __LINE__, #x, __VA_ARGS__), abort()))
#endif
#ifndef ASSERTMSG
#define ASSERTMSG ASSERT_MSG
#endif
/// DASSERT(condition) is just like ASSERT, except that it only is
/// functional in DEBUG mode, but does nothing when in a non-DEBUG
/// (optimized, shipping) build.
#ifndef NDEBUG
# define DASSERT(x) ASSERT(x)
#else
/* DASSERT does nothing when not debugging; sizeof trick prevents warnings */
# define DASSERT(x) ((void)sizeof(x))
#endif
/// DASSERT_MSG(condition,msg,...) is just like ASSERT_MSG, except that it
/// only is functional in DEBUG mode, but does nothing when in a
/// non-DEBUG (optimized, shipping) build.
#ifndef NDEBUG
# define DASSERT_MSG ASSERT_MSG
#else
# define DASSERT_MSG(x,...) ((void)sizeof(x)) /* does nothing when not debugging */
#endif
#ifndef DASSERTMSG
#define DASSERTMSG DASSERT_MSG
#endif
/// Define OIIO_STATIC_ASSERT and OIIO_STATIC_ASSERT_MSG as wrappers around
/// static_assert and static_assert_msg, with appropriate fallbacks for
/// older C++ standards.
#if (__cplusplus >= 201700L) /* FIXME - guess the token, fix when C++17 */
# define OIIO_STATIC_ASSERT(cond) static_assert(cond)
# define OIIO_STATIC_ASSERT_MSG(cond,msg) static_assert(cond,msg)
#elif (__cplusplus >= 201103L)
# define OIIO_STATIC_ASSERT(cond) static_assert(cond,"")
# define OIIO_STATIC_ASSERT_MSG(cond,msg) static_assert(cond,msg)
#else /* FIXME(C++11): this case can go away when C++11 is our minimum */
# include <boost/static_assert.hpp>
# define OIIO_STATIC_ASSERT(cond) BOOST_STATIC_ASSERT(cond)
# define OIIO_STATIC_ASSERT_MSG(cond,msg) BOOST_STATIC_ASSERT_MSG(cond,msg)
#endif
#endif // OPENIMAGEIO_DASSERT_H
/*
Copyright 2009 Larry Gritz and the other authors and contributors.
All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the software's owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(This is the Modified BSD License)
*/
#ifndef OPENIMAGEIO_ERRORMANAGER_H
#define OPENIMAGEIO_ERRORMANAGER_H
#include <cstdarg>
#include "export.h"
#include "oiioversion.h"
#include "strutil.h"
OIIO_NAMESPACE_BEGIN
/// ErrorHandler is a simple class that accepts error messages
/// (classified as errors, severe errors, warnings, info, messages, or
/// debug output) and handles them somehow. By default it just prints
/// the messages to stdout and/or stderr (and supresses some based on a
/// "verbosity" level).
///
/// The basic idea is that your library code has no idea whether some
/// application that will use it someday will want errors or other
/// output to be sent to the console, go to a log file, be intercepted
/// by the calling application, or something else. So you punt, by
/// having your library take a pointer to an ErrorHandler, passed in
/// from the calling app (and possibly subclassed to have arbitrarily
/// different behavior from the default console output) and make all
/// error-like output via the ErrorHandler*.
///
class OIIO_API ErrorHandler {
public:
/// Error categories. We use broad categories in the high order bits.
/// A library may just use these categories, or may create individual
/// error codes as long as they have the right high bits to designate
/// their category (file not found = ERROR + 1, etc.).
enum ErrCode {
EH_NO_ERROR = 0, // never sent to handler
EH_MESSAGE = 0 << 16,
EH_INFO = 1 << 16,
EH_WARNING = 2 << 16,
EH_ERROR = 3 << 16,
EH_SEVERE = 4 << 16,
EH_DEBUG = 5 << 16
};
/// VerbosityLevel controls how much detail the calling app wants.
///
enum VerbosityLevel {
QUIET = 0, ///< Show MESSAGE, SEVERE, ERROR only
NORMAL = 1, ///< Show MESSAGE, SEVERE, ERROR, WARNING
VERBOSE = 2 ///< Like NORMAL, but also show INFO
};
ErrorHandler () : m_verbosity(NORMAL) { }
virtual ~ErrorHandler () { }
/// The main (or "full detail") method -- takes a code (with high
/// bits being an ErrCode) and writes the message, with a prefix
/// indicating the error category (no prefix for "MESSAGE") and
/// error string.
virtual void operator () (int errcode, const std::string &msg);
/// Info message with printf-like formatted error message.
/// Will not print unless verbosity >= VERBOSE.
void info (const char *format, ...) OPENIMAGEIO_PRINTF_ARGS(2,3);
/// Warning message with printf-like formatted error message.
/// Will not print unless verbosity >= NORMAL (i.e. will suppress
/// for QUIET).
void warning (const char *format, ...) OPENIMAGEIO_PRINTF_ARGS(2,3);
/// Error message with printf-like formatted error message.
/// Will print regardless of verbosity.
void error (const char *format, ...) OPENIMAGEIO_PRINTF_ARGS(2,3);
/// Severe error message with printf-like formatted error message.
/// Will print regardless of verbosity.
void severe (const char *format, ...) OPENIMAGEIO_PRINTF_ARGS(2,3);
/// Prefix-less message with printf-like formatted error message.
/// Will not print if verbosity is QUIET. Also note that unlike
/// the other routines, message() will NOT append a newline.
void message (const char *format, ...) OPENIMAGEIO_PRINTF_ARGS(2,3);
/// Debugging message with printf-like formatted error message.
/// This will not produce any output if not in DEBUG mode, or
/// if verbosity is QUIET.
#ifndef NDEBUG
void debug (const char *format, ...) OPENIMAGEIO_PRINTF_ARGS(2,3);
#else
void debug (const char * /*format*/, ...) OPENIMAGEIO_PRINTF_ARGS(2,3) { }
#endif
void vInfo (const char *format, va_list argptr);
void vWarning (const char *format, va_list argptr);
void vError (const char *format, va_list argptr);
void vSevere (const char *format, va_list argptr);
void vMessage (const char *format, va_list argptr);
#ifndef NDEBUG
void vDebug (const char *format, va_list argptr);
#else
void vDebug (const char *, va_list) { }
#endif
void info (const std::string &msg) { (*this)(EH_INFO, msg); }
void warning (const std::string &msg) { (*this)(EH_WARNING, msg); }
void error (const std::string &msg) { (*this)(EH_ERROR, msg); }