juce_core.cpp 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. #ifdef JUCE_CORE_H_INCLUDED
  22. /* When you add this cpp file to your project, you mustn't include it in a file where you've
  23. already included any other headers - just put it inside a file on its own, possibly with your config
  24. flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
  25. header files that the compiler may be using.
  26. */
  27. #error "Incorrect use of JUCE cpp file"
  28. #endif
  29. #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
  30. #define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
  31. #define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
  32. #include "juce_core.h"
  33. #include <locale>
  34. #include <cctype>
  35. #include <cstdarg>
  36. #if ! JUCE_ANDROID
  37. #include <sys/timeb.h>
  38. #include <cwctype>
  39. #endif
  40. #if JUCE_WINDOWS
  41. #include <ctime>
  42. #define _WINSOCK_DEPRECATED_NO_WARNINGS 1
  43. #include <winsock2.h>
  44. #include <ws2tcpip.h>
  45. #if ! JUCE_MINGW
  46. #pragma warning (push)
  47. #pragma warning (disable: 4091)
  48. #include <Dbghelp.h>
  49. #pragma warning (pop)
  50. #if ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
  51. #pragma comment (lib, "DbgHelp.lib")
  52. #endif
  53. #endif
  54. #if JUCE_MINGW
  55. #include <ws2spi.h>
  56. #endif
  57. #else
  58. #if JUCE_LINUX || JUCE_ANDROID
  59. #include <sys/types.h>
  60. #include <sys/socket.h>
  61. #include <sys/errno.h>
  62. #include <unistd.h>
  63. #include <netinet/in.h>
  64. #endif
  65. #if JUCE_LINUX
  66. #include <langinfo.h>
  67. #include <ifaddrs.h>
  68. #include <sys/resource.h>
  69. #if JUCE_USE_CURL
  70. #include <curl/curl.h>
  71. #endif
  72. #endif
  73. #include <pwd.h>
  74. #include <fcntl.h>
  75. #include <netdb.h>
  76. #include <arpa/inet.h>
  77. #include <netinet/tcp.h>
  78. #include <sys/time.h>
  79. #include <net/if.h>
  80. #include <sys/ioctl.h>
  81. #if ! JUCE_ANDROID
  82. #include <execinfo.h>
  83. #endif
  84. #endif
  85. #if JUCE_MAC || JUCE_IOS
  86. #include <xlocale.h>
  87. #include <mach/mach.h>
  88. #endif
  89. #if JUCE_ANDROID
  90. #include <android/log.h>
  91. #endif
  92. #undef check
  93. //==============================================================================
  94. #ifndef JUCE_STANDALONE_APPLICATION
  95. JUCE_COMPILER_WARNING ("Please re-save your project with the latest Projucer version to avoid this warning")
  96. #define JUCE_STANDALONE_APPLICATION 0
  97. #endif
  98. //==============================================================================
  99. namespace juce
  100. {
  101. #include "containers/juce_AbstractFifo.cpp"
  102. #include "containers/juce_NamedValueSet.cpp"
  103. #include "containers/juce_PropertySet.cpp"
  104. #include "containers/juce_Variant.cpp"
  105. #include "files/juce_DirectoryIterator.cpp"
  106. #include "files/juce_File.cpp"
  107. #include "files/juce_FileInputStream.cpp"
  108. #include "files/juce_FileOutputStream.cpp"
  109. #include "files/juce_FileSearchPath.cpp"
  110. #include "files/juce_TemporaryFile.cpp"
  111. #include "javascript/juce_JSON.cpp"
  112. #include "javascript/juce_Javascript.cpp"
  113. #include "containers/juce_DynamicObject.cpp"
  114. #include "logging/juce_FileLogger.cpp"
  115. #include "logging/juce_Logger.cpp"
  116. #include "maths/juce_BigInteger.cpp"
  117. #include "maths/juce_Expression.cpp"
  118. #include "maths/juce_Random.cpp"
  119. #include "memory/juce_MemoryBlock.cpp"
  120. #include "misc/juce_RuntimePermissions.cpp"
  121. #include "misc/juce_Result.cpp"
  122. #include "misc/juce_Uuid.cpp"
  123. #include "network/juce_MACAddress.cpp"
  124. #include "network/juce_NamedPipe.cpp"
  125. #include "network/juce_Socket.cpp"
  126. #include "network/juce_IPAddress.cpp"
  127. #include "streams/juce_BufferedInputStream.cpp"
  128. #include "streams/juce_FileInputSource.cpp"
  129. #include "streams/juce_InputStream.cpp"
  130. #include "streams/juce_MemoryInputStream.cpp"
  131. #include "streams/juce_MemoryOutputStream.cpp"
  132. #include "streams/juce_SubregionStream.cpp"
  133. #include "system/juce_SystemStats.cpp"
  134. #include "text/juce_CharacterFunctions.cpp"
  135. #include "text/juce_Identifier.cpp"
  136. #include "text/juce_LocalisedStrings.cpp"
  137. #include "text/juce_String.cpp"
  138. #include "streams/juce_OutputStream.cpp"
  139. #include "text/juce_StringArray.cpp"
  140. #include "text/juce_StringPairArray.cpp"
  141. #include "text/juce_StringPool.cpp"
  142. #include "text/juce_TextDiff.cpp"
  143. #include "text/juce_Base64.cpp"
  144. #include "threads/juce_ReadWriteLock.cpp"
  145. #include "threads/juce_Thread.cpp"
  146. #include "threads/juce_ThreadPool.cpp"
  147. #include "threads/juce_TimeSliceThread.cpp"
  148. #include "time/juce_PerformanceCounter.cpp"
  149. #include "time/juce_RelativeTime.cpp"
  150. #include "time/juce_Time.cpp"
  151. #include "unit_tests/juce_UnitTest.cpp"
  152. #include "xml/juce_XmlDocument.cpp"
  153. #include "xml/juce_XmlElement.cpp"
  154. #include "zip/juce_GZIPDecompressorInputStream.cpp"
  155. #include "zip/juce_GZIPCompressorOutputStream.cpp"
  156. #include "zip/juce_ZipFile.cpp"
  157. #include "files/juce_FileFilter.cpp"
  158. #include "files/juce_WildcardFileFilter.cpp"
  159. //==============================================================================
  160. #if JUCE_ANDROID
  161. #include "native/juce_android_JNIHelpers.h"
  162. #endif
  163. #if ! JUCE_WINDOWS
  164. #include "native/juce_posix_SharedCode.h"
  165. #include "native/juce_posix_NamedPipe.cpp"
  166. #endif
  167. //==============================================================================
  168. #if JUCE_MAC || JUCE_IOS
  169. #include "native/juce_mac_Files.mm"
  170. #include "native/juce_mac_Network.mm"
  171. #include "native/juce_mac_Strings.mm"
  172. #include "native/juce_mac_SystemStats.mm"
  173. #include "native/juce_mac_Threads.mm"
  174. //==============================================================================
  175. #elif JUCE_WINDOWS
  176. #include "native/juce_win32_Files.cpp"
  177. #include "native/juce_win32_Network.cpp"
  178. #include "native/juce_win32_Registry.cpp"
  179. #include "native/juce_win32_SystemStats.cpp"
  180. #include "native/juce_win32_Threads.cpp"
  181. //==============================================================================
  182. #elif JUCE_LINUX
  183. #include "native/juce_linux_CommonFile.cpp"
  184. #include "native/juce_linux_Files.cpp"
  185. #include "native/juce_linux_Network.cpp"
  186. #if JUCE_USE_CURL
  187. #include "native/juce_curl_Network.cpp"
  188. #endif
  189. #include "native/juce_linux_SystemStats.cpp"
  190. #include "native/juce_linux_Threads.cpp"
  191. //==============================================================================
  192. #elif JUCE_ANDROID
  193. #include "native/juce_linux_CommonFile.cpp"
  194. #include "native/juce_android_Files.cpp"
  195. #include "native/juce_android_Misc.cpp"
  196. #include "native/juce_android_Network.cpp"
  197. #include "native/juce_android_SystemStats.cpp"
  198. #include "native/juce_android_Threads.cpp"
  199. #include "native/juce_android_RuntimePermissions.cpp"
  200. #endif
  201. #include "threads/juce_ChildProcess.cpp"
  202. #include "threads/juce_HighResolutionTimer.cpp"
  203. #include "network/juce_URL.cpp"
  204. //==============================================================================
  205. /*
  206. As the very long class names here try to explain, the purpose of this code is to cause
  207. a linker error if not all of your compile units are consistent in the options that they
  208. enable before including JUCE headers. The reason this is important is that if you have
  209. two cpp files, and one includes the juce headers with debug enabled, and the other doesn't,
  210. then each will be generating code with different memory layouts for the classes, and
  211. you'll get subtle and hard-to-track-down memory corruption bugs!
  212. */
  213. #if JUCE_DEBUG
  214. this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode
  215. ::this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_debug_mode() noexcept {}
  216. #else
  217. this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode
  218. ::this_will_fail_to_link_if_some_of_your_compile_units_are_built_in_release_mode() noexcept {}
  219. #endif
  220. }