• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetParentObject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetParentObject

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseTFVehicle::FinishedBuilding( void )
{
	BaseClass::FinishedBuilding();

	// See if we've finished building on a vehicle that has a passenger slot assigned to my buildpoint.
	CBaseObject	*pParent = GetParentObject();
	if ( pParent && pParent->IsAVehicle() )
	{
		CBaseTFVehicle *pVehicle = static_cast<CBaseTFVehicle*>(pParent);
		int iRole = pVehicle->GetChildVehicleRole( this );
		if ( iRole != -1 )
		{
			// Is there a player in the role assigned to this buildpoint?
			CBaseTFPlayer *pExistingPlayer = static_cast<CBaseTFPlayer*>( pVehicle->GetPassenger( iRole ) );
			if ( pExistingPlayer )
			{
				// Remove the player from my parent vehicle and put them in me
				pExistingPlayer->LeaveVehicle();

				// Get in the vehicle.
				pExistingPlayer->GetInVehicle( this, VEHICLE_DRIVER );
			}
		}
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:28,代码来源:basetfvehicle.cpp


示例17: ShouldPredict

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CBaseObjectDriverGun::ShouldPredict( void )
{
	CBaseTFVehicle *pVehicle = dynamic_cast<CBaseTFVehicle*>(GetParentObject());
	if ( pVehicle && pVehicle->GetDriverPlayer() == C_BasePlayer::GetLocalPlayer() )
		return true;

	return BaseClass::ShouldPredict();
}
开发者ID:TalonBraveInfo,项目名称:InvasionSource,代码行数:11,代码来源:tf_obj_basedrivergun_shared.cpp


示例18: Wk

FVector FGeomPoly::GetMidPoint() const
{
	FVector Wk(0,0,0);
	int32 Count = 0;

	for( int32 e = 0 ; e < EdgeIndices.Num() ; ++e )
	{
		const FGeomEdge* ge = &GetParentObject()->EdgePool[ EdgeIndices[e] ];
		Wk += GetParentObject()->VertexPool[ ge->VertexIndices[0] ];
		Count++;
		Wk += GetParentObject()->VertexPool[ ge->VertexIndices[1] ];
		Count++;
	}

	check( Count );
	return Wk / Count;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:17,代码来源:EditorGeometry.cpp


示例19: GetParentObject

nsCOMPtr<nsIGlobalObject> OffscreenCanvas::GetGlobalObject() {
  if (NS_IsMainThread()) {
    return GetParentObject();
  }

  dom::WorkerPrivate* workerPrivate = dom::GetCurrentThreadWorkerPrivate();
  return workerPrivate->GlobalScope();
}
开发者ID:jld,项目名称:gecko-dev,代码行数:8,代码来源:OffscreenCanvas.cpp


示例20: FileCallbackRunnable

void FileSystemFileEntry::GetFile(
    FileCallback& aSuccessCallback,
    const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const {
  RefPtr<FileCallbackRunnable> runnable =
      new FileCallbackRunnable(&aSuccessCallback, mFile);

  FileSystemUtils::DispatchRunnable(GetParentObject(), runnable.forget());
}
开发者ID:Noctem,项目名称:gecko-dev,代码行数:8,代码来源:FileSystemFileEntry.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetParsedAttr函数代码示例发布时间:2022-05-30
下一篇:
C++ GetParentFrame函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap