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


C++ Type::GetPointerTo方法代码示例

本文整理汇总了C++中Type::GetPointerTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Type::GetPointerTo方法的具体用法?C++ Type::GetPointerTo怎么用?C++ Type::GetPointerTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


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

示例1: if

// virtual
void Properties::PropertyListener::handleEvent(System::Event* evt)
{
#if WIN32
	if (evt->get_eventPhase() != System::CAPTURING_PHASE)
	{
		if (*evt->get_type() == L"contextmenu")
		{
			evt->stopPropagation();
			UI::MouseEvent* mouseEvt = static_cast<UI::MouseEvent*>(evt);

			UI::CLXUIMenuElement* menu = new UI::CLXUIMenuElement();
		//	menu->SetRParent(m_ctledit);
			menu->SetOwnerWindow(mouseEvt->GetOwnerWindow());

			menu->addEventListener(WSTR("command"), this, false);

			if (false)
			{
				menu->AddItem(new UI::TextString(WSTR("Display As Table")), 100);
			}
			else
			{
				Type* pType = m_pProperty->get_method->m_decl->m_pType->GetFunction()->m_pReturnType;

				if (pType->get_Kind() == type_pointer && pType->GetPointerTo()->get_Kind() == type_class)
				{
					vector<ClassType*> list;
					GetDerived(pType->GetPointerTo()->GetClass(), list);

					for (int i = 0; i < list.GetSize(); i++)
					{
						ClassType* pDerived = list[i];
						if (pDerived->m_derived.GetSize() == 0)
						{
							menu->AddItem(new UI::TextString(pDerived->get_Name()->ToStringW()), (long)pDerived);
						}
					}
				}
			}

			menu->GetMenuPopup()->Popup(menu, LDraw::PointI(mouseEvt->get_ScreenX(), mouseEvt->get_ScreenY()));
		}
		else if (*evt->get_type() == L"command")
		{
			if (false)
			{
				m_bDisplayAsTable = !m_bDisplayAsTable;
			}
			else
			{
				evt->stopPropagation();
				UI::CommandInvokeEvent* cmdEvt = dynamic_cast<UI::CommandInvokeEvent*>(evt);

				long param = cmdEvt->get_Command();
				ClassType* pDerivedType = (ClassType*)param;

				void* p = newobj(pDerivedType);
				if (p)
				{
					Type* pType = m_pProperty->set_method->m_decl->m_pType->GetFunction()->m_parameters.m_parameters[0].m_pType;
					pType = pType->GetStripped();
					void* value = DynamicCast(p, pDerivedType, pType->GetPointerTo()->GetClass());

					ASSERT(0);
					void *_this = NULL;//__RTDynamicCast(m_itemVisual, 0, (void*)&typeid(m_itemVisual), (void*)m_pProperty->set_method->GetTypeInfo(), 0);

				//	StringA str_type = pType->ToString();

					ULONG_PTR func;
					if (m_pProperty->set_method->m_decl->m_offset != -1)
					{
						void* vtable = *(void**)_this;
						func = *(ULONG_PTR*)((uint8*)vtable + m_pProperty->set_method->m_decl->m_offset);
					}
					else
					{
						func = m_pProperty->set_method->m_func;
					}

					__asm
					{
						push ecx
						mov ecx,_this
						push value
						call func
						pop ecx
					}
				}
			}
		}

#if 0
		void *_this = __RTDynamicCast(m_itemVisual, 0, (void*)&typeid(m_itemVisual), (void*)put_type_info(), 0);

		cpp::Type* pType = put_decl->m_pType->m_pFunction->m_parameters[0]->m_pType;
		StringA str_type = pType->toString();
		pType = pType->GetType();

		DWORD func;
//.........这里部分代码省略.........
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:101,代码来源:Properties.cpp


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