ftypes.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // Project     : SDK Core
00003 // Version     : 1.0
00004 //
00005 // Category    : SDK Core Interfaces
00006 // Filename    : ftypes.h
00007 // Created by  : Steinberg, 01/2004
00008 // Modified    : $Date: 2008/01/10 10:36:29 $
00009 // Description : Basic data types
00010 //
00011 //-----------------------------------------------------------------------------
00012 // LICENSE
00013 // © 2008, Steinberg Media Technologies GmbH, All Rights Reserved
00014 //-----------------------------------------------------------------------------
00015 // This Software Development Kit may not be distributed in parts or its entirety  
00016 // without prior written agreement by Steinberg Media Technologies GmbH. 
00017 // This SDK must not be used to re-engineer or manipulate any technology used  
00018 // in any Steinberg or Third-party application or software module, 
00019 // unless permitted by law.
00020 // Neither the name of the Steinberg Media Technologies nor the names of its
00021 // contributors may be used to endorse or promote products derived from this 
00022 // software without specific prior written permission.
00023 // 
00024 // THIS SDK IS PROVIDED BY STEINBERG MEDIA TECHNOLOGIES GMBH "AS IS" AND
00025 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
00026 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00027 // IN NO EVENT SHALL STEINBERG MEDIA TECHNOLOGIES GMBH BE LIABLE FOR ANY DIRECT, 
00028 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
00029 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00030 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
00031 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00032 // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00033 // OF THE POSSIBILITY OF SUCH DAMAGE.
00034 //------------------------------------------------------------------------------
00035 
00036 #ifndef __ftypes__
00037 #define __ftypes__
00038 
00039 #include "fplatform.h"
00040 
00041 #if MAC
00042         #undef UNICODE
00043         #define UNICODE 0
00044 #endif
00045 
00046 
00047 namespace Steinberg
00048 {
00049 // intergral types
00050 // -----------------------------------------------------------------
00051         typedef char int8;
00052         typedef unsigned char uint8;
00053         typedef unsigned char uchar;
00054 
00055         typedef short int16;
00056         typedef unsigned short uint16;
00057 
00058 #if MAC && __LP64__
00059         typedef int int32;
00060         typedef unsigned int uint32;
00061 #else
00062         typedef long int32;
00063         typedef unsigned long uint32;   
00064 #endif
00065 
00066         static const int32 kMaxLong = 0x7fffffff;
00067         static const int32 kMinLong = (-0x7fffffff - 1);
00068 
00069 #if WINDOWS
00070         typedef __int64 int64;
00071         typedef unsigned __int64 uint64;
00072         static const int64 kMaxInt64 = 9223372036854775807i64;
00073         static const int64 kMinInt64 = (-9223372036854775807i64 - 1);
00074 #else
00075         typedef long long int64;
00076         typedef unsigned long long uint64;
00077         static const int64 kMaxInt64 = 0x7fffffffffffffffLL;
00078         static const int64 kMinInt64 = (-0x7fffffffffffffffLL-1);
00079 #endif
00080 
00081 // -----------------------------------------------------------------
00082 // other Semantic Types         
00083         typedef int64 TSize;   // byte (or other) sizes
00084         typedef int32 tresult; // result code
00085 // -----------------------------------------------------------------
00086         static const float kMaxFloat = 3.40282346638528860e+38;
00087 
00088 #if PLATFORM_64
00089         typedef uint64 TPtrInt;
00090 #else
00091         typedef uint32 TPtrInt;
00092 #endif
00093 
00094 //------------------------------------------------------------------
00095 // boolean
00096         typedef uint8 TBool;
00097 #if MOTIF 
00098         #ifdef NOBOOL
00099                 typedef uint8 bool;
00100                 static const bool false = 0; 
00101                 static const bool true = 1; 
00102         #endif
00103 #endif
00104 
00105 //------------------------------------------------------------------
00106 // strings
00107         #if _MSC_VER
00108         typedef __wchar_t char16;
00109         #else
00110         typedef int16 char16;
00111         #endif
00112 
00113         #if UNICODE
00114                 typedef char16 tchar;
00115         #else
00116                 typedef char tchar;
00117         #endif
00118 
00119         typedef char char8;
00120         typedef const char* FIDString;
00121 }
00122 
00123 // convert byteorder macros
00124 //----------------------------------------------------------------------------
00125 #define SWAP_32(l) { \
00126         unsigned char* p = (unsigned char*)& (l); \
00127         unsigned char t; \
00128         t = p[0]; p[0] = p[3]; p[3] = t; t = p[1]; p[1] = p[2]; p[2] = t; }
00129 
00130 #define SWAP_16(w) { \
00131         unsigned char* p = (unsigned char*)& (w); \
00132         unsigned char t; \
00133         t = p[0]; p[0] = p[1]; p[1] = t; }
00134 
00135 #define SWAP_64(i) { \
00136         unsigned char* p = (unsigned char*)& (i); \
00137         unsigned char t; \
00138         t = p[0]; p[0] = p[7]; p[7] = t; t = p[1]; p[1] = p[6]; p[6] = t; \
00139         t = p[2]; p[2] = p[5]; p[5] = t; t = p[3]; p[3] = p[4]; p[4] = t;}
00140 
00141 #endif
Empty

Copyright ©2008 Steinberg Media Technologies. All Rights Reserved.