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


C++ Member::ProcessDeclaration方法代码示例

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


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

示例1: namespace_s

extern "C" __declspec( dllexport ) void DllMainEx(bool compiler)
{
	char executable[1025];
	DWORD size = GetModuleFileName(NULL, executable, 1024);
	executable[size] = 0; // xp patch

	size_t last = size;
	if(last)
		while(last > 0 && executable[last - 1] != '\\' && executable[last - 1] != '/') last--;
	char* executable_name = (char*)((size_t)executable + last);

	if(!Log) Log=(void (__cdecl *)(const char* frmt, ...))printf;
	ScopeInitializer<S_Global> init(&Global);

	/*	order of listing:
		- forward declarations of global types
		- global properties
		- class declarations
		- global functions
	*/

	// forward declarations of global types
	for(unsigned int i = 0, j = ASEngine->GetObjectTypeCount(); i < j; i++)
	{
		asIObjectType* obj = ASEngine->GetObjectTypeByIndex(i);
		bool is_template = obj->GetSubTypeId()>=0;
		Class* cl=  new Class();
		cl->BaseName = string(obj->GetName());
		if(is_template)
		{
			cl->Name = string("template <typename T> class ") + cl->BaseName;
			cl->BaseName += "<T>";
		}
		else
			cl->Name = string("class ") + cl->BaseName;
		Global->Classes.push_back(cl);
	}

	// global properties
	for(unsigned int i = 0, j = ASEngine->GetGlobalPropertyCount(); i<  j; i++)
	{
		const char* name;
		const char* namespace_;
		int type_id;
		bool is_const;
		const char* type_name;
		ASEngine->GetGlobalPropertyByIndex(i, &name, &namespace_, &type_id, &is_const);
		type_name = ASEngine->GetTypeDeclaration(type_id);
		string namespace_s(namespace_);
		string name_s(name);
		string type_name_s(type_name);
		Property* prop = new Property();
		prop->Name = name_s;
		prop->Namespace = namespace_s;
		prop->Type = type_name_s;
		Global->Properties.push_back(prop);
	}

	// class declarations
	for(int i =0 , j = ASEngine->GetObjectTypeCount(); i < j; i++)
	{
		// properties
		asIObjectType* obj = ASEngine->GetObjectTypeByIndex(i);
		bool is_template = obj->GetSubTypeId() >= 0;
		string class_name(obj->GetName());
		Class* cl = Global->Classes[i];
		for(unsigned int n = 0, m=obj->GetPropertyCount(); n < m; n++)
			cl->Properties.push_back(string(obj->GetPropertyDeclaration(n)));
		
		// methods
		for(unsigned int n = 0, m = obj->GetMethodCount(); n < m; n++)
		{
			asIScriptFunction* func = obj->GetMethodByIndex(n);
			string decl = func->GetDeclaration(false);
			Member* member = new Member();
			member->Declaration = decl;
			member->ProcessDeclaration();
			member->Name = func->GetName();
			member->Applied = false;
			cl->Members.push_back(member);

			// is the method an operator?
			if(Global->OperUnaryPost.count(member->Name))
				member->ParamCount = func->GetParamCount();
		}
	}

	// global functions
	for(int i = 0, j = ASEngine->GetGlobalFunctionCount(); i < j; i++)
	{
		asIScriptFunction* func = ASEngine->GetGlobalFunctionByIndex(i);
		Function* fn = new Function();
		fn->Declaration = func->GetDeclaration(false);
		fn->Name = func->GetName();
		fn->Applied = false;
		fn->ProcessDeclaration();
		Global->Functions.push_back(fn);
	}

	SubSystem sys = SysUnknown;
//.........这里部分代码省略.........
开发者ID:SnakeSolidNL,项目名称:tools,代码行数:101,代码来源:dllmain.cpp


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