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.

363 lines
13KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. /*******************************************************************************
  24. The block below describes the properties of this module, and is read by
  25. the Projucer to automatically generate project code that uses it.
  26. For details about the syntax and how to create or use a module, see the
  27. JUCE Module Format.txt file.
  28. BEGIN_JUCE_MODULE_DECLARATION
  29. ID: juce_core
  30. vendor: juce
  31. version: 4.3.1
  32. name: JUCE core classes
  33. 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.
  34. website: http://www.juce.com/juce
  35. license: ISC
  36. dependencies:
  37. OSXFrameworks: Cocoa IOKit
  38. iOSFrameworks: Foundation
  39. linuxLibs: rt dl pthread
  40. linuxPackages: libcurl
  41. mingwLibs: uuid wsock32 wininet version ole32 ws2_32 oleaut32 imm32 comdlg32 shlwapi rpcrt4 winmm
  42. END_JUCE_MODULE_DECLARATION
  43. *******************************************************************************/
  44. #pragma once
  45. //==============================================================================
  46. #ifdef _MSC_VER
  47. #pragma warning (push)
  48. // Disable warnings for long class names, padding, and undefined preprocessor definitions.
  49. #pragma warning (disable: 4251 4786 4668 4820)
  50. #ifdef __INTEL_COMPILER
  51. #pragma warning (disable: 1125)
  52. #endif
  53. #endif
  54. #include "system/juce_TargetPlatform.h"
  55. //==============================================================================
  56. /** Config: JUCE_FORCE_DEBUG
  57. Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and project settings,
  58. but if you define this value, you can override this to force it to be true or false.
  59. */
  60. #ifndef JUCE_FORCE_DEBUG
  61. //#define JUCE_FORCE_DEBUG 0
  62. #endif
  63. //==============================================================================
  64. /** Config: JUCE_LOG_ASSERTIONS
  65. If this flag is enabled, the jassert and jassertfalse macros will always use Logger::writeToLog()
  66. to write a message when an assertion happens.
  67. Enabling it will also leave this turned on in release builds. When it's disabled,
  68. however, the jassert and jassertfalse macros will not be compiled in a
  69. release build.
  70. @see jassert, jassertfalse, Logger
  71. */
  72. #ifndef JUCE_LOG_ASSERTIONS
  73. #if JUCE_ANDROID
  74. #define JUCE_LOG_ASSERTIONS 1
  75. #else
  76. #define JUCE_LOG_ASSERTIONS 0
  77. #endif
  78. #endif
  79. //==============================================================================
  80. /** Config: JUCE_CHECK_MEMORY_LEAKS
  81. Enables a memory-leak check for certain objects when the app terminates. See the LeakedObjectDetector
  82. class and the JUCE_LEAK_DETECTOR macro for more details about enabling leak checking for specific classes.
  83. */
  84. #if JUCE_DEBUG && ! defined (JUCE_CHECK_MEMORY_LEAKS)
  85. #define JUCE_CHECK_MEMORY_LEAKS 1
  86. #endif
  87. //==============================================================================
  88. /** Config: JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  89. In a Visual C++ build, this can be used to stop the required system libs being
  90. automatically added to the link stage.
  91. */
  92. #ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  93. #define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0
  94. #endif
  95. /** Config: JUCE_INCLUDE_ZLIB_CODE
  96. This can be used to disable Juce's embedded 3rd-party zlib code.
  97. You might need to tweak this if you're linking to an external zlib library in your app,
  98. but for normal apps, this option should be left alone.
  99. If you disable this, you might also want to set a value for JUCE_ZLIB_INCLUDE_PATH, to
  100. specify the path where your zlib headers live.
  101. */
  102. #ifndef JUCE_INCLUDE_ZLIB_CODE
  103. #define JUCE_INCLUDE_ZLIB_CODE 1
  104. #endif
  105. #ifndef JUCE_ZLIB_INCLUDE_PATH
  106. #define JUCE_ZLIB_INCLUDE_PATH <zlib.h>
  107. #endif
  108. /** Config: JUCE_USE_CURL
  109. Enables http/https support via libcurl (Linux only). Enabling this will add an additional
  110. run-time dynamic dependency to libcurl.
  111. If you disable this then https/ssl support will not be available on linux.
  112. */
  113. #ifndef JUCE_USE_CURL
  114. #define JUCE_USE_CURL 0
  115. #endif
  116. /** Config: JUCE_CATCH_UNHANDLED_EXCEPTIONS
  117. If enabled, this will add some exception-catching code to forward unhandled exceptions
  118. to your JUCEApplicationBase::unhandledException() callback.
  119. */
  120. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  121. //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  122. #endif
  123. /** Config: JUCE_ALLOW_STATIC_NULL_VARIABLES
  124. If disabled, this will turn off dangerous static globals like String::empty, var::null, etc
  125. which can cause nasty order-of-initialisation problems if they are referenced during static
  126. constructor code.
  127. */
  128. #ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES
  129. #define JUCE_ALLOW_STATIC_NULL_VARIABLES 1
  130. #endif
  131. #ifndef JUCE_STRING_UTF_TYPE
  132. #define JUCE_STRING_UTF_TYPE 8
  133. #endif
  134. //==============================================================================
  135. //==============================================================================
  136. #if JUCE_CORE_INCLUDE_NATIVE_HEADERS
  137. #include "native/juce_BasicNativeHeaders.h"
  138. #endif
  139. #include "system/juce_StandardHeader.h"
  140. namespace juce
  141. {
  142. class StringRef;
  143. class MemoryBlock;
  144. class File;
  145. class InputStream;
  146. class OutputStream;
  147. class DynamicObject;
  148. class FileInputStream;
  149. class FileOutputStream;
  150. class XmlElement;
  151. class JSONFormatter;
  152. extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept;
  153. extern JUCE_API void JUCE_CALLTYPE logAssertion (const char* file, int line) noexcept;
  154. #include "memory/juce_Memory.h"
  155. #include "maths/juce_MathsFunctions.h"
  156. #include "memory/juce_ByteOrder.h"
  157. #include "memory/juce_Atomic.h"
  158. #include "text/juce_CharacterFunctions.h"
  159. #if JUCE_MSVC
  160. #pragma warning (push)
  161. #pragma warning (disable: 4514 4996)
  162. #endif
  163. #include "text/juce_CharPointer_UTF8.h"
  164. #include "text/juce_CharPointer_UTF16.h"
  165. #include "text/juce_CharPointer_UTF32.h"
  166. #include "text/juce_CharPointer_ASCII.h"
  167. #if JUCE_MSVC
  168. #pragma warning (pop)
  169. #endif
  170. #include "text/juce_String.h"
  171. #include "text/juce_StringRef.h"
  172. #include "logging/juce_Logger.h"
  173. #include "memory/juce_LeakedObjectDetector.h"
  174. #include "memory/juce_ContainerDeletePolicy.h"
  175. #include "memory/juce_HeapBlock.h"
  176. #include "memory/juce_MemoryBlock.h"
  177. #include "memory/juce_ReferenceCountedObject.h"
  178. #include "memory/juce_ScopedPointer.h"
  179. #include "memory/juce_OptionalScopedPointer.h"
  180. #include "memory/juce_Singleton.h"
  181. #include "memory/juce_WeakReference.h"
  182. #include "threads/juce_ScopedLock.h"
  183. #include "threads/juce_CriticalSection.h"
  184. #include "maths/juce_Range.h"
  185. #include "maths/juce_NormalisableRange.h"
  186. #include "maths/juce_StatisticsAccumulator.h"
  187. #include "containers/juce_ElementComparator.h"
  188. #include "containers/juce_ArrayAllocationBase.h"
  189. #include "containers/juce_Array.h"
  190. #include "containers/juce_LinkedListPointer.h"
  191. #include "containers/juce_ListenerList.h"
  192. #include "containers/juce_OwnedArray.h"
  193. #include "containers/juce_ReferenceCountedArray.h"
  194. #include "containers/juce_ScopedValueSetter.h"
  195. #include "containers/juce_SortedSet.h"
  196. #include "containers/juce_SparseSet.h"
  197. #include "containers/juce_AbstractFifo.h"
  198. #include "text/juce_NewLine.h"
  199. #include "text/juce_StringPool.h"
  200. #include "text/juce_Identifier.h"
  201. #include "text/juce_StringArray.h"
  202. #include "text/juce_StringPairArray.h"
  203. #include "text/juce_TextDiff.h"
  204. #include "text/juce_LocalisedStrings.h"
  205. #include "text/juce_Base64.h"
  206. #include "misc/juce_Result.h"
  207. #include "containers/juce_Variant.h"
  208. #include "containers/juce_NamedValueSet.h"
  209. #include "containers/juce_DynamicObject.h"
  210. #include "containers/juce_HashMap.h"
  211. #include "time/juce_RelativeTime.h"
  212. #include "time/juce_Time.h"
  213. #include "streams/juce_InputStream.h"
  214. #include "streams/juce_OutputStream.h"
  215. #include "streams/juce_BufferedInputStream.h"
  216. #include "streams/juce_MemoryInputStream.h"
  217. #include "streams/juce_MemoryOutputStream.h"
  218. #include "streams/juce_SubregionStream.h"
  219. #include "streams/juce_InputSource.h"
  220. #include "files/juce_File.h"
  221. #include "files/juce_DirectoryIterator.h"
  222. #include "files/juce_FileInputStream.h"
  223. #include "files/juce_FileOutputStream.h"
  224. #include "files/juce_FileSearchPath.h"
  225. #include "files/juce_MemoryMappedFile.h"
  226. #include "files/juce_TemporaryFile.h"
  227. #include "files/juce_FileFilter.h"
  228. #include "files/juce_WildcardFileFilter.h"
  229. #include "streams/juce_FileInputSource.h"
  230. #include "logging/juce_FileLogger.h"
  231. #include "javascript/juce_JSON.h"
  232. #include "javascript/juce_Javascript.h"
  233. #include "maths/juce_BigInteger.h"
  234. #include "maths/juce_Expression.h"
  235. #include "maths/juce_Random.h"
  236. #include "misc/juce_RuntimePermissions.h"
  237. #include "misc/juce_Uuid.h"
  238. #include "misc/juce_WindowsRegistry.h"
  239. #include "system/juce_SystemStats.h"
  240. #include "threads/juce_ChildProcess.h"
  241. #include "threads/juce_DynamicLibrary.h"
  242. #include "threads/juce_HighResolutionTimer.h"
  243. #include "threads/juce_InterProcessLock.h"
  244. #include "threads/juce_Process.h"
  245. #include "threads/juce_SpinLock.h"
  246. #include "threads/juce_WaitableEvent.h"
  247. #include "threads/juce_Thread.h"
  248. #include "threads/juce_ThreadLocalValue.h"
  249. #include "threads/juce_ThreadPool.h"
  250. #include "threads/juce_TimeSliceThread.h"
  251. #include "threads/juce_ReadWriteLock.h"
  252. #include "threads/juce_ScopedReadLock.h"
  253. #include "threads/juce_ScopedWriteLock.h"
  254. #include "network/juce_IPAddress.h"
  255. #include "network/juce_MACAddress.h"
  256. #include "network/juce_NamedPipe.h"
  257. #include "network/juce_Socket.h"
  258. #include "network/juce_URL.h"
  259. #include "network/juce_WebInputStream.h"
  260. #include "time/juce_PerformanceCounter.h"
  261. #include "unit_tests/juce_UnitTest.h"
  262. #include "xml/juce_XmlDocument.h"
  263. #include "xml/juce_XmlElement.h"
  264. #include "zip/juce_GZIPCompressorOutputStream.h"
  265. #include "zip/juce_GZIPDecompressorInputStream.h"
  266. #include "zip/juce_ZipFile.h"
  267. #include "containers/juce_PropertySet.h"
  268. #include "memory/juce_SharedResourcePointer.h"
  269. #if JUCE_CORE_INCLUDE_OBJC_HELPERS && (JUCE_MAC || JUCE_IOS)
  270. #include "native/juce_osx_ObjCHelpers.h"
  271. #endif
  272. #if JUCE_CORE_INCLUDE_COM_SMART_PTR && JUCE_WINDOWS
  273. #include "native/juce_win32_ComSmartPtr.h"
  274. #endif
  275. #if JUCE_CORE_INCLUDE_JNI_HELPERS && JUCE_ANDROID
  276. #include "native/juce_android_JNIHelpers.h"
  277. #endif
  278. #ifndef DOXYGEN
  279. /*
  280. As the very long class names here try to explain, the purpose of this code is to cause
  281. a linker error if not all of your compile units are consistent in the options that they
  282. enable before including JUCE headers. The reason this is important is that if you have
  283. two cpp files, and one includes the juce headers with debug enabled, and another does so
  284. without that, then each will be generating code with different class layouts, and you'll
  285. get subtle and hard-to-track-down memory corruption!
  286. */
  287. #if JUCE_DEBUG
  288. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode
  289. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode() noexcept; };
  290. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode compileUnitMismatchSentinel;
  291. #else
  292. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode
  293. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode() noexcept; };
  294. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode compileUnitMismatchSentinel;
  295. #endif
  296. #endif
  297. }
  298. #if JUCE_MSVC
  299. #pragma warning (pop)
  300. // In DLL builds, need to disable this warnings for other modules
  301. #if defined (JUCE_DLL_BUILD) || defined (JUCE_DLL)
  302. #pragma warning (disable: 4251)
  303. #endif
  304. #endif