nux-0.9.46

NuxCore/NuxCore.h File Reference

#include "System.h"
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <map>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <new>
#include <set>
#include "Namespace.h"
#include "SystemTypes.h"
#include "Macros.h"
#include "Memory.h"
#include "Character/NUni.h"
#include "Template.h"
#include "NumberConversion.h"
#include "TextString.h"
#include "NUniqueIndex.h"
#include "Character/NTChar.h"
#include "TimeFunctions.h"
#include "CPU.h"
#include "Platform.h"
#include "FileManager/NSerializer.h"
#include "Process.h"
#include "OutputDevice.h"
#include "FileManager/NFileManagerGeneric.h"
#include "FileIO.h"
#include "ObjectType.h"
#include "FileName.h"
#include "Color.h"
#include "Colors.h"
#include "Object.h"
#include "GlobalInitializer.h"

Go to the source code of this file.

Namespaces

namespace  nux

Defines

#define NUX_STATIC_CAST(a, b)   static_cast<a>(b)
#define NUX_REINTERPRET_CAST(a, b)   reinterpret_cast<a>(b)
#define NUX_CONST_CAST(a, b)   const_cast<a>(b)
#define NUX_DYNAMIC_CAST(a, b)   dynamic_cast<a>(b)
#define NUX_INVALID_INDEX   -1
#define NUX_INVALID_HANDLE   -1
#define NUX_IN
#define NUX_OUT
#define NUX_0   0
#define NUX_1   1
#define NUX_2   2
#define NUX_4   4
#define NUX_8   8
#define NUX_16   16
#define NUX_32   32
#define NUX_64   64
#define NUX_128   128
#define NUX_256   256
#define NUX_512   512
#define NUX_1024   1024
#define NUX_2048   2048
#define NUX_4096   4096
#define NUX_8192   8192
#define NUX_16384   16384
#define NUX_65536   65536
#define NUX_MAKEFOURCHARTAG(ch0, ch1, ch2, ch3)
#define INLNEW   new
#define INLDELETE   delete
#define INLDELETEARRAY   delete []
#define NUX_RUNTIME_ERROR(str,...)   LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_ERROR_IF_NULL(test, str,...)   if(test == 0) LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_ERROR_IF_TRUE(test, str,...)   if(test) LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_ERROR_IF_FALSE(test, str,...)   if(!(test)) LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_RETURN_IF_NULL(test)   if(test == 0) return;
#define NUX_RETURN_IF_TRUE(test)   if(test) return;
#define NUX_RETURN_IF_FALSE(test)   if(!(test)) return;
#define NUX_RETURN_VALUE_IF_NULL(test, value)   if(test == 0) return value;
#define NUX_RETURN_VALUE_IF_TRUE(test, value)   if(test) return value;
#define NUX_RETURN_VALUE_IF_FALSE(test, value)   if(!(test)) return value;
#define NUX_ARRAY_SIZE(array)   (sizeof(array) / sizeof((array)[0]))
#define GET_VARARGS(msg, size, len, fmt)
#define GET_VARARGS_ANSI(msg, size, len, fmt)
#define GET_VARARGS_RESULT(msg, size, len, fmt, result)
#define nuxWarningMsg(str,...)   { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_WARNING, str, ##__VA_ARGS__);}
#define nuxAlertMsg(str,...)   { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_ALERT, str, ##__VA_ARGS__);}
#define nuxCriticalMsg(str,...)   { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_CRITICAL, str, ##__VA_ARGS__);}
#define nuxDebugMsg(a,...)
#define nuxError(a,...)   {}
#define nuxAssert(expr)   {}
#define nuxVerifyExpr(expr)   { if(!(expr)) {} }
#define nuxAssertMsg(expr, msg,...)   {}
#define nuxVerifyExprMsg(expr, a,...)   { if(!(expr)) {} }
#define nuxAssertNoEntry()   {}
#define nuxAssertNoReentry()   {}
#define nuxAssertNoRecursion()   {}
#define nuxAssertAtCompileTime(expr)   {}
#define CALL_OS_TCHAR_FUNCTION(funcW, funcA)   funcA
#define TCHAR_TO_ANSI(str)   str
#define ANSI_TO_TCHAR(str)   (const TCHAR*)((const ANSICHAR*)str)
#define UTF8ToTCHAR(str)   str
#define TCHARToUTF8(str)   str
#define UTF16ToTCHAR(str)   (const char*)NUTF8(str)
#define TCHARToUTF16(str)   (const wchar_t*)NUTF16(str)
#define inlUTF16ToUTF8(s)   (const char*)nux::NUTF8(s)
#define inlUTF8ToUTF16(s)   (const wchar_t*)nux::NUTF16(s)
#define ANSICHAR_TO_UNICHAR(str)   (UNICHAR*) nux::NCharacterConversion <UNICHAR, ANSICHAR, nux::AnsicharToUnicharConvertion>((const ANSICHAR*)str)
#define UNICHAR_TO_ANSICHAR(str)   (ANSICHAR*) nux::NCharacterConversion <ANSICHAR, UNICHAR, nux::UnicharToAnsicharConvertion>((const UNICHAR*)str)
#define ANSICHAR_TO_TCHAR(str)   (UNICHAR*) nux::NCharacterConversion <TCHAR, ANSICHAR, nux::AnsiToTCharConversion>((const ANSICHAR*)str)
#define TCHAR_TO_ANSICHAR(str)   (ANSICHAR*) nux::NCharacterConversion <ANSICHAR, TCHAR, nux::TCharToAnsiConvertion>((const TCHAR*)str)
#define TCHAR_TO_UNICHAR(str)   (UNICHAR*) nux::NCharacterConversion <UNICHAR, TCHAR, nux::TCharToUnicharConvertion>((const TCHAR*)str)
#define NUX_WIN32_LINE_TERMINATOR   TEXT("\r\n")
#define NUX_UNIX_LINE_TERMINATOR   TEXT("\n")
#define NUX_MACOSX_LINE_TERMINATOR   TEXT("\n")
#define NUX_BACKSLASH_CHAR   TEXT('\\')
#define NUX_BACKSLASH_STRING   TEXT("\\")
#define NUX_SLASH_CHAR   TEXT('/')
#define NUX_SLASH_STRING   TEXT("/")
#define NUX_MAX_FILEPATH_SIZE   1024
#define WCSNCPY_S(strDest, numberOfElements, strSource, count)   wcsncpy (strDest, strSource, count)
#define STRNCPY_S(strDest, numberOfElements, strSource, count)   _tcsncpy(strDest, strSource, count)
#define STRCPY_S(strDest, numberOfElements, strSource)   _tcscpy(strDest, strSource)
#define STRCAT_S(strDest, numberOfElements, strSource)   _tcscat(strDest, strSource)
#define VSNPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)   vsnprintf(strDest, Count, format, VA_Arg_List)
#define VSNTPRINTF_S(strDest, numberOfElements, Count, format, VA_Arg_List)   _vsntprintf(strDest, Count, format, VA_Arg_List)
#define SPRINTF_S(strDest, numberOfElements, format,...)   _stprintf(strDest, format, ##__VA_ARGS__)
#define SNPRINTF_S(strDest, numberOfElements, Count, format,...)   _sntprintf(strDest, Count, format, ##__VA_ARGS__)
#define STRDATE_S(strDest, numberOfElements)   _tstrdate(strDest)
#define STRTIME_S(strDest, numberOfElements)   _tstrtime(strDest)
#define FOPEN_S(file, filename, mode)   (file = _tfopen(filename, mode))
#define STRLEN_S(str, numberOfElements)   _tcslen(str)
#define SPLITPATH_S(path, Drive, DriveNumElements, Dir, DirNumElements, Filename, FileNumElements, Extension, ExtNumElements)   _tsplitpath(path, Drive, Dir, Filename, Extension)
#define MAKEPATH_S(path, numberOfElements, Drive, Dir, Filename, Extension)   _makepath(path, Drive, Dir, Filename, Extension)
#define SSCANF_S(buffer, format,...)   _stscanf(buffer, format, ##__VA_ARGS__)
#define SNSCANF_S(input, length, format,...)   _sntscanf(input, length, format, ##__VA_ARGS__)
#define tstring   std::string
#define tostream   std::ostream
#define tistream   std::istream
#define tiostream   std::iostream
#define tofstream   std::ofstream
#define tfstream   std::fstream
#define GNullDevice   NUX_GLOBAL_OBJECT_INSTANCE(nux::NullOutput)
#define GLogDevice   NUX_GLOBAL_OBJECT_INSTANCE(nux::LogOutputRedirector)
#define nuxIsDebuggerPresent()   0
#define inlDebugBreak()
#define NUX_HARDWARE_BREAK
#define NUX_BREAK_ASM_INT3
#define NUX_PURE_VIRTUAL   = 0;
#define VARARG_EXTRA(A)   A,
#define VARARG_NONE
#define VARARG_PURE   =0
#define VARARG_DECL(FuncRet, StaticFuncRet, Return, FuncName, Pure, FmtType, ExtraParamDecl, ExtraParam)   FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... ) Pure
#define VARARG_BODY(FuncRet, FuncName, FmtType, ExtraParamDecl)   FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... )
#define PURE_VIRTUAL(func, extra)   { nuxError(TEXT("Pure virtual not implemented (%s)"), TEXT(#func)); extra }

Enumerations

enum  nux::MessageSeverity {
  nux::NUX_MSG_SEVERITY_CRITICAL = 0, nux::NUX_MSG_SEVERITY_ALERT = 1, nux::NUX_MSG_SEVERITY_WARNING = 2, nux::NUX_MSG_SEVERITY_INFO = 3,
  nux::NUX_MSG_SEVERITY_NONE = 4
}
enum  nux::EFileWrite {
  nux::FILEWRITE_NOFAIL = 0x01, nux::FILEWRITE_NOREPLACEEXISTING = 0x02, nux::FILEWRITE_EVENIFREADONLY = 0x04, nux::FILEWRITE_UNBUFFERED = 0x08,
  nux::FILEWRITE_APPEND = 0x10, nux::FILEWRITE_ALLOWREAD = 0x20
}
enum  nux::ECopyResult {
  nux::COPY_OK = 0x00, nux::COPY_MISCFAIL = 0x01, nux::COPY_READFAIL = 0x02, nux::COPY_WRITEFAIL = 0x03,
  nux::COPY_CANCELED = 0x06
}
enum  nux::NUX_STATUS {
  nux::NUX_OK, nux::NUX_ERROR, nux::NUX_FILENOTFOUND, nux::NUX_COPYFILE_ERROR,
  nux::NUX_DELETEFILE_ERROR
}

Functions

t_u32 nux::GetVariableArgs (TCHAR *Dest, t_u32 Size, t_u32 Count, const TCHAR *&Fmt, va_list ArgPtr)
t_u32 nux::GetVariableArgsAnsi (ANSICHAR *Dest, t_u32 Size, t_u32 Count, const ANSICHAR *&Fmt, va_list ArgPtr)
void nux::PrintOutputDebugString (const TCHAR *Format,...)
 Log an outpout message to console or visual studio output. To be used while the log redirector is not initialized.
void nux::LogOutputAssertMessage (const ANSICHAR *File, int Line, const TCHAR *Format=TEXT(""),...)
 Log an assertion failure to registered output.
void nux::LogOutputErrorMessage (const ANSICHAR *File, int Line, const TCHAR *Format=TEXT(""),...)
 Log an error message to registered output.
void nux::LogOutputDebugMessage (const TCHAR *Format,...)
 Log and output message with a severity factor to registered output. Print colored output in XTerm.
void nux::LogOutputSeverityMessage (int Severity, const TCHAR *Format,...)
 Log and output message with a severity factor to registered output. Print colored output in XTerm.
bool nux::OutputRedirectorReady ()

Variables

const t_bool nux::GNoDialog
const BYTE nux::NUX_UTF32_BE [] = {0x04 , 0x00, 0x00, 0xFE, 0xFF }
const BYTE nux::NUX_UTF32_LE [] = {0x04 , 0xFF, 0xFE, 0x00, 0x00 }
const BYTE nux::NUX_UTF16_BE [] = {0x02 , 0xFE, 0xFF }
const BYTE nux::NUX_UTF16_LE [] = {0x02 , 0xFF, 0xFE }
const BYTE nux::NUX_UTF8 [] = {0x03 , 0xEF, 0xBB, 0xBF }

Define Documentation

#define ANSI_TO_TCHAR (   str)    (const TCHAR*)((const ANSICHAR*)str)
#define ANSICHAR_TO_TCHAR (   str)    (UNICHAR*) nux::NCharacterConversion <TCHAR, ANSICHAR, nux::AnsiToTCharConversion>((const ANSICHAR*)str)
#define ANSICHAR_TO_UNICHAR (   str)    (UNICHAR*) nux::NCharacterConversion <UNICHAR, ANSICHAR, nux::AnsicharToUnicharConvertion>((const ANSICHAR*)str)
#define CALL_OS_TCHAR_FUNCTION (   funcW,
  funcA 
)    funcA
#define FOPEN_S (   file,
  filename,
  mode 
)    (file = _tfopen(filename, mode))
#define GET_VARARGS (   msg,
  size,
  len,
  fmt 
)
Value:
{                                                   \
    va_list arg_list;                               \
    va_start(arg_list,fmt);                         \
    VSNTPRINTF_S( msg, size, len, fmt, arg_list );  \
    va_end( arg_list );                             \
}
#define GET_VARARGS_ANSI (   msg,
  size,
  len,
  fmt 
)
Value:
{                                                   \
    va_list arg_list;                               \
    va_start(arg_list,fmt);                         \
    VSNPRINTF_S( msg, size, len, fmt, arg_list );   \
    va_end( arg_list );                             \
}
#define GET_VARARGS_RESULT (   msg,
  size,
  len,
  fmt,
  result 
)
Value:
{                                                               \
    va_list arg_list;                                           \
    va_start(arg_list, fmt);                                    \
    result = GetVariableArgs(msg, size, len, fmt, arg_list);    \
}
#define GLogDevice   NUX_GLOBAL_OBJECT_INSTANCE(nux::LogOutputRedirector)
#define GNullDevice   NUX_GLOBAL_OBJECT_INSTANCE(nux::NullOutput)
#define inlDebugBreak ( )
#define INLDELETE   delete
#define INLDELETEARRAY   delete []
#define INLNEW   new
#define inlUTF16ToUTF8 (   s)    (const char*)nux::NUTF8(s)
#define inlUTF8ToUTF16 (   s)    (const wchar_t*)nux::NUTF16(s)
#define MAKEPATH_S (   path,
  numberOfElements,
  Drive,
  Dir,
  Filename,
  Extension 
)    _makepath(path, Drive, Dir, Filename, Extension)
#define NUX_0   0
#define NUX_1   1
#define NUX_1024   1024
#define NUX_128   128
#define NUX_16   16
#define NUX_16384   16384
#define NUX_2   2
#define NUX_2048   2048
#define NUX_256   256
#define NUX_32   32
#define NUX_4   4
#define NUX_4096   4096
#define NUX_512   512
#define NUX_64   64
#define NUX_65536   65536
#define NUX_8   8
#define NUX_8192   8192
#define NUX_ARRAY_SIZE (   array)    (sizeof(array) / sizeof((array)[0]))
#define NUX_BACKSLASH_CHAR   TEXT('\\')
#define NUX_BACKSLASH_STRING   TEXT("\\")
#define NUX_BREAK_ASM_INT3
#define NUX_DYNAMIC_CAST (   a,
 
)    dynamic_cast<a>(b)
#define NUX_ERROR_IF_FALSE (   test,
  str,
  ... 
)    if(!(test)) LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_ERROR_IF_NULL (   test,
  str,
  ... 
)    if(test == 0) LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_ERROR_IF_TRUE (   test,
  str,
  ... 
)    if(test) LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_IN
#define NUX_INVALID_HANDLE   -1
#define NUX_INVALID_INDEX   -1
#define NUX_MACOSX_LINE_TERMINATOR   TEXT("\n")
#define NUX_MAKEFOURCHARTAG (   ch0,
  ch1,
  ch2,
  ch3 
)
Value:
((DWORD)(BYTE)(ch0) |               \
    ((DWORD)(BYTE)(ch1) << 8) |         \
    ((DWORD)(BYTE)(ch2) << 16) |        \
    ((DWORD)(BYTE)(ch3) << 24 ))
#define NUX_MAX_FILEPATH_SIZE   1024
#define NUX_OUT
#define NUX_PURE_VIRTUAL   = 0;
#define NUX_REINTERPRET_CAST (   a,
 
)    reinterpret_cast<a>(b)
#define NUX_RETURN_IF_FALSE (   test)    if(!(test)) return;
#define NUX_RETURN_IF_NULL (   test)    if(test == 0) return;
#define NUX_RETURN_IF_TRUE (   test)    if(test) return;
#define NUX_RETURN_VALUE_IF_FALSE (   test,
  value 
)    if(!(test)) return value;
#define NUX_RETURN_VALUE_IF_NULL (   test,
  value 
)    if(test == 0) return value;
#define NUX_RETURN_VALUE_IF_TRUE (   test,
  value 
)    if(test) return value;
#define NUX_RUNTIME_ERROR (   str,
  ... 
)    LogOutputErrorMessage(__FILE__, __LINE__, str, ##__VA_ARGS__);
#define NUX_SLASH_CHAR   TEXT('/')
#define NUX_SLASH_STRING   TEXT("/")
#define NUX_STATIC_CAST (   a,
 
)    static_cast<a>(b)
#define NUX_UNIX_LINE_TERMINATOR   TEXT("\n")
#define NUX_WIN32_LINE_TERMINATOR   TEXT("\r\n")
#define nuxAlertMsg (   str,
  ... 
)    { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_ALERT, str, ##__VA_ARGS__);}
#define nuxAssertAtCompileTime (   expr)    {}
#define nuxAssertNoEntry ( )    {}
#define nuxAssertNoRecursion ( )    {}
#define nuxAssertNoReentry ( )    {}
#define nuxCriticalMsg (   str,
  ... 
)    { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_CRITICAL, str, ##__VA_ARGS__);}
#define nuxDebugMsg (   a,
  ... 
)
#define nuxError (   a,
  ... 
)    {}
#define nuxIsDebuggerPresent ( )    0
#define nuxVerifyExpr (   expr)    { if(!(expr)) {} }
#define nuxVerifyExprMsg (   expr,
  a,
  ... 
)    { if(!(expr)) {} }
#define nuxWarningMsg (   str,
  ... 
)    { nux::LogOutputSeverityMessage(nux::NUX_MSG_SEVERITY_WARNING, str, ##__VA_ARGS__);}
#define PURE_VIRTUAL (   func,
  extra 
)    { nuxError(TEXT("Pure virtual not implemented (%s)"), TEXT(#func)); extra }
#define SNPRINTF_S (   strDest,
  numberOfElements,
  Count,
  format,
  ... 
)    _sntprintf(strDest, Count, format, ##__VA_ARGS__)
#define SNSCANF_S (   input,
  length,
  format,
  ... 
)    _sntscanf(input, length, format, ##__VA_ARGS__)
#define SPLITPATH_S (   path,
  Drive,
  DriveNumElements,
  Dir,
  DirNumElements,
  Filename,
  FileNumElements,
  Extension,
  ExtNumElements 
)    _tsplitpath(path, Drive, Dir, Filename, Extension)
#define SPRINTF_S (   strDest,
  numberOfElements,
  format,
  ... 
)    _stprintf(strDest, format, ##__VA_ARGS__)
#define SSCANF_S (   buffer,
  format,
  ... 
)    _stscanf(buffer, format, ##__VA_ARGS__)
#define STRCAT_S (   strDest,
  numberOfElements,
  strSource 
)    _tcscat(strDest, strSource)
#define STRCPY_S (   strDest,
  numberOfElements,
  strSource 
)    _tcscpy(strDest, strSource)
#define STRDATE_S (   strDest,
  numberOfElements 
)    _tstrdate(strDest)
#define STRLEN_S (   str,
  numberOfElements 
)    _tcslen(str)
#define STRNCPY_S (   strDest,
  numberOfElements,
  strSource,
  count 
)    _tcsncpy(strDest, strSource, count)
#define STRTIME_S (   strDest,
  numberOfElements 
)    _tstrtime(strDest)
#define TCHAR_TO_ANSI (   str)    str
#define TCHAR_TO_ANSICHAR (   str)    (ANSICHAR*) nux::NCharacterConversion <ANSICHAR, TCHAR, nux::TCharToAnsiConvertion>((const TCHAR*)str)
#define TCHAR_TO_UNICHAR (   str)    (UNICHAR*) nux::NCharacterConversion <UNICHAR, TCHAR, nux::TCharToUnicharConvertion>((const TCHAR*)str)
#define TCHARToUTF16 (   str)    (const wchar_t*)NUTF16(str)
#define TCHARToUTF8 (   str)    str
#define tfstream   std::fstream
#define tiostream   std::iostream
#define tistream   std::istream
#define tofstream   std::ofstream
#define tostream   std::ostream
#define tstring   std::string
#define UNICHAR_TO_ANSICHAR (   str)    (ANSICHAR*) nux::NCharacterConversion <ANSICHAR, UNICHAR, nux::UnicharToAnsicharConvertion>((const UNICHAR*)str)
#define UTF16ToTCHAR (   str)    (const char*)NUTF8(str)
#define UTF8ToTCHAR (   str)    str
#define VARARG_BODY (   FuncRet,
  FuncName,
  FmtType,
  ExtraParamDecl 
)    FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... )
#define VARARG_DECL (   FuncRet,
  StaticFuncRet,
  Return,
  FuncName,
  Pure,
  FmtType,
  ExtraParamDecl,
  ExtraParam 
)    FuncRet FuncName( ExtraParamDecl FmtType Fmt, ... ) Pure
#define VARARG_EXTRA (   A)    A,
#define VARARG_NONE
#define VARARG_PURE   =0
#define VSNPRINTF_S (   strDest,
  numberOfElements,
  Count,
  format,
  VA_Arg_List 
)    vsnprintf(strDest, Count, format, VA_Arg_List)
#define VSNTPRINTF_S (   strDest,
  numberOfElements,
  Count,
  format,
  VA_Arg_List 
)    _vsntprintf(strDest, Count, format, VA_Arg_List)
#define WCSNCPY_S (   strDest,
  numberOfElements,
  strSource,
  count 
)    wcsncpy (strDest, strSource, count)