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.

366 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. #ifndef JUCE_CORE_H_INCLUDED
  45. #define JUCE_CORE_H_INCLUDED
  46. //==============================================================================
  47. #ifdef _MSC_VER
  48. #pragma warning (push)
  49. // Disable warnings for long class names, padding, and undefined preprocessor definitions.
  50. #pragma warning (disable: 4251 4786 4668 4820)
  51. #ifdef __INTEL_COMPILER
  52. #pragma warning (disable: 1125)
  53. #endif
  54. #endif
  55. #include "system/juce_TargetPlatform.h"
  56. //==============================================================================
  57. /** Config: JUCE_FORCE_DEBUG
  58. Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and project settings,
  59. but if you define this value, you can override this to force it to be true or false.
  60. */
  61. #ifndef JUCE_FORCE_DEBUG
  62. //#define JUCE_FORCE_DEBUG 0
  63. #endif
  64. //==============================================================================
  65. /** Config: JUCE_LOG_ASSERTIONS
  66. If this flag is enabled, the jassert and jassertfalse macros will always use Logger::writeToLog()
  67. to write a message when an assertion happens.
  68. Enabling it will also leave this turned on in release builds. When it's disabled,
  69. however, the jassert and jassertfalse macros will not be compiled in a
  70. release build.
  71. @see jassert, jassertfalse, Logger
  72. */
  73. #ifndef JUCE_LOG_ASSERTIONS
  74. #if JUCE_ANDROID
  75. #define JUCE_LOG_ASSERTIONS 1
  76. #else
  77. #define JUCE_LOG_ASSERTIONS 0
  78. #endif
  79. #endif
  80. //==============================================================================
  81. /** Config: JUCE_CHECK_MEMORY_LEAKS
  82. Enables a memory-leak check for certain objects when the app terminates. See the LeakedObjectDetector
  83. class and the JUCE_LEAK_DETECTOR macro for more details about enabling leak checking for specific classes.
  84. */
  85. #if JUCE_DEBUG && ! defined (JUCE_CHECK_MEMORY_LEAKS)
  86. #define JUCE_CHECK_MEMORY_LEAKS 1
  87. #endif
  88. //==============================================================================
  89. /** Config: JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  90. In a Visual C++ build, this can be used to stop the required system libs being
  91. automatically added to the link stage.
  92. */
  93. #ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  94. #define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0
  95. #endif
  96. /** Config: JUCE_INCLUDE_ZLIB_CODE
  97. This can be used to disable Juce's embedded 3rd-party zlib code.
  98. You might need to tweak this if you're linking to an external zlib library in your app,
  99. but for normal apps, this option should be left alone.
  100. If you disable this, you might also want to set a value for JUCE_ZLIB_INCLUDE_PATH, to
  101. specify the path where your zlib headers live.
  102. */
  103. #ifndef JUCE_INCLUDE_ZLIB_CODE
  104. #define JUCE_INCLUDE_ZLIB_CODE 1
  105. #endif
  106. #ifndef JUCE_ZLIB_INCLUDE_PATH
  107. #define JUCE_ZLIB_INCLUDE_PATH <zlib.h>
  108. #endif
  109. /** Config: JUCE_USE_CURL
  110. Enables http/https support via libcurl (Linux only). Enabling this will add an additional
  111. run-time dynamic dependency to libcurl.
  112. If you disable this then https/ssl support will not be available on linux.
  113. */
  114. #ifndef JUCE_USE_CURL
  115. #define JUCE_USE_CURL 0
  116. #endif
  117. /** Config: JUCE_CATCH_UNHANDLED_EXCEPTIONS
  118. If enabled, this will add some exception-catching code to forward unhandled exceptions
  119. to your JUCEApplicationBase::unhandledException() callback.
  120. */
  121. #ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
  122. //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
  123. #endif
  124. /** Config: JUCE_ALLOW_STATIC_NULL_VARIABLES
  125. If disabled, this will turn off dangerous static globals like String::empty, var::null, etc
  126. which can cause nasty order-of-initialisation problems if they are referenced during static
  127. constructor code.
  128. */
  129. #ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES
  130. #define JUCE_ALLOW_STATIC_NULL_VARIABLES 1
  131. #endif
  132. #ifndef JUCE_STRING_UTF_TYPE
  133. #define JUCE_STRING_UTF_TYPE 8
  134. #endif
  135. //==============================================================================
  136. //==============================================================================
  137. #if JUCE_CORE_INCLUDE_NATIVE_HEADERS
  138. #include "native/juce_BasicNativeHeaders.h"
  139. #endif
  140. #include "system/juce_StandardHeader.h"
  141. namespace juce
  142. {
  143. class StringRef;
  144. class MemoryBlock;
  145. class File;
  146. class InputStream;
  147. class OutputStream;
  148. class DynamicObject;
  149. class FileInputStream;
  150. class FileOutputStream;
  151. class XmlElement;
  152. class JSONFormatter;
  153. extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger() noexcept;
  154. extern JUCE_API void JUCE_CALLTYPE logAssertion (const char* file, int line) noexcept;
  155. #include "memory/juce_Memory.h"
  156. #include "maths/juce_MathsFunctions.h"
  157. #include "memory/juce_ByteOrder.h"
  158. #include "memory/juce_Atomic.h"
  159. #include "text/juce_CharacterFunctions.h"
  160. #if JUCE_MSVC
  161. #pragma warning (push)
  162. #pragma warning (disable: 4514 4996)
  163. #endif
  164. #include "text/juce_CharPointer_UTF8.h"
  165. #include "text/juce_CharPointer_UTF16.h"
  166. #include "text/juce_CharPointer_UTF32.h"
  167. #include "text/juce_CharPointer_ASCII.h"
  168. #if JUCE_MSVC
  169. #pragma warning (pop)
  170. #endif
  171. #include "text/juce_String.h"
  172. #include "text/juce_StringRef.h"
  173. #include "logging/juce_Logger.h"
  174. #include "memory/juce_LeakedObjectDetector.h"
  175. #include "memory/juce_ContainerDeletePolicy.h"
  176. #include "memory/juce_HeapBlock.h"
  177. #include "memory/juce_MemoryBlock.h"
  178. #include "memory/juce_ReferenceCountedObject.h"
  179. #include "memory/juce_ScopedPointer.h"
  180. #include "memory/juce_OptionalScopedPointer.h"
  181. #include "memory/juce_Singleton.h"
  182. #include "memory/juce_WeakReference.h"
  183. #include "threads/juce_ScopedLock.h"
  184. #include "threads/juce_CriticalSection.h"
  185. #include "maths/juce_Range.h"
  186. #include "maths/juce_NormalisableRange.h"
  187. #include "maths/juce_StatisticsAccumulator.h"
  188. #include "containers/juce_ElementComparator.h"
  189. #include "containers/juce_ArrayAllocationBase.h"
  190. #include "containers/juce_Array.h"
  191. #include "containers/juce_LinkedListPointer.h"
  192. #include "containers/juce_ListenerList.h"
  193. #include "containers/juce_OwnedArray.h"
  194. #include "containers/juce_ReferenceCountedArray.h"
  195. #include "containers/juce_ScopedValueSetter.h"
  196. #include "containers/juce_SortedSet.h"
  197. #include "containers/juce_SparseSet.h"
  198. #include "containers/juce_AbstractFifo.h"
  199. #include "text/juce_NewLine.h"
  200. #include "text/juce_StringPool.h"
  201. #include "text/juce_Identifier.h"
  202. #include "text/juce_StringArray.h"
  203. #include "text/juce_StringPairArray.h"
  204. #include "text/juce_TextDiff.h"
  205. #include "text/juce_LocalisedStrings.h"
  206. #include "text/juce_Base64.h"
  207. #include "misc/juce_Result.h"
  208. #include "containers/juce_Variant.h"
  209. #include "containers/juce_NamedValueSet.h"
  210. #include "containers/juce_DynamicObject.h"
  211. #include "containers/juce_HashMap.h"
  212. #include "time/juce_RelativeTime.h"
  213. #include "time/juce_Time.h"
  214. #include "streams/juce_InputStream.h"
  215. #include "streams/juce_OutputStream.h"
  216. #include "streams/juce_BufferedInputStream.h"
  217. #include "streams/juce_MemoryInputStream.h"
  218. #include "streams/juce_MemoryOutputStream.h"
  219. #include "streams/juce_SubregionStream.h"
  220. #include "streams/juce_InputSource.h"
  221. #include "files/juce_File.h"
  222. #include "files/juce_DirectoryIterator.h"
  223. #include "files/juce_FileInputStream.h"
  224. #include "files/juce_FileOutputStream.h"
  225. #include "files/juce_FileSearchPath.h"
  226. #include "files/juce_MemoryMappedFile.h"
  227. #include "files/juce_TemporaryFile.h"
  228. #include "files/juce_FileFilter.h"
  229. #include "files/juce_WildcardFileFilter.h"
  230. #include "streams/juce_FileInputSource.h"
  231. #include "logging/juce_FileLogger.h"
  232. #include "javascript/juce_JSON.h"
  233. #include "javascript/juce_Javascript.h"
  234. #include "maths/juce_BigInteger.h"
  235. #include "maths/juce_Expression.h"
  236. #include "maths/juce_Random.h"
  237. #include "misc/juce_RuntimePermissions.h"
  238. #include "misc/juce_Uuid.h"
  239. #include "misc/juce_WindowsRegistry.h"
  240. #include "system/juce_SystemStats.h"
  241. #include "threads/juce_ChildProcess.h"
  242. #include "threads/juce_DynamicLibrary.h"
  243. #include "threads/juce_HighResolutionTimer.h"
  244. #include "threads/juce_InterProcessLock.h"
  245. #include "threads/juce_Process.h"
  246. #include "threads/juce_SpinLock.h"
  247. #include "threads/juce_WaitableEvent.h"
  248. #include "threads/juce_Thread.h"
  249. #include "threads/juce_ThreadLocalValue.h"
  250. #include "threads/juce_ThreadPool.h"
  251. #include "threads/juce_TimeSliceThread.h"
  252. #include "threads/juce_ReadWriteLock.h"
  253. #include "threads/juce_ScopedReadLock.h"
  254. #include "threads/juce_ScopedWriteLock.h"
  255. #include "network/juce_IPAddress.h"
  256. #include "network/juce_MACAddress.h"
  257. #include "network/juce_NamedPipe.h"
  258. #include "network/juce_Socket.h"
  259. #include "network/juce_URL.h"
  260. #include "network/juce_WebInputStream.h"
  261. #include "time/juce_PerformanceCounter.h"
  262. #include "unit_tests/juce_UnitTest.h"
  263. #include "xml/juce_XmlDocument.h"
  264. #include "xml/juce_XmlElement.h"
  265. #include "zip/juce_GZIPCompressorOutputStream.h"
  266. #include "zip/juce_GZIPDecompressorInputStream.h"
  267. #include "zip/juce_ZipFile.h"
  268. #include "containers/juce_PropertySet.h"
  269. #include "memory/juce_SharedResourcePointer.h"
  270. #if JUCE_CORE_INCLUDE_OBJC_HELPERS && (JUCE_MAC || JUCE_IOS)
  271. #include "native/juce_osx_ObjCHelpers.h"
  272. #endif
  273. #if JUCE_CORE_INCLUDE_COM_SMART_PTR && JUCE_WINDOWS
  274. #include "native/juce_win32_ComSmartPtr.h"
  275. #endif
  276. #if JUCE_CORE_INCLUDE_JNI_HELPERS && JUCE_ANDROID
  277. #include "native/juce_android_JNIHelpers.h"
  278. #endif
  279. #ifndef DOXYGEN
  280. /*
  281. As the very long class names here try to explain, the purpose of this code is to cause
  282. a linker error if not all of your compile units are consistent in the options that they
  283. enable before including JUCE headers. The reason this is important is that if you have
  284. two cpp files, and one includes the juce headers with debug enabled, and another does so
  285. without that, then each will be generating code with different class layouts, and you'll
  286. get subtle and hard-to-track-down memory corruption!
  287. */
  288. #if JUCE_DEBUG
  289. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode
  290. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode() noexcept; };
  291. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode compileUnitMismatchSentinel;
  292. #else
  293. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode
  294. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode() noexcept; };
  295. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode compileUnitMismatchSentinel;
  296. #endif
  297. #endif
  298. }
  299. #if JUCE_MSVC
  300. #pragma warning (pop)
  301. // In DLL builds, need to disable this warnings for other modules
  302. #if defined (JUCE_DLL_BUILD) || defined (JUCE_DLL)
  303. #pragma warning (disable: 4251)
  304. #endif
  305. #endif
  306. #endif // JUCE_CORE_H_INCLUDED