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