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.

299 lines
11KB

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