|
/************************************************************
* *
* Written by Stanic Igor 2012/2013 *
* Header with basic defines/typedefs. This is the place *
* where you need to define the platform you target *
* compilation for(WINDOWS/LINUX). *
* *
************************************************************/
#ifndef BASEDECL_BOOST_FILESYSTEM_HELPER_H
#define BASEDECL_BOOST_FILESYSTEM_HELPER_H
/***********************************************/
//Change define to specify platform where you
//need to compile
/***********************************************/
#define WINDOWS
//#define LINUX
#include <string>
#include <sstream>
#include <typeinfo>
#include <limits>
#ifdef WINDOWS
typedef std::wstring STRING_TYPE;
typedef std::wstringstream STR_STREAM;
#define EMPTYSTR std::wstring()
//char array literal to wchar_t array
#define CHRARR_CON(x) L ##x
#elif defined(LINUX)
typedef std::string STRING_TYPE;
typedef std::stringstream STR_STREAM;
#define EMPTYSTR std::string()
#define CHRARR_CON(x) STRING_TYPE(x)
#define CH_TYPE(x) x
#endif
typedef long long LLONG;
typedef unsigned long long ULLONG;
typedef unsigned int UINT;
typedef unsigned long ULONG;
#define STR_SET Helpers::STRING_TYPES<STRING_TYPE, STR_STREAM>
template<typename TSTR = STRING_TYPE>
inline bool IS_W_STRING()
{
return typeid(TSTR) == typeid(std::wstring);
}
inline std::wstring TO_STRING_TYPE(const std::wstring& str)
{
return str;
}
template<typename TSTR = STRING_TYPE>
inline TSTR TO_STRING_TYPE(const std::string& str)
{
#ifdef WINDOWS
TSTR retval(str.begin(), str.end());
return retval;
#elif defined(LINUX)
return str;
#endif
}
template<typename TSTR = STRING_TYPE>
inline TSTR TO_STRING_TYPE(const char* chars)
{
std::string temp(chars);
#ifdef WINDOWS
TSTR retval(temp.begin(), temp.end());
return retval;
#elif defined(LINUX)
return temp;
#endif
}
#endif // BASEDECL_H
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software developer with couple of years of experience mostly with .NET programming and MS SQL databases currently interested in expanding knowledge to C++ and other operating systems.