本文整理汇总了C++中WeakReference::wasObjectDeleted方法的典型用法代码示例。如果您正苦于以下问题:C++ WeakReference::wasObjectDeleted方法的具体用法?C++ WeakReference::wasObjectDeleted怎么用?C++ WeakReference::wasObjectDeleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeakReference
的用法示例。
在下文中一共展示了WeakReference::wasObjectDeleted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: useTimeslice
bool useTimeslice (const int elapsed)
{
if (auto* c = proxy != nullptr ? static_cast<Component*> (proxy)
: static_cast<Component*> (component))
{
msElapsed += elapsed;
double newProgress = msElapsed / (double) msTotal;
if (newProgress >= 0 && newProgress < 1.0)
{
const WeakReference<AnimationTask> weakRef (this);
newProgress = timeToDistance (newProgress);
const double delta = (newProgress - lastProgress) / (1.0 - lastProgress);
jassert (newProgress >= lastProgress);
lastProgress = newProgress;
if (delta < 1.0)
{
bool stillBusy = false;
if (isMoving)
{
left += (destination.getX() - left) * delta;
top += (destination.getY() - top) * delta;
right += (destination.getRight() - right) * delta;
bottom += (destination.getBottom() - bottom) * delta;
const Rectangle<int> newBounds (roundToInt (left),
roundToInt (top),
roundToInt (right - left),
roundToInt (bottom - top));
if (newBounds != destination)
{
c->setBounds (newBounds);
stillBusy = true;
}
}
// Check whether the animation was cancelled/deleted during
// a callback during the setBounds method
if (weakRef.wasObjectDeleted())
return false;
if (isChangingAlpha)
{
alpha += (destAlpha - alpha) * delta;
c->setAlpha ((float) alpha);
stillBusy = true;
}
if (stillBusy)
return true;
}
}
}
moveToFinalDestination();
return false;
}
示例2: moveToFinalDestination
void moveToFinalDestination()
{
if (component != nullptr)
{
const WeakReference<AnimationTask> weakRef (this);
component->setAlpha ((float) destAlpha);
component->setBounds (destination);
if (! weakRef.wasObjectDeleted())
if (proxy != nullptr)
component->setVisible (destAlpha > 0);
}
}
示例3: getValueFromScript
var Parameter::getValueFromScript(const juce::var::NativeFunctionArgs & a)
{
WeakReference<Parameter> c = getObjectFromJS<Parameter>(a);
if (c == nullptr || c.wasObjectDeleted()) return var();
return c->getValue();
}