The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

404 lines
15KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. /*******************************************************************************
  18. The block below describes the properties of this module, and is read by
  19. the Projucer to automatically generate project code that uses it.
  20. For details about the syntax and how to create or use a module, see the
  21. JUCE Module Format.md file.
  22. BEGIN_JUCE_MODULE_DECLARATION
  23. ID: juce_core
  24. vendor: juce
  25. version: 7.0.9
  26. name: JUCE core classes
  27. description: The essential set of basic JUCE classes, as required by all the other JUCE modules. Includes text, container, memory, threading and i/o functionality.
  28. website: http://www.juce.com/juce
  29. license: ISC
  30. minimumCppStandard: 17
  31. dependencies:
  32. OSXFrameworks: Cocoa Foundation IOKit Security
  33. iOSFrameworks: Foundation
  34. linuxLibs: rt dl pthread
  35. mingwLibs: uuid wsock32 wininet version ole32 ws2_32 oleaut32 imm32 comdlg32 shlwapi rpcrt4 winmm
  36. END_JUCE_MODULE_DECLARATION
  37. *******************************************************************************/
  38. #pragma once
  39. #define JUCE_CORE_H_INCLUDED
  40. //==============================================================================
  41. #ifdef _MSC_VER
  42. #pragma warning (push)
  43. // Disable warnings for long class names, padding, and undefined preprocessor definitions.
  44. #pragma warning (disable: 4251 4786 4668 4820)
  45. #ifdef __INTEL_COMPILER
  46. #pragma warning (disable: 1125)
  47. #endif
  48. #endif
  49. #include "system/juce_TargetPlatform.h"
  50. //==============================================================================
  51. /** Config: JUCE_FORCE_DEBUG
  52. Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and project settings,
  53. but if you define this value, you can override this to force it to be true or false.
  54. */
  55. #ifndef JUCE_FORCE_DEBUG
  56. //#define JUCE_FORCE_DEBUG 0
  57. #endif
  58. //==============================================================================
  59. /** Config: JUCE_LOG_ASSERTIONS
  60. If this flag is enabled, the jassert and jassertfalse macros will always use Logger::writeToLog()
  61. to write a message when an assertion happens.
  62. Enabling it will also leave this turned on in release builds. When it's disabled,
  63. however, the jassert and jassertfalse macros will not be compiled in a
  64. release build.
  65. @see jassert, jassertfalse, Logger
  66. */
  67. #ifndef JUCE_LOG_ASSERTIONS
  68. #if JUCE_ANDROID
  69. #define JUCE_LOG_ASSERTIONS 1
  70. #else
  71. #define JUCE_LOG_ASSERTIONS 0
  72. #endif
  73. #endif
  74. //==============================================================================
  75. /** Config: JUCE_CHECK_MEMORY_LEAKS
  76. Enables a memory-leak check for certain objects when the app terminates. See the LeakedObjectDetector
  77. class and the JUCE_LEAK_DETECTOR macro for more details about enabling leak checking for specific classes.
  78. */
  79. #if JUCE_DEBUG && ! defined (JUCE_CHECK_MEMORY_LEAKS)
  80. #define JUCE_CHECK_MEMORY_LEAKS 1
  81. #endif
  82. //==============================================================================
  83. /** Config: JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  84. In a Windows build, this can be used to stop the required system libs being
  85. automatically added to the link stage.
  86. */
  87. #ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  88. #define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0
  89. #endif
  90. /** Config: JUCE_INCLUDE_ZLIB_CODE
  91. This can be used to disable Juce's embedded 3rd-party zlib code.
  92. You might need to tweak this if you're linking to an external zlib library in your app,
  93. but for normal apps, this option should be left alone.
  94. If you disable this, you might also want to set a value for JUCE_ZLIB_INCLUDE_PATH, to
  95. specify the path where your zlib headers live.
  96. */
  97. #ifndef JUCE_INCLUDE_ZLIB_CODE
  98. #define JUCE_INCLUDE_ZLIB_CODE 1
  99. #endif
  100. #ifndef JUCE_ZLIB_INCLUDE_PATH
  101. #define JUCE_ZLIB_INCLUDE_PATH <zlib.h>
  102. #endif
  103. /** Config: JUCE_USE_CURL
  104. Enables http/https support via libcurl (Linux only). Enabling this will add an additional
  105. run-time dynamic dependency to libcurl.
  106. If you disable this then https/ssl support will not be available on Linux.
  107. */
  108. #ifndef JUCE_USE_CURL
  109. #define JUCE_USE_CURL 1
  110. #endif
  111. /** Config: JUCE_LOAD_CURL_SYMBOLS_LAZILY
  112. If enabled, JUCE will load libcurl lazily when required (for example, when WebInputStream
  113. is used). Enabling this flag may also help with library dependency errors as linking
  114. libcurl at compile-time may instruct the linker to hard depend on a specific version
  115. of libcurl. It's also useful if you want to limit the amount of JUCE dependencies and
  116. you are not using WebInputStream or the URL classes.
  117. */
  118. #ifndef JUCE_LOAD_CURL_SYMBOLS_LAZILY
  119. #define JUCE_LOAD_CURL_SYMBOLS_LAZILY 0
  120. #endif
  121. /** Config: JUCE_CATCH_UNHANDLED_EXCEPTIONS
  122. If enabled, this will add some exception-catching code to forward unhandled exceptions
  123. to your JUCEApplicationBase::unhandledException() callback.
  124. */
  125. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  126. #define JUCE_CATCH_UNHANDLED_EXCEPTIONS 0
  127. #endif
  128. /** Config: JUCE_ALLOW_STATIC_NULL_VARIABLES
  129. If disabled, this will turn off dangerous static globals like String::empty, var::null, etc
  130. which can cause nasty order-of-initialisation problems if they are referenced during static
  131. constructor code.
  132. */
  133. #ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES
  134. #define JUCE_ALLOW_STATIC_NULL_VARIABLES 0
  135. #endif
  136. /** Config: JUCE_STRICT_REFCOUNTEDPOINTER
  137. If enabled, this will make the ReferenceCountedObjectPtr class stricter about allowing
  138. itself to be cast directly to a raw pointer. By default this is disabled, for compatibility
  139. with old code, but if possible, you should always enable it to improve code safety!
  140. */
  141. #ifndef JUCE_STRICT_REFCOUNTEDPOINTER
  142. #define JUCE_STRICT_REFCOUNTEDPOINTER 0
  143. #endif
  144. /** Config: JUCE_ENABLE_ALLOCATION_HOOKS
  145. If enabled, this will add global allocation functions with built-in assertions, which may
  146. help when debugging allocations in unit tests.
  147. */
  148. #ifndef JUCE_ENABLE_ALLOCATION_HOOKS
  149. #define JUCE_ENABLE_ALLOCATION_HOOKS 0
  150. #endif
  151. #ifndef JUCE_STRING_UTF_TYPE
  152. #define JUCE_STRING_UTF_TYPE 8
  153. #endif
  154. //==============================================================================
  155. //==============================================================================
  156. #if JUCE_CORE_INCLUDE_NATIVE_HEADERS
  157. #include "native/juce_BasicNativeHeaders.h"
  158. #endif
  159. #if JUCE_WINDOWS
  160. #undef small
  161. #endif
  162. #include "system/juce_StandardHeader.h"
  163. namespace juce
  164. {
  165. class StringRef;
  166. class MemoryBlock;
  167. class File;
  168. class InputStream;
  169. class OutputStream;
  170. class DynamicObject;
  171. class FileInputStream;
  172. class FileOutputStream;
  173. class XmlElement;
  174. extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept;
  175. extern JUCE_API void JUCE_CALLTYPE logAssertion (const char* file, int line) noexcept;
  176. }
  177. #include "misc/juce_EnumHelpers.h"
  178. #include "memory/juce_Memory.h"
  179. #include "maths/juce_MathsFunctions.h"
  180. #include "memory/juce_ByteOrder.h"
  181. #include "memory/juce_Atomic.h"
  182. #include "text/juce_CharacterFunctions.h"
  183. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4996)
  184. #include "text/juce_CharPointer_UTF8.h"
  185. #include "text/juce_CharPointer_UTF16.h"
  186. #include "text/juce_CharPointer_UTF32.h"
  187. #include "text/juce_CharPointer_ASCII.h"
  188. JUCE_END_IGNORE_WARNINGS_MSVC
  189. #include "text/juce_String.h"
  190. #include "text/juce_StringRef.h"
  191. #include "logging/juce_Logger.h"
  192. #include "memory/juce_LeakedObjectDetector.h"
  193. #include "memory/juce_ContainerDeletePolicy.h"
  194. #include "memory/juce_HeapBlock.h"
  195. #include "memory/juce_MemoryBlock.h"
  196. #include "memory/juce_ReferenceCountedObject.h"
  197. #include "memory/juce_ScopedPointer.h"
  198. #include "memory/juce_OptionalScopedPointer.h"
  199. #include "containers/juce_Optional.h"
  200. #include "containers/juce_Enumerate.h"
  201. #include "containers/juce_ScopedValueSetter.h"
  202. #include "memory/juce_Singleton.h"
  203. #include "memory/juce_WeakReference.h"
  204. #include "threads/juce_ScopedLock.h"
  205. #include "threads/juce_CriticalSection.h"
  206. #include "maths/juce_Range.h"
  207. #include "maths/juce_NormalisableRange.h"
  208. #include "maths/juce_StatisticsAccumulator.h"
  209. #include "containers/juce_ElementComparator.h"
  210. #include "containers/juce_ArrayAllocationBase.h"
  211. #include "containers/juce_ArrayBase.h"
  212. #include "containers/juce_Array.h"
  213. #include "containers/juce_LinkedListPointer.h"
  214. #include "misc/juce_ScopeGuard.h"
  215. #include "containers/juce_ListenerList.h"
  216. #include "containers/juce_OwnedArray.h"
  217. #include "containers/juce_ReferenceCountedArray.h"
  218. #include "containers/juce_SortedSet.h"
  219. #include "containers/juce_SparseSet.h"
  220. #include "containers/juce_AbstractFifo.h"
  221. #include "containers/juce_SingleThreadedAbstractFifo.h"
  222. #include "text/juce_NewLine.h"
  223. #include "text/juce_StringPool.h"
  224. #include "text/juce_Identifier.h"
  225. #include "text/juce_StringArray.h"
  226. #include "system/juce_SystemStats.h"
  227. #include "memory/juce_HeavyweightLeakedObjectDetector.h"
  228. #include "text/juce_StringPairArray.h"
  229. #include "text/juce_TextDiff.h"
  230. #include "text/juce_LocalisedStrings.h"
  231. #include "text/juce_Base64.h"
  232. #include "misc/juce_Functional.h"
  233. #include "containers/juce_Span.h"
  234. #include "misc/juce_Result.h"
  235. #include "misc/juce_Uuid.h"
  236. #include "misc/juce_ConsoleApplication.h"
  237. #include "containers/juce_Variant.h"
  238. #include "containers/juce_NamedValueSet.h"
  239. #include "javascript/juce_JSON.h"
  240. #include "containers/juce_DynamicObject.h"
  241. #include "containers/juce_HashMap.h"
  242. #include "containers/juce_FixedSizeFunction.h"
  243. #include "time/juce_RelativeTime.h"
  244. #include "time/juce_Time.h"
  245. #include "streams/juce_InputStream.h"
  246. #include "streams/juce_OutputStream.h"
  247. #include "streams/juce_BufferedInputStream.h"
  248. #include "streams/juce_MemoryInputStream.h"
  249. #include "streams/juce_MemoryOutputStream.h"
  250. #include "streams/juce_SubregionStream.h"
  251. #include "streams/juce_InputSource.h"
  252. #include "files/juce_File.h"
  253. #include "files/juce_DirectoryIterator.h"
  254. #include "files/juce_RangedDirectoryIterator.h"
  255. #include "files/juce_FileInputStream.h"
  256. #include "files/juce_FileOutputStream.h"
  257. #include "files/juce_FileSearchPath.h"
  258. #include "files/juce_MemoryMappedFile.h"
  259. #include "files/juce_TemporaryFile.h"
  260. #include "files/juce_FileFilter.h"
  261. #include "files/juce_WildcardFileFilter.h"
  262. #include "streams/juce_FileInputSource.h"
  263. #include "logging/juce_FileLogger.h"
  264. #include "javascript/juce_JSONUtils.h"
  265. #include "serialisation/juce_Serialisation.h"
  266. #include "javascript/juce_JSONSerialisation.h"
  267. #include "javascript/juce_Javascript.h"
  268. #include "maths/juce_BigInteger.h"
  269. #include "maths/juce_Expression.h"
  270. #include "maths/juce_Random.h"
  271. #include "misc/juce_RuntimePermissions.h"
  272. #include "misc/juce_WindowsRegistry.h"
  273. #include "threads/juce_ChildProcess.h"
  274. #include "threads/juce_DynamicLibrary.h"
  275. #include "threads/juce_InterProcessLock.h"
  276. #include "threads/juce_Process.h"
  277. #include "threads/juce_SpinLock.h"
  278. #include "threads/juce_WaitableEvent.h"
  279. #include "threads/juce_Thread.h"
  280. #include "threads/juce_HighResolutionTimer.h"
  281. #include "threads/juce_ThreadLocalValue.h"
  282. #include "threads/juce_ThreadPool.h"
  283. #include "threads/juce_TimeSliceThread.h"
  284. #include "threads/juce_ReadWriteLock.h"
  285. #include "threads/juce_ScopedReadLock.h"
  286. #include "threads/juce_ScopedWriteLock.h"
  287. #include "network/juce_IPAddress.h"
  288. #include "network/juce_MACAddress.h"
  289. #include "network/juce_NamedPipe.h"
  290. #include "network/juce_Socket.h"
  291. #include "network/juce_URL.h"
  292. #include "network/juce_WebInputStream.h"
  293. #include "streams/juce_URLInputSource.h"
  294. #include "time/juce_PerformanceCounter.h"
  295. #include "unit_tests/juce_UnitTest.h"
  296. #include "xml/juce_XmlDocument.h"
  297. #include "xml/juce_XmlElement.h"
  298. #include "zip/juce_GZIPCompressorOutputStream.h"
  299. #include "zip/juce_GZIPDecompressorInputStream.h"
  300. #include "zip/juce_ZipFile.h"
  301. #include "containers/juce_PropertySet.h"
  302. #include "memory/juce_SharedResourcePointer.h"
  303. #include "memory/juce_AllocationHooks.h"
  304. #include "memory/juce_Reservoir.h"
  305. #include "files/juce_AndroidDocument.h"
  306. #include "streams/juce_AndroidDocumentInputSource.h"
  307. #if JUCE_CORE_INCLUDE_OBJC_HELPERS && (JUCE_MAC || JUCE_IOS)
  308. #include "native/juce_CFHelpers_mac.h"
  309. #include "native/juce_ObjCHelpers_mac.h"
  310. #endif
  311. #if JUCE_CORE_INCLUDE_COM_SMART_PTR && JUCE_WINDOWS
  312. #include "native/juce_ComSmartPtr_windows.h"
  313. #endif
  314. #if JUCE_CORE_INCLUDE_JNI_HELPERS && JUCE_ANDROID
  315. #include <jni.h>
  316. #include "native/juce_JNIHelpers_android.h"
  317. #endif
  318. #if JUCE_UNIT_TESTS
  319. #include "unit_tests/juce_UnitTestCategories.h"
  320. #endif
  321. #ifndef DOXYGEN
  322. namespace juce
  323. {
  324. /*
  325. As the very long class names here try to explain, the purpose of this code is to cause
  326. a linker error if not all of your compile units are consistent in the options that they
  327. enable before including JUCE headers. The reason this is important is that if you have
  328. two cpp files, and one includes the juce headers with debug enabled, and another does so
  329. without that, then each will be generating code with different class layouts, and you'll
  330. get subtle and hard-to-track-down memory corruption!
  331. */
  332. #if JUCE_DEBUG
  333. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode
  334. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode() noexcept; };
  335. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode compileUnitMismatchSentinel;
  336. #else
  337. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode
  338. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode() noexcept; };
  339. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode compileUnitMismatchSentinel;
  340. #endif
  341. }
  342. #endif
  343. JUCE_END_IGNORE_WARNINGS_MSVC
  344. // In DLL builds, need to disable this warnings for other modules
  345. #if defined (JUCE_DLL_BUILD) || defined (JUCE_DLL)
  346. JUCE_IGNORE_MSVC (4251)
  347. #endif