2019-04-11 14:40:54 +08:00
|
|
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
2019-03-31 01:37:06 +08:00
|
|
|
//
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
|
//
|
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
|
//
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
// THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
2019-04-11 14:40:54 +08:00
|
|
|
# error Kiwano only supports C++
|
2019-03-31 01:37:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef _MSC_VER
|
2019-04-11 14:40:54 +08:00
|
|
|
# error Kiwano only supports MSVC compiler
|
2019-03-31 01:37:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef VS_VER
|
|
|
|
|
# define VS_VER _MSC_VER
|
|
|
|
|
# define VS_2013 1800
|
|
|
|
|
# define VS_2015 1900
|
|
|
|
|
# define VS_2017 1900
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if VS_VER < VS_2013
|
2019-04-11 14:40:54 +08:00
|
|
|
# error Kiwano only supports Visual Studio 2013 and above
|
2019-03-31 01:37:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef WINVER
|
|
|
|
|
# define WINVER 0x0700 // Allow use of features specific to Windows 7 or later
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef _WIN32_WINNT
|
|
|
|
|
# define _WIN32_WINNT 0x0700 // Allow use of features specific to Windows 7 or later
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef NTDDI_VERSION
|
|
|
|
|
# define NTDDI_VERSION NTDDI_WIN7
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef UNICODE
|
|
|
|
|
# define UNICODE
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Exclude rarely-used items from Windows headers
|
|
|
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
|
|
|
# define WIN32_LEAN_AND_MEAN
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef NOMINMAX
|
|
|
|
|
# define NOMINMAX
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Windows Header Files
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <wincodec.h>
|
|
|
|
|
|
|
|
|
|
// C++ RunTime Header Files
|
|
|
|
|
#include <cassert>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
// Compile-time Config Header File
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(DEBUG) || defined(_DEBUG)
|
2019-04-11 14:40:54 +08:00
|
|
|
# define KGE_DEBUG
|
2019-03-31 01:37:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if VS_VER >= VS_2015
|
2019-04-11 14:40:54 +08:00
|
|
|
# define KGE_NOEXCEPT noexcept
|
|
|
|
|
# define KGE_CONSTEXPR constexpr
|
2019-03-31 01:37:06 +08:00
|
|
|
#else
|
2019-04-11 14:40:54 +08:00
|
|
|
# define KGE_NOEXCEPT throw()
|
|
|
|
|
# define KGE_CONSTEXPR const
|
2019-03-31 01:37:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
2019-04-11 14:40:54 +08:00
|
|
|
#ifndef KGE_ASSERT
|
|
|
|
|
# ifdef KGE_DEBUG
|
|
|
|
|
# define KGE_ASSERT(EXPR) assert(EXPR)
|
2019-03-31 01:37:06 +08:00
|
|
|
# else
|
2019-04-11 14:40:54 +08:00
|
|
|
# define KGE_ASSERT __noop
|
2019-03-31 01:37:06 +08:00
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-04-11 14:40:54 +08:00
|
|
|
#ifndef KGE_API
|
|
|
|
|
/* Building or calling Kiwano as a static library */
|
|
|
|
|
# define KGE_API
|
2019-03-31 01:37:06 +08:00
|
|
|
#else
|
|
|
|
|
/*
|
|
|
|
|
* C4251 can be ignored if you are deriving from a type in the
|
|
|
|
|
* C++ Standard Library, compiling a debug release (/MTd) and
|
|
|
|
|
* where the compiler error message refers to _Container_base.
|
|
|
|
|
*/
|
|
|
|
|
# pragma warning (disable: 4251)
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-04-11 14:40:54 +08:00
|
|
|
#define KGE_NOT_USED(VAR) ((void)VAR)
|
2019-03-31 01:37:06 +08:00
|
|
|
|
2019-04-11 14:40:54 +08:00
|
|
|
#define KGE_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__))
|