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.

317 lines
12KB

  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. #ifndef JUCE_CORE_H_INCLUDED
  22. #define JUCE_CORE_H_INCLUDED
  23. #ifndef JUCE_MODULE_AVAILABLE_juce_core
  24. /* If you fail to make sure that all your compile units are building JUCE with the same set of
  25. option flags, then there's a risk that different compile units will treat the classes as having
  26. different memory layouts, leading to very nasty memory corruption errors when they all get
  27. linked together. That's why it's best to always include the Introjucer-generated AppConfig.h
  28. file before any juce headers.
  29. Note that if you do have an AppConfig.h file and hit this warning, it means that it doesn't
  30. contain the JUCE_MODULE_AVAILABLE_xxx flags, which are necessary for some inter-module
  31. functionality to work correctly. In that case, you should either rebuild your AppConfig.h with
  32. the latest introjucer, or fix it manually to contain these flags.
  33. */
  34. #ifdef _MSC_VER
  35. #pragma message ("Have you included your AppConfig.h file before including the JUCE headers?")
  36. #else
  37. #warning "Have you included your AppConfig.h file before including the JUCE headers?"
  38. #endif
  39. #endif
  40. #ifdef _MSC_VER
  41. #pragma warning (push)
  42. // Disable warnings for long class names, padding, and undefined preprocessor definitions.
  43. #pragma warning (disable: 4251 4786 4668 4820)
  44. #ifdef __INTEL_COMPILER
  45. #pragma warning (disable: 1125)
  46. #endif
  47. #endif
  48. //==============================================================================
  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 dynmic 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. #ifndef JUCE_STRING_UTF_TYPE
  119. #define JUCE_STRING_UTF_TYPE 8
  120. #endif
  121. //=============================================================================
  122. //=============================================================================
  123. #include "system/juce_StandardHeader.h"
  124. namespace juce
  125. {
  126. class StringRef;
  127. class MemoryBlock;
  128. class File;
  129. class InputStream;
  130. class OutputStream;
  131. class DynamicObject;
  132. class FileInputStream;
  133. class FileOutputStream;
  134. class XmlElement;
  135. class JSONFormatter;
  136. extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger();
  137. extern JUCE_API void JUCE_CALLTYPE logAssertion (const char* file, int line) noexcept;
  138. #include "memory/juce_Memory.h"
  139. #include "maths/juce_MathsFunctions.h"
  140. #include "memory/juce_ByteOrder.h"
  141. #include "memory/juce_Atomic.h"
  142. #include "text/juce_CharacterFunctions.h"
  143. #if JUCE_MSVC
  144. #pragma warning (push)
  145. #pragma warning (disable: 4514 4996)
  146. #endif
  147. #include "text/juce_CharPointer_UTF8.h"
  148. #include "text/juce_CharPointer_UTF16.h"
  149. #include "text/juce_CharPointer_UTF32.h"
  150. #include "text/juce_CharPointer_ASCII.h"
  151. #if JUCE_MSVC
  152. #pragma warning (pop)
  153. #endif
  154. #include "text/juce_String.h"
  155. #include "text/juce_StringRef.h"
  156. #include "logging/juce_Logger.h"
  157. #include "memory/juce_LeakedObjectDetector.h"
  158. #include "memory/juce_ContainerDeletePolicy.h"
  159. #include "memory/juce_HeapBlock.h"
  160. #include "memory/juce_MemoryBlock.h"
  161. #include "memory/juce_ReferenceCountedObject.h"
  162. #include "memory/juce_ScopedPointer.h"
  163. #include "memory/juce_OptionalScopedPointer.h"
  164. #include "memory/juce_Singleton.h"
  165. #include "memory/juce_WeakReference.h"
  166. #include "threads/juce_ScopedLock.h"
  167. #include "threads/juce_CriticalSection.h"
  168. #include "maths/juce_Range.h"
  169. #include "maths/juce_NormalisableRange.h"
  170. #include "containers/juce_ElementComparator.h"
  171. #include "containers/juce_ArrayAllocationBase.h"
  172. #include "containers/juce_Array.h"
  173. #include "containers/juce_LinkedListPointer.h"
  174. #include "containers/juce_OwnedArray.h"
  175. #include "containers/juce_ReferenceCountedArray.h"
  176. #include "containers/juce_ScopedValueSetter.h"
  177. #include "containers/juce_SortedSet.h"
  178. #include "containers/juce_SparseSet.h"
  179. #include "containers/juce_AbstractFifo.h"
  180. #include "text/juce_NewLine.h"
  181. #include "text/juce_StringPool.h"
  182. #include "text/juce_Identifier.h"
  183. #include "text/juce_StringArray.h"
  184. #include "text/juce_StringPairArray.h"
  185. #include "text/juce_TextDiff.h"
  186. #include "text/juce_LocalisedStrings.h"
  187. #include "text/juce_Base64.h"
  188. #include "misc/juce_Result.h"
  189. #include "containers/juce_Variant.h"
  190. #include "containers/juce_NamedValueSet.h"
  191. #include "containers/juce_DynamicObject.h"
  192. #include "containers/juce_HashMap.h"
  193. #include "time/juce_RelativeTime.h"
  194. #include "time/juce_Time.h"
  195. #include "streams/juce_InputStream.h"
  196. #include "streams/juce_OutputStream.h"
  197. #include "streams/juce_BufferedInputStream.h"
  198. #include "streams/juce_MemoryInputStream.h"
  199. #include "streams/juce_MemoryOutputStream.h"
  200. #include "streams/juce_SubregionStream.h"
  201. #include "streams/juce_InputSource.h"
  202. #include "files/juce_File.h"
  203. #include "files/juce_DirectoryIterator.h"
  204. #include "files/juce_FileInputStream.h"
  205. #include "files/juce_FileOutputStream.h"
  206. #include "files/juce_FileSearchPath.h"
  207. #include "files/juce_MemoryMappedFile.h"
  208. #include "files/juce_TemporaryFile.h"
  209. #include "files/juce_FileFilter.h"
  210. #include "files/juce_WildcardFileFilter.h"
  211. #include "streams/juce_FileInputSource.h"
  212. #include "logging/juce_FileLogger.h"
  213. #include "javascript/juce_JSON.h"
  214. #include "javascript/juce_Javascript.h"
  215. #include "maths/juce_BigInteger.h"
  216. #include "maths/juce_Expression.h"
  217. #include "maths/juce_Random.h"
  218. #include "misc/juce_Uuid.h"
  219. #include "misc/juce_WindowsRegistry.h"
  220. #include "system/juce_SystemStats.h"
  221. #include "threads/juce_ChildProcess.h"
  222. #include "threads/juce_DynamicLibrary.h"
  223. #include "threads/juce_HighResolutionTimer.h"
  224. #include "threads/juce_InterProcessLock.h"
  225. #include "threads/juce_Process.h"
  226. #include "threads/juce_SpinLock.h"
  227. #include "threads/juce_WaitableEvent.h"
  228. #include "threads/juce_Thread.h"
  229. #include "threads/juce_ThreadLocalValue.h"
  230. #include "threads/juce_ThreadPool.h"
  231. #include "threads/juce_TimeSliceThread.h"
  232. #include "threads/juce_ReadWriteLock.h"
  233. #include "threads/juce_ScopedReadLock.h"
  234. #include "threads/juce_ScopedWriteLock.h"
  235. #include "network/juce_IPAddress.h"
  236. #include "network/juce_MACAddress.h"
  237. #include "network/juce_NamedPipe.h"
  238. #include "network/juce_Socket.h"
  239. #include "network/juce_URL.h"
  240. #include "time/juce_PerformanceCounter.h"
  241. #include "unit_tests/juce_UnitTest.h"
  242. #include "xml/juce_XmlDocument.h"
  243. #include "xml/juce_XmlElement.h"
  244. #include "zip/juce_GZIPCompressorOutputStream.h"
  245. #include "zip/juce_GZIPDecompressorInputStream.h"
  246. #include "zip/juce_ZipFile.h"
  247. #include "containers/juce_PropertySet.h"
  248. #include "memory/juce_SharedResourcePointer.h"
  249. #ifndef DOXYGEN
  250. /*
  251. As the very long class names here try to explain, the purpose of this code is to cause
  252. a linker error if not all of your compile units are consistent in the options that they
  253. enable before including JUCE headers. The reason this is important is that if you have
  254. two cpp files, and one includes the juce headers with debug enabled, and another does so
  255. without that, then each will be generating code with different class layouts, and you'll
  256. get subtle and hard-to-track-down memory corruption!
  257. */
  258. #if JUCE_DEBUG
  259. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode
  260. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode() noexcept; };
  261. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode compileUnitMismatchSentinel;
  262. #else
  263. struct JUCE_API this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode
  264. { this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode() noexcept; };
  265. static this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode compileUnitMismatchSentinel;
  266. #endif
  267. #endif
  268. }
  269. #if JUCE_MSVC
  270. #pragma warning (pop)
  271. #endif
  272. #endif // JUCE_CORE_H_INCLUDED