@@ -26,7 +26,7 @@ | |||
#if JUCE_MAC || JUCE_IOS | |||
#include <juce_audio_basics/native/juce_mac_CoreAudioLayouts.h> | |||
#include <juce_core/native/juce_osx_ObjCHelpers.h> | |||
#include <juce_core/native/juce_mac_CFHelpers.h> | |||
namespace juce | |||
{ | |||
@@ -23,17 +23,16 @@ | |||
============================================================================== | |||
*/ | |||
#if JucePlugin_Build_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) | |||
#include <juce_core/system/juce_CompilerWarnings.h> | |||
#include <juce_core/system/juce_TargetPlatform.h> | |||
#include <juce_core/system/juce_CompilerWarnings.h> | |||
#if JUCE_MAC | |||
#include <CoreFoundation/CoreFoundation.h> | |||
#include <juce_core/native/juce_osx_ObjCHelpers.h> | |||
#endif | |||
//============================================================================== | |||
#if JucePlugin_Build_VST3 && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) | |||
#if JUCE_PLUGINHOST_VST3 | |||
#if JUCE_MAC | |||
#include <CoreFoundation/CoreFoundation.h> | |||
#endif | |||
#undef JUCE_VST3HEADERS_INCLUDE_HEADERS_ONLY | |||
#define JUCE_VST3HEADERS_INCLUDE_HEADERS_ONLY 1 | |||
#endif | |||
@@ -80,6 +79,10 @@ | |||
std::vector<std::pair<int, std::function<void (int)>>> getFdReadCallbacks(); | |||
#endif | |||
#if JUCE_MAC | |||
#include <juce_core/native/juce_mac_CFHelpers.h> | |||
#endif | |||
namespace juce | |||
{ | |||
@@ -340,7 +340,7 @@ JUCE_END_IGNORE_WARNINGS_MSVC | |||
#include "memory/juce_AllocationHooks.h" | |||
#if JUCE_CORE_INCLUDE_OBJC_HELPERS && (JUCE_MAC || JUCE_IOS) | |||
#include "native/juce_osx_ObjCHelpers.h" | |||
#include "native/juce_mac_ObjCHelpers.h" | |||
#endif | |||
#if JUCE_CORE_INCLUDE_COM_SMART_PTR && JUCE_WINDOWS | |||
@@ -0,0 +1,63 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2020 - Raw Material Software Limited | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
The code included in this file is provided under the terms of the ISC license | |||
http://www.isc.org/downloads/software-support-policy/isc-license. Permission | |||
To use, copy, modify, and/or distribute this software for any purpose with or | |||
without fee is hereby granted provided that the above copyright notice and | |||
this permission notice appear in all copies. | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
/* This file contains a few helper functions that are used internally but which | |||
need to be kept away from the public headers because they use obj-C symbols. | |||
*/ | |||
namespace juce | |||
{ | |||
template <typename CFType> | |||
struct CFObjectDeleter | |||
{ | |||
void operator() (CFType object) const noexcept | |||
{ | |||
if (object != nullptr) | |||
CFRelease (object); | |||
} | |||
}; | |||
template <typename CFType> | |||
using CFUniquePtr = std::unique_ptr<typename std::remove_pointer<CFType>::type, CFObjectDeleter<CFType>>; | |||
template <typename CFType> | |||
struct CFObjectHolder | |||
{ | |||
CFObjectHolder() = default; | |||
CFObjectHolder (const CFObjectHolder&) = delete; | |||
CFObjectHolder (CFObjectHolder&&) = delete; | |||
CFObjectHolder& operator= (const CFObjectHolder&) = delete; | |||
CFObjectHolder& operator= (CFObjectHolder&&) = delete; | |||
~CFObjectHolder() noexcept | |||
{ | |||
if (object != nullptr) | |||
CFRelease (object); | |||
} | |||
// Public to facilitate passing the pointer address to functions | |||
CFType object = nullptr; | |||
}; | |||
} // namespace juce |
@@ -20,6 +20,8 @@ | |||
============================================================================== | |||
*/ | |||
#include "juce_mac_CFHelpers.h" | |||
/* This file contains a few helper functions that are used internally but which | |||
need to be kept away from the public headers because they use obj-C symbols. | |||
*/ | |||
@@ -240,40 +242,6 @@ struct NSObjectDeleter | |||
template <typename NSType> | |||
using NSUniquePtr = std::unique_ptr<NSType, NSObjectDeleter>; | |||
template <typename CFType> | |||
struct CFObjectDeleter | |||
{ | |||
void operator() (CFType object) const noexcept | |||
{ | |||
if (object != nullptr) | |||
CFRelease (object); | |||
} | |||
}; | |||
template <typename CFType> | |||
using CFUniquePtr = std::unique_ptr<typename std::remove_pointer<CFType>::type, CFObjectDeleter<CFType>>; | |||
template <typename CFType> | |||
struct CFObjectHolder | |||
{ | |||
CFObjectHolder() = default; | |||
CFObjectHolder (const CFObjectHolder&) = delete; | |||
CFObjectHolder (CFObjectHolder&&) = delete; | |||
CFObjectHolder& operator= (const CFObjectHolder&) = delete; | |||
CFObjectHolder& operator= (CFObjectHolder&&) = delete; | |||
~CFObjectHolder() noexcept | |||
{ | |||
if (object != nullptr) | |||
CFRelease (object); | |||
} | |||
// Public to facilitate passing the pointer address to functions | |||
CFType object = nullptr; | |||
}; | |||
//============================================================================== | |||
template <typename SuperclassType> | |||
struct ObjCClass |