mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-29 02:40:05 +00:00
Added a get() method to ReferenceCountedObjectPtr.
This commit is contained in:
parent
4cabc9095e
commit
943a8ef757
7 changed files with 35 additions and 15 deletions
|
|
@ -1,3 +1,7 @@
|
|||
#ifdef JUCE_USER_DEFINED_RC_FILE
|
||||
#include JUCE_USER_DEFINED_RC_FILE
|
||||
#else
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
|
@ -22,3 +26,5 @@ BEGIN
|
|||
VALUE "Translation", 0x409, 65001
|
||||
END
|
||||
END
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
#ifdef JUCE_USER_DEFINED_RC_FILE
|
||||
#include JUCE_USER_DEFINED_RC_FILE
|
||||
#else
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
|
@ -22,3 +26,5 @@ BEGIN
|
|||
VALUE "Translation", 0x409, 65001
|
||||
END
|
||||
END
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void SamplerVoice::controllerMoved (const int /*controllerNumber*/,
|
|||
//==============================================================================
|
||||
void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples)
|
||||
{
|
||||
const SamplerSound* const playingSound = static_cast <SamplerSound*> (getCurrentlyPlayingSound().getObject());
|
||||
const SamplerSound* const playingSound = static_cast <SamplerSound*> (getCurrentlyPlayingSound().get());
|
||||
|
||||
if (playingSound != nullptr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ struct Expression::Helpers
|
|||
|
||||
Type getType() const noexcept { return operatorType; }
|
||||
int getNumInputs() const { return 2; }
|
||||
Term* getInput (int index) const { return index == 0 ? left.getObject() : (index == 1 ? right.getObject() : 0); }
|
||||
Term* getInput (int index) const { return index == 0 ? left.get() : (index == 1 ? right.get() : 0); }
|
||||
|
||||
virtual double performFunction (double left, double right) const = 0;
|
||||
virtual void writeOperator (String& dest) const = 0;
|
||||
|
|
@ -397,7 +397,7 @@ struct Expression::Helpers
|
|||
JUCE_DECLARE_NON_COPYABLE (SymbolRenamingVisitor);
|
||||
};
|
||||
|
||||
SymbolTerm* getSymbol() const { return static_cast <SymbolTerm*> (left.getObject()); }
|
||||
SymbolTerm* getSymbol() const { return static_cast <SymbolTerm*> (left.get()); }
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (DotOperator);
|
||||
};
|
||||
|
|
@ -414,7 +414,7 @@ struct Expression::Helpers
|
|||
Type getType() const noexcept { return operatorType; }
|
||||
int getInputIndexFor (const Term* possibleInput) const { return possibleInput == input ? 0 : -1; }
|
||||
int getNumInputs() const { return 1; }
|
||||
Term* getInput (int index) const { return index == 0 ? input.getObject() : nullptr; }
|
||||
Term* getInput (int index) const { return index == 0 ? input.get() : nullptr; }
|
||||
Term* clone() const { return new Negate (input->clone()); }
|
||||
|
||||
TermPtr resolve (const Scope& scope, int recursionDepth)
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ public:
|
|||
*/
|
||||
template <class DerivedClass>
|
||||
inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr<DerivedClass>& other) noexcept
|
||||
: referencedObject (static_cast <ReferenceCountedObjectClass*> (other.getObject()))
|
||||
: referencedObject (static_cast <ReferenceCountedObjectClass*> (other.get()))
|
||||
{
|
||||
if (referencedObject != nullptr)
|
||||
referencedObject->incReferenceCount();
|
||||
|
|
@ -266,7 +266,7 @@ public:
|
|||
template <class DerivedClass>
|
||||
ReferenceCountedObjectPtr& operator= (const ReferenceCountedObjectPtr<DerivedClass>& other)
|
||||
{
|
||||
return operator= (static_cast <ReferenceCountedObjectClass*> (other.getObject()));
|
||||
return operator= (static_cast <ReferenceCountedObjectClass*> (other.get()));
|
||||
}
|
||||
|
||||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
|
||||
|
|
@ -325,6 +325,14 @@ public:
|
|||
return referencedObject;
|
||||
}
|
||||
|
||||
/** Returns the object that this pointer references.
|
||||
The pointer returned may be zero, of course.
|
||||
*/
|
||||
inline ReferenceCountedObjectClass* get() const noexcept
|
||||
{
|
||||
return referencedObject;
|
||||
}
|
||||
|
||||
/** Returns the object that this pointer references.
|
||||
The pointer returned may be zero, of course.
|
||||
*/
|
||||
|
|
@ -343,42 +351,42 @@ private:
|
|||
template <class ReferenceCountedObjectClass>
|
||||
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectClass* const object2) noexcept
|
||||
{
|
||||
return object1.getObject() == object2;
|
||||
return object1.get() == object2;
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPointers. */
|
||||
template <class ReferenceCountedObjectClass>
|
||||
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
|
||||
{
|
||||
return object1.getObject() == object2.getObject();
|
||||
return object1.get() == object2.get();
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPointers. */
|
||||
template <class ReferenceCountedObjectClass>
|
||||
bool operator== (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
|
||||
{
|
||||
return object1 == object2.getObject();
|
||||
return object1 == object2.get();
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPointers. */
|
||||
template <class ReferenceCountedObjectClass>
|
||||
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectClass* object2) noexcept
|
||||
{
|
||||
return object1.getObject() != object2;
|
||||
return object1.get() != object2;
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPointers. */
|
||||
template <class ReferenceCountedObjectClass>
|
||||
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
|
||||
{
|
||||
return object1.getObject() != object2.getObject();
|
||||
return object1.get() != object2.get();
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPointers. */
|
||||
template <class ReferenceCountedObjectClass>
|
||||
bool operator!= (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) noexcept
|
||||
{
|
||||
return object1 != object2.getObject();
|
||||
return object1 != object2.get();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ bool ValueTree::isEquivalentTo (const ValueTree& other) const
|
|||
|
||||
ValueTree ValueTree::createCopy() const
|
||||
{
|
||||
return ValueTree (createCopyIfNotNull (object.getObject()));
|
||||
return ValueTree (createCopyIfNotNull (object.get()));
|
||||
}
|
||||
|
||||
bool ValueTree::hasType (const Identifier& typeName) const
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void NSViewComponent::setView (void* const view)
|
|||
|
||||
void* NSViewComponent::getView() const
|
||||
{
|
||||
return attachment != nullptr ? static_cast <NSViewAttachment*> (attachment.getObject())->view
|
||||
return attachment != nullptr ? static_cast <NSViewAttachment*> (attachment.get())->view
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ void NSViewComponent::resizeToFitView()
|
|||
{
|
||||
if (attachment != nullptr)
|
||||
{
|
||||
NSRect r = [static_cast <NSViewAttachment*> (attachment.getObject())->view frame];
|
||||
NSRect r = [static_cast <NSViewAttachment*> (attachment.get())->view frame];
|
||||
setBounds (Rectangle<int> ((int) r.size.width, (int) r.size.height));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue