JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
ftypes.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2// Project : SDK Core
3//
4// Category : SDK Core Interfaces
5// Filename : pluginterfaces/base/ftypes.h
6// Created by : Steinberg, 01/2004
7// Description : Basic data types
8//
9//-----------------------------------------------------------------------------
10// This file is part of a Steinberg SDK. It is subject to the license terms
11// in the LICENSE file found in the top-level directory of this distribution
12// and at www.steinberg.net/sdklicenses.
13// No part of the SDK, including this file, may be copied, modified, propagated,
14// or distributed except according to the terms contained in the LICENSE file.
15//-----------------------------------------------------------------------------
16
17#pragma once
18
19#include "fplatform.h"
20
21#include <cstdint>
22
23//#define UNICODE_OFF // disable / enable unicode
24
25#ifdef UNICODE_OFF
26 #ifdef UNICODE
27 #undef UNICODE
28 #endif
29#else
30 #define UNICODE 1
31#endif
32
33#ifdef UNICODE
34#define _UNICODE 1
35#endif
36
37namespace Steinberg
38{
39//-----------------------------------------------------------------
40// Integral Types
41 typedef char int8;
42 typedef uint8_t uint8;
43 typedef unsigned char uchar;
44
45 typedef int16_t int16;
46 typedef uint16_t uint16;
47
48 typedef int32_t int32;
49 typedef uint32_t uint32;
50
51 static const int32 kMaxInt32 = INT32_MAX;
52 static const int32 kMinInt32 = INT32_MIN;
53 static const int32 kMaxLong = kMaxInt32;
54 static const int32 kMinLong = kMinInt32;
55 static const uint32 kMaxInt32u = UINT32_MAX;
56
57 typedef int64_t int64;
58 typedef uint64_t uint64;
59 static const int64 kMaxInt64 = INT64_MAX;
60 static const int64 kMinInt64 = INT64_MIN;
61 static const uint64 kMaxInt64u = UINT64_MAX;
62
63//-----------------------------------------------------------------
64// other Semantic Types
65 typedef int64 TSize; // byte (or other) sizes
66 typedef int32 tresult; // result code
67//-----------------------------------------------------------------
68 static const float kMaxFloat = 3.40282346638528860E38;
69 static const double kMaxDouble = 1.7976931348623158E308;
70
71#if SMTG_PLATFORM_64
72 typedef uint64 TPtrInt;
73#else
74 typedef uint32 TPtrInt;
75#endif
76
77//------------------------------------------------------------------
78// Boolean
79 typedef uint8 TBool;
80
81//------------------------------------------------------------------
82// Char / Strings
83 typedef char char8;
84 typedef char16_t char16;
85
86#ifdef UNICODE
87 typedef char16 tchar;
88#else
89 typedef char8 tchar;
90#endif
91
92 typedef const char8* CStringA;
93 typedef const char16* CStringW;
94 typedef const tchar* CString;
95 inline bool strEmpty (const tchar* str) { return (!str || *str == 0); }
96 inline bool str8Empty (const char8* str) { return (!str || *str == 0); }
97 inline bool str16Empty (const char16* str) { return (!str || *str == 0); }
98
99 typedef const char8* FIDString; // identifier as string (used for attributes, messages)
100
101 const FIDString kPlatformStringWin = "WIN";
102 const FIDString kPlatformStringMac = "MAC";
103 const FIDString kPlatformStringIOS = "IOS";
104 const FIDString kPlatformStringLinux = "Linux";
105#if SMTG_OS_WINDOWS
106 const FIDString kPlatformString = kPlatformStringWin;
107#elif SMTG_OS_IOS
108 const FIDString kPlatformString = kPlatformStringIOS;
109#elif SMTG_OS_MACOS
110 const FIDString kPlatformString = kPlatformStringMac;
111#elif SMTG_OS_LINUX
112 const FIDString kPlatformString = kPlatformStringLinux;
113#endif
114
115//------------------------------------------------------------------------
117 typedef int32 UCoord;
118 static const UCoord kMaxCoord = ((UCoord)0x7FFFFFFF);
119 static const UCoord kMinCoord = ((UCoord)-0x7FFFFFFF);
120} // namespace Steinberg
121
122
123//----------------------------------------------------------------------------
126#define SWAP_32(l) { \
127 unsigned char* p = (unsigned char*)& (l); \
128 unsigned char t; \
129 t = p[0]; p[0] = p[3]; p[3] = t; t = p[1]; p[1] = p[2]; p[2] = t; }
130
131#define SWAP_16(w) { \
132 unsigned char* p = (unsigned char*)& (w); \
133 unsigned char t; \
134 t = p[0]; p[0] = p[1]; p[1] = t; }
135
136#define SWAP_64(i) { \
137 unsigned char* p = (unsigned char*)& (i); \
138 unsigned char t; \
139 t = p[0]; p[0] = p[7]; p[7] = t; t = p[1]; p[1] = p[6]; p[6] = t; \
140 t = p[2]; p[2] = p[5]; p[5] = t; t = p[3]; p[3] = p[4]; p[4] = t;}
141
142namespace Steinberg
143{
144 static inline void FSwap (int8&) {}
145 static inline void FSwap (uint8&) {}
146 static inline void FSwap (int16& i16) { SWAP_16 (i16) }
147 static inline void FSwap (uint16& i16) { SWAP_16 (i16) }
148 static inline void FSwap (int32& i32) { SWAP_32 (i32) }
149 static inline void FSwap (uint32& i32) { SWAP_32 (i32) }
150 static inline void FSwap (int64& i64) { SWAP_64 (i64) }
151 static inline void FSwap (uint64& i64) { SWAP_64 (i64) }
152}
153
154// always inline macros (only when RELEASE is 1)
155//----------------------------------------------------------------------------
156#if RELEASE
157 #if SMTG_OS_MACOS || SMTG_OS_LINUX || defined(__MINGW32__)
158 #define SMTG_ALWAYS_INLINE __inline__ __attribute__((__always_inline__))
159 #define SMTG_NEVER_INLINE __attribute__((noinline))
160 #elif SMTG_OS_WINDOWS
161 #define SMTG_ALWAYS_INLINE __forceinline
162 #define SMTG_NEVER_INLINE __declspec(noinline)
163 #endif
164#endif
165
166#ifndef SMTG_ALWAYS_INLINE
167 #define SMTG_ALWAYS_INLINE inline
168#endif
169#ifndef SMTG_NEVER_INLINE
170 #define SMTG_NEVER_INLINE
171#endif
172
173#ifndef SMTG_CPP11_STDLIBSUPPORT
174// Enable this for old compilers
175// #define nullptr NULL
176#endif
int32 UCoord
Coordinates.
Definition ftypes.h:117
#define SWAP_32(l)
Byte-order Conversion Macros.
Definition ftypes.h:126
typedef uint8_t