当前位置: 首页>>代码示例>>C++>>正文


C++ GetParentObject函数代码示例

本文整理汇总了C++中GetParentObject函数的典型用法代码示例。如果您正苦于以下问题:C++ GetParentObject函数的具体用法?C++ GetParentObject怎么用?C++ GetParentObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetParentObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetParentObject

FVector FGeomEdge::GetWidgetLocation()
{
	FVector dir = (GetParentObject()->VertexPool[ VertexIndices[1] ] - GetParentObject()->VertexPool[ VertexIndices[0] ]);
	const float dist = dir.Size() / 2;
	dir.Normalize();
	const FVector loc = GetParentObject()->VertexPool[ VertexIndices[0] ] + (dir * dist);
	return GetParentObject()->GetActualBrush()->ActorToWorld().TransformPosition( loc );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:8,代码来源:EditorGeometry.cpp

示例2: GetParentObject

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CObjectSapper::DetachObjectFromObject( void )
{
	if ( GetParentObject() )
	{
		GetParentObject()->OnRemoveSapper();
	}

	BaseClass::DetachObjectFromObject();
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:12,代码来源:tf_obj_sapper.cpp

示例3: GetMidPoint

FVector FGeomEdge::GetMidPoint() const
{
	const FGeomVertex* wk0 = &(GetParentObject()->VertexPool[ VertexIndices[0] ]);
	const FGeomVertex* wk1 = &(GetParentObject()->VertexPool[ VertexIndices[1] ]);

	const FVector v0( wk0->X, wk0->Y, wk0->Z );
	const FVector v1( wk1->X, wk1->Y, wk1->Z );

	return (v0 + v1) / 2;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:10,代码来源:EditorGeometry.cpp

示例4: FileList

FileList*
DataTransfer::GetFiles(ErrorResult& aRv)
{
    if (mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
            mEventType != NS_PASTE) {
        return nullptr;
    }

    if (!mFiles) {
        mFiles = new FileList(static_cast<nsIDOMDataTransfer*>(this));

        uint32_t count = mItems.Length();

        for (uint32_t i = 0; i < count; i++) {
            nsCOMPtr<nsIVariant> variant;
            aRv = MozGetDataAt(NS_ConvertUTF8toUTF16(kFileMime), i, getter_AddRefs(variant));
            if (aRv.Failed()) {
                return nullptr;
            }

            if (!variant)
                continue;

            nsCOMPtr<nsISupports> supports;
            nsresult rv = variant->GetAsISupports(getter_AddRefs(supports));

            if (NS_FAILED(rv))
                continue;

            nsCOMPtr<nsIFile> file = do_QueryInterface(supports);

            nsRefPtr<File> domFile;
            if (file) {
                domFile = File::CreateFromFile(GetParentObject(), file);
            } else {
                nsCOMPtr<FileImpl> fileImpl = do_QueryInterface(supports);
                if (!fileImpl) {
                    continue;
                }
                domFile = new File(GetParentObject(), static_cast<FileImpl*>(fileImpl.get()));
            }

            if (!mFiles->Append(domFile)) {
                aRv.Throw(NS_ERROR_FAILURE);
                return nullptr;
            }
        }
    }

    return mFiles;
}
开发者ID:tefn3849,项目名称:gecko-dev,代码行数:51,代码来源:DataTransfer.cpp

示例5: GetParentObject

//-----------------------------------------------------------------------------
// Purpose: Heal the object I'm attached to
//-----------------------------------------------------------------------------
void CObjectSelfHeal::SelfHealThink( void )
{
	if ( !GetTeam() )
		return;

	CBaseObject *pObject = GetParentObject();
	if ( !pObject )
	{
		Killed();
		return;
	}

	SetNextThink( gpGlobals->curtime + obj_selfheal_rate.GetFloat(), SELFHEAL_THINK_CONTEXT );

	// Don't heal if we've been EMPed
	if ( HasPowerup( POWERUP_EMP ) )
		return;

	// Don't bring objects back from the dead
	if ( !pObject->IsAlive() || pObject->IsDying() )
		return;

	// Repair our parent if it's hurt
	pObject->Repair( obj_selfheal_amount.GetFloat() );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:28,代码来源:tf_obj_selfheal.cpp

示例6:

void C4ObjectMenu::LocalInit(C4Object *pObject, bool fUserMenu)
{
	Object=pObject;
	UserMenu=fUserMenu;
	ParentObject=GetParentObject();
	if (pObject) eCallbackType = CB_Object; else eCallbackType = CB_Scenario;
}
开发者ID:Rocket-Fish,项目名称:openclonk,代码行数:7,代码来源:C4ObjectMenu.cpp

示例7: promise

already_AddRefed<Promise>
MediaKeys::CreateSession(const nsAString& initDataType,
                         const Uint8Array& aInitData,
                         SessionType aSessionType,
                         ErrorResult& aRv)
{
  aInitData.ComputeLengthAndData();
  nsRefPtr<Promise> promise(MakePromise(aRv));
  if (aRv.Failed()) {
    return nullptr;
  }
  nsRefPtr<MediaKeySession> session = new MediaKeySession(GetParentObject(),
                                                          this,
                                                          mKeySystem,
                                                          aSessionType, aRv);
  if (aRv.Failed()) {
    return nullptr;
  }

  auto pid = StorePromise(promise);
  // Hang onto session until the CDM has finished setting it up.
  mPendingSessions.Put(pid, session);
  mProxy->CreateSession(aSessionType,
                        pid,
                        initDataType,
                        aInitData);

  return promise.forget();
}
开发者ID:andrenatal,项目名称:gecko-dev,代码行数:29,代码来源:MediaKeys.cpp

示例8: NS_ASSERTION

nsresult
IDBRequest::NotifyHelperCompleted(HelperBase* aHelper)
{
  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
  NS_ASSERTION(!mHaveResultOrErrorCode, "Already called!");
  NS_ASSERTION(JSVAL_IS_VOID(mResultVal), "Should be undefined!");

  // See if our window is still valid. If not then we're going to pretend that
  // we never completed.
  if (NS_FAILED(CheckInnerWindowCorrectness())) {
    return NS_OK;
  }

  mHaveResultOrErrorCode = true;

  nsresult rv = aHelper->GetResultCode();

  // If the request failed then set the error code and return.
  if (NS_FAILED(rv)) {
    SetError(rv);
    return NS_OK;
  }

  // Otherwise we need to get the result from the helper.
  JSContext* cx = GetJSContext();
  if (!cx) {
    NS_WARNING("Failed to get safe JSContext!");
    rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
    SetError(rv);
    return rv;
  }

  JSObject* global = GetParentObject();
  NS_ASSERTION(global, "This should never be null!");

  JSAutoRequest ar(cx);
  JSAutoEnterCompartment ac;
  if (ac.enter(cx, global)) {
    AssertIsRooted();

    rv = aHelper->GetSuccessResult(cx, &mResultVal);
    if (NS_FAILED(rv)) {
      NS_WARNING("GetSuccessResult failed!");
    }
  }
  else {
    NS_WARNING("Failed to enter correct compartment!");
    rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
  }

  if (NS_SUCCEEDED(rv)) {
    mError = nullptr;
  }
  else {
    SetError(rv);
    mResultVal = JSVAL_VOID;
  }

  return rv;
}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:60,代码来源:IDBRequest.cpp

示例9: self

already_AddRefed<Promise> MediaDevices::GetDisplayMedia(
    const DisplayMediaStreamConstraints& aConstraints, CallerType aCallerType,
    ErrorResult& aRv) {
  RefPtr<Promise> p = Promise::Create(GetParentObject(), aRv);
  if (NS_WARN_IF(aRv.Failed())) {
    return nullptr;
  }
  RefPtr<MediaDevices> self(this);
  MediaManager::Get()
      ->GetDisplayMedia(GetOwner(), aConstraints, aCallerType)
      ->Then(GetCurrentThreadSerialEventTarget(), __func__,
             [this, self, p](RefPtr<DOMMediaStream>&& aStream) {
               if (!GetWindowIfCurrent()) {
                 return;  // leave promise pending after navigation.
               }
               p->MaybeResolve(std::move(aStream));
             },
             [this, self, p](RefPtr<MediaMgrError>&& error) {
               nsPIDOMWindowInner* window = GetWindowIfCurrent();
               if (!window) {
                 return;  // leave promise pending after navigation.
               }
               p->MaybeReject(MakeRefPtr<MediaStreamError>(window, *error));
             });
  return p.forget();
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:26,代码来源:MediaDevices.cpp

示例10: EnterCompartment

void
WrapperPromiseCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
{
  AutoJSContext cx;
  Maybe<JSAutoCompartment> ac;
  EnterCompartment(ac, cx, aValue);

  ErrorResult rv;

  // If invoking callback threw an exception, run resolver's reject with the
  // thrown exception as argument and the synchronous flag set.
  Optional<JS::Handle<JS::Value> > value(cx,
    mCallback->Call(mNextResolver->GetParentObject(), aValue, rv,
                    CallbackObject::eRethrowExceptions));

  rv.WouldReportJSException();

  if (rv.Failed() && rv.IsJSException()) {
    Optional<JS::Handle<JS::Value> > value(cx);
    rv.StealJSException(cx, &value.Value());

    Maybe<JSAutoCompartment> ac2;
    EnterCompartment(ac2, cx, value);
    mNextResolver->RejectInternal(cx, value, PromiseResolver::SyncTask);
    return;
  }

  // Otherwise, run resolver's resolve with value and the synchronous flag
  // set.
  Maybe<JSAutoCompartment> ac2;
  EnterCompartment(ac2, cx, value);
  mNextResolver->ResolveInternal(cx, value, PromiseResolver::SyncTask);
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:33,代码来源:PromiseCallback.cpp

示例11: do_QueryInterface

already_AddRefed<Promise>
AudioContext::Close(ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
  nsRefPtr<Promise> promise;
  promise = Promise::Create(parentObject, aRv);
  if (aRv.Failed()) {
    return nullptr;
  }

  if (mIsOffline) {
    promise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Closed) {
    promise->MaybeResolve(NS_ERROR_DOM_INVALID_STATE_ERR);
    return promise.forget();
  }

  mCloseCalled = true;

  mPromiseGripArray.AppendElement(promise);
  Graph()->ApplyAudioContextOperation(DestinationStream()->AsAudioNodeStream(),
                                      AudioContextOperation::Close, promise);

  MediaStream* ds = DestinationStream();
  if (ds) {
    ds->BlockStreamIfNeeded();
  }

  return promise.forget();
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:33,代码来源:AudioContext.cpp

示例12: rooted

void
WrapperPromiseCallback::Call(const Optional<JS::Handle<JS::Value> >& aValue)
{
  AutoJSContext cx;
  // FIXME Bug 878849
  Maybe<JSAutoCompartment> ac;
  if (aValue.WasPassed() && aValue.Value().isObject()) {
    JS::Rooted<JSObject*> rooted(cx, &aValue.Value().toObject());
    ac.construct(cx, rooted);
  }

  ErrorResult rv;

  // If invoking callback threw an exception, run resolver's reject with the
  // thrown exception as argument and the synchronous flag set.
  Optional<JS::Handle<JS::Value> > value(cx,
    mCallback->Call(mNextResolver->GetParentObject(), aValue, rv,
                    CallbackObject::eRethrowExceptions));

  rv.WouldReportJSException();

  if (rv.Failed() && rv.IsJSException()) {
    Optional<JS::Handle<JS::Value> > value(cx);
    rv.StealJSException(cx, &value.Value());
    mNextResolver->RejectInternal(cx, value, PromiseResolver::SyncTask);
    return;
  }

  // Otherwise, run resolver's resolve with value and the synchronous flag
  // set.
  mNextResolver->ResolveInternal(cx, value, PromiseResolver::SyncTask);
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:32,代码来源:PromiseCallback.cpp

示例13:

pgCollection *ctlTree::GetParentCollection(wxTreeItemId id)
{
	pgCollection *coll = (pgCollection *)GetParentObject(id);
	if (coll && coll->IsCollection())
		return coll;
	return 0;
}
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:7,代码来源:ctlTree.cpp

示例14: NS_WARNING

already_AddRefed<MediaKeySession>
MediaKeys::CreateSession(JSContext* aCx,
                         SessionType aSessionType,
                         ErrorResult& aRv)
{
  if (!mProxy) {
    NS_WARNING("Tried to use a MediaKeys which lost its CDM");
    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
    return nullptr;
  }

  EME_LOG("MediaKeys[%p] Creating session", this);

  RefPtr<MediaKeySession> session = new MediaKeySession(aCx,
                                                          GetParentObject(),
                                                          this,
                                                          mKeySystem,
                                                          mCDMVersion,
                                                          aSessionType,
                                                          aRv);

  if (aRv.Failed()) {
    return nullptr;
  }

  // Add session to the set of sessions awaiting their sessionId being ready.
  mPendingSessions.Put(session->Token(), session);

  return session.forget();
}
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:30,代码来源:MediaKeys.cpp

示例15: do_QueryInterface

already_AddRefed<Promise>
AudioContext::Resume(ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
  nsRefPtr<Promise> promise;
  promise = Promise::Create(parentObject, aRv);
  if (aRv.Failed()) {
    return nullptr;
  }

  if (mIsOffline) {
    promise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Closed ||
      mCloseCalled) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Running) {
    promise->MaybeResolve(JS::UndefinedHandleValue);
    return promise.forget();
  }

  Destination()->Resume();

  mPromiseGripArray.AppendElement(promise);
  Graph()->ApplyAudioContextOperation(DestinationStream()->AsAudioNodeStream(),
                                      AudioContextOperation::Resume, promise);

  return promise.forget();
}
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:34,代码来源:AudioContext.cpp


注:本文中的GetParentObject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。