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.

355 lines
13KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  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.txt file.
  22. BEGIN_JUCE_MODULE_DECLARATION
  23. ID: juce_core
  24. vendor: juce
  25. version: 5.1.1
  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. dependencies:
  31. OSXFrameworks: Cocoa IOKit
  32. iOSFrameworks: Foundation
  33. linuxLibs: rt dl pthread
  34. linuxPackages: libcurl
  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 Visual C++ 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 0
  110. #endif
  111. /** Config: JUCE_CATCH_UNHANDLED_EXCEPTIONS
  112. If enabled, this will add some exception-catching code to forward unhandled exceptions
  113. to your JUCEApplicationBase::unhandledException() callback.
  114. */
  115. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  116. //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  117. #endif
  118. /** Config: JUCE_ALLOW_STATIC_NULL_VARIABLES
  119. If disabled, this will turn off dangerous static globals like String::empty, var::null, etc
  120. which can cause nasty order-of-initialisation problems if they are referenced during static
  121. constructor code.
  122. */
  123. #ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES
  124. #define JUCE_ALLOW_STATIC_NULL_VARIABLES 1
  125. #endif
  126. #ifndef JUCE_STRING_UTF_TYPE
  127. #define JUCE_STRING_UTF_TYPE 8
  128. #endif
  129. //==============================================================================
  130. //==============================================================================
  131. #if JUCE_CORE_INCLUDE_NATIVE_HEADERS
  132. #include "native/juce_BasicNativeHeaders.h"
  133. #endif
  134. #include "system/juce_StandardHeader.h"
  135. namespace juce
  136. {
  137. class StringRef;
  138. class MemoryBlock;
  139. class File;
  140. class InputStream;
  141. class OutputStream;
  142. class DynamicObject;
  143. class FileInputStream;
  144. class FileOutputStream;
  145. class XmlElement;
  146. extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept;
  147. extern JUCE_API void JUCE_CALLTYPE logAssertion (const char* file, int line) noexcept;
  148. }
  149. #include "memory/juce_Memory.h"
  150. #include "maths/juce_MathsFunctions.h"
  151. #include "memory/juce_ByteOrder.h"
  152. #include "memory/juce_Atomic.h"
  153. #include "text/juce_CharacterFunctions.h"
  154. #if JUCE_MSVC
  155. #pragma warning (push)
  156. #pragma warning (disable: 4514 4996)
  157. #endif
  158. #include "text/juce_CharPointer_UTF8.h"
  159. #include "text/juce_CharPointer_UTF16.h"
  160. #include "text/juce_CharPointer_UTF32.h"
  161. #include "text/juce_CharPointer_ASCII.h"
  162. #if JUCE_MSVC
  163. #pragma warning (pop)
  164. #endif
  165. #include "text/juce_String.h"
  166. #include "text/juce_StringRef.h"
  167. #include "logging/juce_Logger.h"
  168. #include "memory/juce_LeakedObjectDetector.h"
  169. #include "memory/juce_ContainerDeletePolicy.h"
  170. #include "memory/juce_HeapBlock.h"
  171. #include "memory/juce_MemoryBlock.h"
  172. #include "memory/juce_ReferenceCountedObject.h"
  173. #include "memory/juce_ScopedPointer.h"
  174. #include "memory/juce_OptionalScopedPointer.h"
  175. #include "memory/juce_Singleton.h"
  176. #include "memory/juce_WeakReference.h"
  177. #include "threads/juce_ScopedLock.h"
  178. #include "threads/juce_CriticalSection.h"
  179. #include "maths/juce_Range.h"
  180. #include "maths/juce_NormalisableRange.h"
  181. #include "maths/juce_StatisticsAccumulator.h"
  182. #include "containers/juce_ElementComparator.h"
  183. #include "containers/juce_ArrayAllocationBase.h"
  184. #include "containers/juce_Array.h"
  185. #include "containers/juce_LinkedListPointer.h"
  186. #include "containers/juce_ListenerList.h"
  187. #include "containers/juce_OwnedArray.h"
  188. #include "containers/juce_ReferenceCountedArray.h"
  189. #include "containers/juce_ScopedValueSetter.h"
  190. #include "containers/juce_SortedSet.h"
  191. #include "containers/juce_SparseSet.h"
  192. #include "containers/juce_AbstractFifo.h"
  193. #include "text/juce_NewLine.h"
  194. #include "text/juce_StringPool.h"
  195. #include "text/juce_Identifier.h"
  196. #include "text/juce_StringArray.h"
  197. #include "text/juce_StringPairArray.h"
  198. #include "text/juce_TextDiff.h"
  199. #include "text/juce_LocalisedStrings.h"
  200. #include "text/juce_Base64.h"
  201. #include "misc/juce_Result.h"
  202. #include "containers/juce_Variant.h"
  203. #include "containers/juce_NamedValueSet.h"
  204. #include "containers/juce_DynamicObject.h"
  205. #include "containers/juce_HashMap.h"
  206. #include "time/juce_RelativeTime.h"
  207. #include "time/juce_Time.h"
  208. #include "streams/juce_InputStream.h"
  209. #include "streams/juce_OutputStream.h"
  210. #include "streams/juce_BufferedInputStream.h"
  211. #include "streams/juce_MemoryInputStream.h"
  212. #include "streams/juce_MemoryOutputStream.h"
  213. #include "streams/juce_SubregionStream.h"
  214. #include "streams/juce_InputSource.h"
  215. #include "files/juce_File.h"
  216. #include "files/juce_DirectoryIterator.h"
  217. #include "files/juce_FileInputStream.h"
  218. #include "files/juce_FileOutputStream.h"
  219. #include "files/juce_FileSearchPath.h"
  220. #include "files/juce_MemoryMappedFile.h"
  221. #include "files/juce_TemporaryFile.h"
  222. #include "files/juce_FileFilter.h"
  223. #include "files/juce_WildcardFileFilter.h"
  224. #include "streams/juce_FileInputSource.h"
  225. #include "logging/juce_FileLogger.h"
  226. #include "javascript/juce_JSON.h"
  227. #include "javascript/juce_Javascript.h"
  228. #include "maths/juce_BigInteger.h"
  229. #include "maths/juce_Expression.h"
  230. #include "maths/juce_Random.h"
  231. #include "misc/juce_RuntimePermissions.h"
  232. #include "misc/juce_Uuid.h"
  233. #include "misc/juce_WindowsRegistry.h"
  234. #include "threads/juce_ChildProcess.h"
  235. #include "threads/juce_DynamicLibrary.h"
  236. #include "threads/juce_HighResolutionTimer.h"
  237. #include "threads/juce_InterProcessLock.h"
  238. #include "threads/juce_Process.h"
  239. #include "threads/juce_SpinLock.h"
  240. #include "threads/juce_WaitableEvent.h"
  241. #include "threads/juce_Thread.h"
  242. #include "threads/juce_ThreadLocalValue.h"
  243. #include "threads/juce_ThreadPool.h"
  244. #include "threads/juce_TimeSliceThread.h"
  245. #include "threads/juce_ReadWriteLock.h"
  246. #include "threads/juce_ScopedReadLock.h"
  247. #include "threads/juce_ScopedWriteLock.h"
  248. #include "network/juce_IPAddress.h"
  249. #include "network/juce_MACAddress.h"
  250. #include "network/juce_NamedPipe.h"
  251. #include "network/juce_Socket.h"
  252. #include "network/juce_URL.h"
  253. #include "network/juce_WebInputStream.h"
  254. #include "system/juce_SystemStats.h"
  255. #include "time/juce_PerformanceCounter.h"
  256. #include "unit_tests/juce_UnitTest.h"
  257. #include "xml/juce_XmlDocument.h"
  258. #include "xml/juce_XmlElement.h"
  259. #include "zip/juce_GZIPCompressorOutputStream.h"
  260. #include "zip/juce_GZIPDecompressorInputStream.h"
  261. #include "zip/juce_ZipFile.h"
  262. #include "containers/juce_PropertySet.h"
  263. #include "memory/juce_SharedResourcePointer.h"
  264. #if JUCE_CORE_INCLUDE_OBJC_HELPERS && (JUCE_MAC || JUCE_IOS)
  265. #include "native/juce_osx_ObjCHelpers.h"
  266. #endif
  267. #if JUCE_CORE_INCLUDE_COM_SMART_PTR && JUCE_WINDOWS
  268. #include "native/juce_win32_ComSmartPtr.h"
  269. #endif
  270. #if JUCE_CORE_INCLUDE_JNI_HELPERS && JUCE_ANDROID
  271. #include "native/juce_android_JNIHelpers.h"
  272. #endif
  273. #ifndef DOXYGEN
  274. namespace juce
  275. {
  276. /*
  277. As the very long class names here try to explain, the purpose of this code is to cause
  278. a linker error if not all of your compile units are consistent in the options that they
  279. enable before including JUCE headers. The reason this is important is that if you have
  280. two cpp files, and one includes the juce headers with debug enabled, and another does so
  281. without that, then each will be generating code with different class layouts, and you'll
  282. get subtle and hard-to-track-down memory corruption!
  283. */
  284. #if JUCE_DEBUG
  285. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode
  286. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode() noexcept; };
  287. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode compileUnitMismatchSentinel;
  288. #else
  289. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode
  290. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode() noexcept; };
  291. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode compileUnitMismatchSentinel;
  292. #endif
  293. }
  294. #endif
  295. #if JUCE_MSVC
  296. #pragma warning (pop)
  297. // In DLL builds, need to disable this warnings for other modules
  298. #if defined (JUCE_DLL_BUILD) || defined (JUCE_DLL)
  299. #pragma warning (disable: 4251)
  300. #endif
  301. #endif