CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
OdPlatform.h File Reference
#include "OdPlatformSettings.h"
#include "OdGUID.h"
#include <type_traits>
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <cstdlib>
#include <cmath>
#include <wchar.h>
#include <time.h>

Go to the source code of this file.

Macros

#define GETSS(s, n)
 
#define MAX_PATH   PATH_MAX
 
#define OdWprintf   wprintf
 
#define OdPrintf   printf
 
#define Odisnan(x)
 
#define Odfinite(x)
 
#define Od_abs   std::abs
 
#define Od_atof   atof
 
#define Od_labs   std::labs
 
#define Od_llabs   std::llabs
 
#define Od_srand   srand
 
#define Od_rand   rand
 
#define Od_wcstombs   wcstombs
 
#define Od_wcscpy   wcscpy
 
#define Od_wcscmp   wcscmp
 
#define Od_wcscat   wcscat
 
#define Od_wcschr   wcschr
 
#define Od_wcslen   wcslen
 
#define Od_wcsncpy   wcsncpy
 
#define Od_round   std::round
 
#define odStrChr(str, ch)
 
#define odWStrChr(str, ch)
 
#define odStrLen(str)
 
#define odStrLenA(str)
 
#define odStrCmp(str, str2)
 
#define odStrCmpA(str, str2)
 
#define FSEEK   fseeko64
 
#define FTELL   ftello64
 
#define FOPEN   fopen64
 
#define OFFSETTYPE(offset)
 
#define odStrICmp   Od_stricmpW
 
#define odStrICmpA(str, str2)
 
#define odStrnICmp   Od_stricmpW
 
#define odStrnICmpA(str, str2, n)
 
#define odStrUpr(str)
 
#define odStrUprA(str)
 
#define odStrLwr(str)
 
#define odStrLwrA(str)
 
#define odStrRev(str)
 
#define odStrRevA(str)
 
#define odStrToInt(str)
 
#define odStrToUInt(str)
 
#define Od_isspace(ch)
 
#define Od_iswspace(ch)
 
#define Od_isdigit(ch)
 
#define Od_iswdigit(ch)
 
#define odSScanf   swscanf
 
#define odSprintf   swprintf
 
#define odSprintfA   snprintf
 
#define odStrToF   Od_wtof
 
#define OD_TYPENAME
 
#define OD_TYPENAME2
 
#define OD_TYPENAME3
 
#define OD_BSEARCH   ::bsearch
 
#define TD_USING(a)
 
#define OD_LINKEDARRAY_SCOPE
 
#define odStrStr   ::wcsstr
 
#define OD_MAKEWORD(a, b)
 
#define OD_MAKELONG(a, b)
 
#define OD_LOWORD(l)
 
#define OD_HIWORD(l)
 
#define OD_LOBYTE(w)
 
#define OD_HIBYTE(w)
 
#define odSwap2BytesNumber(n)
 
#define odSwap4BytesNumber(n)
 
#define odSwap8Bytes(bytes)
 
#define odSwap4Bytes(bytes)
 
#define OD_INT8_FROM_BUFFPTR(pBuffPtr)
 
#define OD_BYTES_FROM_BUFFPTR(pBuffPtr, ResBuff, nCount)
 
#define OD_INT8_TO_BUFFPTR(pBuffPtr, val)
 
#define OD_BYTES_TO_BUFFPTR(pBuffPtr, FromBuff, nCount)
 
#define OD_INT16_FROM_BUFFPTR(pBuffPtr)
 
#define OD_INT32_FROM_BUFFPTR(pBuffPtr)
 
#define OD_INT64_FROM_BUFFPTR(pBuffPtr)
 
#define OD_DOUBLE_FROM_BUFFPTR(pBuffPtr)
 
#define OD_INT16_TO_BUFFPTR(pBuffPtr, val)
 
#define OD_INT32_TO_BUFFPTR(pBuffPtr, val)
 
#define OD_INT64_TO_BUFFPTR(pBuffPtr, val)
 
#define OD_DOUBLE_TO_BUFFPTR(pBuffPtr, val)
 
#define ODCOLORREF   OdUInt32
 
#define ODRGB(r, g, b)
 
#define ODRGBA(r, g, b, a)
 
#define ODGETRED(rgb)
 
#define ODGETGREEN(rgb)
 
#define ODGETBLUE(rgb)
 
#define ODGETALPHA(rgba)
 
#define RGBQUAD_DEFINED
 
#define BITMAPINFOHEADER_DEFINED
 
#define BITMAPINFO_DEFINED
 
#define BITMAPFILEHEADER_DEFINED
 
#define CLSID   OdGUID
 
#define ODTOCMCOLOR(colorref)
 
#define ODTOCOLORREF(cmColor)
 

Functions

template<class T>
ODRX_CONSTEXPR const T & odmax (const T &a, const T &b)
 
template<class T, class U, typename std::enable_if< sizeof(T) > = sizeof(U) && std::is_arithmetic<T>::value && std::is_arithmetic<U>::value && std::is_unsigned<T>::value == std::is_unsigned<U>::value, bool, ::type = true>
ODRX_CONSTEXPRodmax (T a, U b)
 
template<class T, class U, typename std::enable_if<(sizeof(T) > sizeof(U)) &&std::is_arithmetic< T >::value &&std::is_arithmetic< U >::value &&std::is_signed< T >::value &&std::is_unsigned< U >::value, bool >::type = true>
ODRX_CONSTEXPRodmax (T a, U b)
 
template<class T, class U, typename std::enable_if<(sizeof(T)< sizeof(U))||(sizeof(T)==sizeof(U) &&std::is_signed< T >::value &&std::is_unsigned< U >::value), bool >::type = true>
ODRX_CONSTEXPRodmax (T a, U b)
 
template<class T>
ODRX_CONSTEXPR const T & odmin (const T &a, const T &b)
 
template<class T, class U, typename std::enable_if< sizeof(T) > = sizeof(U) && std::is_arithmetic<T>::value && std::is_arithmetic<U>::value && std::is_unsigned<T>::value == std::is_unsigned<U>::value, bool, ::type = true>
ODRX_CONSTEXPRodmin (T a, U b)
 
template<class T, class U, typename std::enable_if< sizeof(T) > = sizeof(U) && std::is_arithmetic<T>::value && std::is_arithmetic<U>::value && std::is_unsigned<T>::value && std::is_signed<U>::value, bool, ::type = true>
ODRX_CONSTEXPRodmin (T a, U b)
 
template<class T, class U, typename std::enable_if<(sizeof(T) > sizeof(U)) &&std::is_arithmetic< T >::value &&std::is_arithmetic< U >::value &&std::is_signed< T >::value &&std::is_unsigned< U >::value, bool >::type = true>
ODRX_CONSTEXPRodmin (T a, U b)
 
template<class T, class U>
ODRX_CONSTEXPRodmin (T a, U b)
 

Macro Definition Documentation

◆ BITMAPFILEHEADER_DEFINED

#define BITMAPFILEHEADER_DEFINED

◆ BITMAPINFO_DEFINED

#define BITMAPINFO_DEFINED

◆ BITMAPINFOHEADER_DEFINED

#define BITMAPINFOHEADER_DEFINED

◆ CLSID

#define CLSID   OdGUID

◆ FOPEN

#define FOPEN   fopen64

◆ FSEEK

#define FSEEK   fseeko64

◆ FTELL

#define FTELL   ftello64

◆ GETSS

#define GETSS ( s,
n )
Value:
fgets(s, n, stdin)

◆ MAX_PATH

#define MAX_PATH   PATH_MAX

◆ Od_abs

#define Od_abs   std::abs

◆ Od_atof

#define Od_atof   atof

◆ OD_BSEARCH

#define OD_BSEARCH   ::bsearch

◆ OD_BYTES_FROM_BUFFPTR

#define OD_BYTES_FROM_BUFFPTR ( pBuffPtr,
ResBuff,
nCount )
Value:
(pBuffPtr+=nCount, ::memcpy(ResBuff, pBuffPtr-nCount, nCount))

◆ OD_BYTES_TO_BUFFPTR

#define OD_BYTES_TO_BUFFPTR ( pBuffPtr,
FromBuff,
nCount )
Value:
(pBuffPtr+=nCount, ::memcpy(pBuffPtr-nCount, FromBuff, nCount))

◆ OD_DOUBLE_FROM_BUFFPTR

#define OD_DOUBLE_FROM_BUFFPTR ( pBuffPtr)
Value:
getValidDouble(&pBuffPtr)

◆ OD_DOUBLE_TO_BUFFPTR

#define OD_DOUBLE_TO_BUFFPTR ( pBuffPtr,
val )
Value:
(pBuffPtr+=8, *((double*)(pBuffPtr-8)) = double(val))

◆ OD_HIBYTE

#define OD_HIBYTE ( w)
Value:
((OdUInt8)(((OdUInt16)(w) >> 8) & 0xFF))
unsigned short OdUInt16
unsigned char OdUInt8
GLfloat GLfloat GLfloat GLfloat w
Definition gles2_ext.h:320

◆ OD_HIWORD

#define OD_HIWORD ( l)
Value:
((OdUInt16)(((OdUInt32)(l) >> 16) & 0xFFFF))
unsigned int OdUInt32

◆ OD_INT16_FROM_BUFFPTR

#define OD_INT16_FROM_BUFFPTR ( pBuffPtr)
Value:
(pBuffPtr += 2, *((OdInt16*)(pBuffPtr - 2)))
short OdInt16

◆ OD_INT16_TO_BUFFPTR

#define OD_INT16_TO_BUFFPTR ( pBuffPtr,
val )
Value:
(pBuffPtr+=2, *((OdInt16*)(pBuffPtr-2)) = OdInt16(val))

◆ OD_INT32_FROM_BUFFPTR

#define OD_INT32_FROM_BUFFPTR ( pBuffPtr)
Value:
(pBuffPtr += 4, *((OdInt32*)(pBuffPtr - 4)))
int OdInt32

◆ OD_INT32_TO_BUFFPTR

#define OD_INT32_TO_BUFFPTR ( pBuffPtr,
val )
Value:
(pBuffPtr+=4, *((OdInt32*)(pBuffPtr-4)) = OdInt32(val))

◆ OD_INT64_FROM_BUFFPTR

#define OD_INT64_FROM_BUFFPTR ( pBuffPtr)
Value:
(pBuffPtr += 8, *((OdInt64*)(pBuffPtr - 8)))

◆ OD_INT64_TO_BUFFPTR

#define OD_INT64_TO_BUFFPTR ( pBuffPtr,
val )
Value:
(pBuffPtr+=8, *((OdInt64*)(pBuffPtr-8)) = OdInt64(val))

◆ OD_INT8_FROM_BUFFPTR

#define OD_INT8_FROM_BUFFPTR ( pBuffPtr)
Value:
*(pBuffPtr++)

◆ OD_INT8_TO_BUFFPTR

#define OD_INT8_TO_BUFFPTR ( pBuffPtr,
val )
Value:
(++pBuffPtr, pBuffPtr[-1] = OdUInt8(val))

◆ Od_isdigit

#define Od_isdigit ( ch)
Value:
isdigit(ch)

◆ Od_isspace

#define Od_isspace ( ch)
Value:
isspace(ch)

◆ Od_iswdigit

#define Od_iswdigit ( ch)
Value:
iswdigit(ch)

◆ Od_iswspace

#define Od_iswspace ( ch)
Value:
iswspace(ch)

◆ Od_labs

#define Od_labs   std::labs

◆ OD_LINKEDARRAY_SCOPE

#define OD_LINKEDARRAY_SCOPE

◆ Od_llabs

#define Od_llabs   std::llabs

◆ OD_LOBYTE

#define OD_LOBYTE ( w)
Value:
((OdUInt8)(w))

◆ OD_LOWORD

#define OD_LOWORD ( l)
Value:
((OdUInt16)(l))

◆ OD_MAKELONG

#define OD_MAKELONG ( a,
b )
Value:
((OdInt32)(((OdUInt16)(a)) | ((OdUInt32)((OdUInt16)(b))) << 16))

◆ OD_MAKEWORD

#define OD_MAKEWORD ( a,
b )
Value:
((OdUInt16)(((OdUInt8)(a)) | ((OdUInt16)((OdUInt8)(b))) << 8))

◆ Od_rand

#define Od_rand   rand

◆ Od_round

#define Od_round   std::round

◆ Od_srand

#define Od_srand   srand

◆ OD_TYPENAME

#define OD_TYPENAME

◆ OD_TYPENAME2

#define OD_TYPENAME2

◆ OD_TYPENAME3

#define OD_TYPENAME3

◆ Od_wcscat

#define Od_wcscat   wcscat

◆ Od_wcschr

#define Od_wcschr   wcschr

◆ Od_wcscmp

#define Od_wcscmp   wcscmp

◆ Od_wcscpy

#define Od_wcscpy   wcscpy

◆ Od_wcslen

#define Od_wcslen   wcslen

◆ Od_wcsncpy

#define Od_wcsncpy   wcsncpy

◆ Od_wcstombs

#define Od_wcstombs   wcstombs

◆ ODCOLORREF

#define ODCOLORREF   OdUInt32

◆ Odfinite

#define Odfinite ( x)
Value:
(finite(x) != 0)
GLfloat x
Definition gles2_ext.h:314

◆ ODGETALPHA

#define ODGETALPHA ( rgba)
Value:
((OdUInt8)((rgba)>>24))

◆ ODGETBLUE

#define ODGETBLUE ( rgb)
Value:
((OdUInt8)((rgb)>>16))

◆ ODGETGREEN

#define ODGETGREEN ( rgb)
Value:
((OdUInt8)(((OdUInt16)(rgb)) >> 8))

◆ ODGETRED

#define ODGETRED ( rgb)
Value:
((OdUInt8)(rgb))

◆ Odisnan

#define Odisnan ( x)
Value:
std::isnan(x)

◆ OdPrintf

#define OdPrintf   printf

◆ ODRGB

#define ODRGB ( r,
g,
b )
Value:
((ODCOLORREF)(((OdUInt8)(r)|((OdUInt16)((OdUInt8)(g))<<8))|(((OdUInt32)(OdUInt8)(b))<<16)))
#define ODCOLORREF

◆ ODRGBA

#define ODRGBA ( r,
g,
b,
a )
Value:
(((ODCOLORREF)ODRGB(r,g,b))|(((OdUInt32)(OdUInt8)(a))<<24))
#define ODRGB(r, g, b)

◆ odSprintf

#define odSprintf   swprintf

◆ odSprintfA

#define odSprintfA   snprintf

◆ odSScanf

#define odSScanf   swscanf

◆ odStrChr

#define odStrChr ( str,
ch )
Value:
strchr(str, ch)

◆ odStrCmp

#define odStrCmp ( str,
str2 )
Value:
wcscmp(str, str2)

◆ odStrCmpA

#define odStrCmpA ( str,
str2 )
Value:
strcmp(str, str2)

◆ odStrICmp

#define odStrICmp   Od_stricmpW

◆ odStrICmpA

#define odStrICmpA ( str,
str2 )
Value:
stricmp(str, str2)

◆ odStrLen

#define odStrLen ( str)
Value:
wcslen(str)

◆ odStrLenA

#define odStrLenA ( str)
Value:
strlen(str)

◆ odStrLwr

#define odStrLwr ( str)
Value:
Od_strlwrW(str)

◆ odStrLwrA

#define odStrLwrA ( str)
Value:
strlwr(str)

◆ odStrnICmp

#define odStrnICmp   Od_stricmpW

◆ odStrnICmpA

#define odStrnICmpA ( str,
str2,
n )
Value:
strnicmp(str, str2, n)

◆ odStrRev

#define odStrRev ( str)
Value:
Od_strrevW(str)

◆ odStrRevA

#define odStrRevA ( str)
Value:
strrev(str)

◆ odStrStr

#define odStrStr   ::wcsstr

◆ odStrToF

#define odStrToF   Od_wtof

◆ odStrToInt

#define odStrToInt ( str)
Value:
Od_strtoint(str)

◆ odStrToUInt

#define odStrToUInt ( str)
Value:
Od_strtouint(str)

◆ odStrUpr

#define odStrUpr ( str)
Value:
Od_struprW(str)

◆ odStrUprA

#define odStrUprA ( str)
Value:
strupr(str)

◆ odSwap2BytesNumber

#define odSwap2BytesNumber ( n)

◆ odSwap4Bytes

#define odSwap4Bytes ( bytes)

◆ odSwap4BytesNumber

#define odSwap4BytesNumber ( n)

◆ odSwap8Bytes

#define odSwap8Bytes ( bytes)

◆ ODTOCMCOLOR

#define ODTOCMCOLOR ( colorref)
Value:
OdCmEntityColor( ODGETRED(colorref), ODGETGREEN(colorref), ODGETBLUE(colorref) )
#define ODGETBLUE(rgb)
#define ODGETGREEN(rgb)
#define ODGETRED(rgb)

◆ ODTOCOLORREF

#define ODTOCOLORREF ( cmColor)
Value:
ODRGB( cmColor.red(), cmColor.green(), cmColor.blue() )

◆ OdWprintf

#define OdWprintf   wprintf

◆ odWStrChr

#define odWStrChr ( str,
ch )
Value:
Od_wcschr(str, ch)
#define Od_wcschr

◆ OFFSETTYPE

#define OFFSETTYPE ( offset)
Value:
GLintptr offset
Definition gles2_ext.h:183

◆ RGBQUAD_DEFINED

#define RGBQUAD_DEFINED

◆ TD_USING

#define TD_USING ( a)
Value:
using a

Function Documentation

◆ odmax() [1/4]

template<class T>
ODRX_CONSTEXPR const T & odmax ( const T & a,
const T & b )

Definition at line 38 of file OdPlatform.h.

◆ odmax() [2/4]

template<class T, class U, typename std::enable_if< sizeof(T) > = sizeof(U) && std::is_arithmetic<T>::value && std::is_arithmetic<U>::value && std::is_unsigned<T>::value == std::is_unsigned<U>::value, bool, ::type = true>
ODRX_CONSTEXPR T odmax ( T a,
U b )

Definition at line 43 of file OdPlatform.h.

◆ odmax() [3/4]

template<class T, class U, typename std::enable_if<(sizeof(T) > sizeof(U)) &&std::is_arithmetic< T >::value &&std::is_arithmetic< U >::value &&std::is_signed< T >::value &&std::is_unsigned< U >::value, bool >::type = true>
ODRX_CONSTEXPR T odmax ( T a,
U b )

Definition at line 53 of file OdPlatform.h.

◆ odmax() [4/4]

template<class T, class U, typename std::enable_if<(sizeof(T)< sizeof(U))||(sizeof(T)==sizeof(U) &&std::is_signed< T >::value &&std::is_unsigned< U >::value), bool >::type = true>
ODRX_CONSTEXPR U odmax ( T a,
U b )

Definition at line 58 of file OdPlatform.h.

◆ odmin() [1/5]

template<class T>
ODRX_CONSTEXPR const T & odmin ( const T & a,
const T & b )

Definition at line 64 of file OdPlatform.h.

◆ odmin() [2/5]

template<class T, class U, typename std::enable_if< sizeof(T) > = sizeof(U) && std::is_arithmetic<T>::value && std::is_arithmetic<U>::value && std::is_unsigned<T>::value == std::is_unsigned<U>::value, bool, ::type = true>
ODRX_CONSTEXPR T odmin ( T a,
U b )

Definition at line 69 of file OdPlatform.h.

◆ odmin() [3/5]

template<class T, class U, typename std::enable_if< sizeof(T) > = sizeof(U) && std::is_arithmetic<T>::value && std::is_arithmetic<U>::value && std::is_unsigned<T>::value && std::is_signed<U>::value, bool, ::type = true>
ODRX_CONSTEXPR U odmin ( T a,
U b )

Definition at line 74 of file OdPlatform.h.

◆ odmin() [4/5]

template<class T, class U, typename std::enable_if<(sizeof(T) > sizeof(U)) &&std::is_arithmetic< T >::value &&std::is_arithmetic< U >::value &&std::is_signed< T >::value &&std::is_unsigned< U >::value, bool >::type = true>
ODRX_CONSTEXPR T odmin ( T a,
U b )

Definition at line 79 of file OdPlatform.h.

◆ odmin() [5/5]

template<class T, class U>
ODRX_CONSTEXPR T odmin ( T a,
U b )

Definition at line 84 of file OdPlatform.h.