Files
BlitzUtility/dllmain.h
T

64 lines
1.5 KiB
C++
Raw Normal View History

// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2015-06-06 14:09:40 +02:00
#pragma once
2015-05-17 12:43:07 +02:00
// STL Exceptions
#include <exception>
#include <stdexcept>
// Memory Management
#include <memory>
2015-06-20 15:52:40 +02:00
// Strings
#include <string>
#include <sstream>
#include <iomanip>
2015-05-17 12:43:07 +02:00
// Platform specific: Windows
#include <windows.h>
// Macros
2015-06-20 15:52:40 +02:00
#ifndef IMPORT
#define DLL_METHOD extern "C" //__declspec(dllexport)
#else
#define DLL_METHOD extern "c" __declspec(dllimport)
#endif
#define DLL_CALL __stdcall
//Templates
template< typename T >
std::string int_to_hex(T i) {
std::stringstream stream;
stream
<< std::setfill('0')
<< std::setw(sizeof(T) * 2)
<< std::hex
<< i;
return stream.str();
}
template< typename T >
T hex_to_int(std::string t) {
T x;
std::stringstream stream;
stream
<< std::hex
<< t;
stream
>> x;
return x;
}