Пример #1
0
template<class dt_content, bool GOTFUNC_EQUALS = 1, bool GOTFUNC_LESS = 1, bool GOTFUNC_HASH = 1> void aatc_register_container_tempspec_unordered_set(asIScriptEngine* engine, const char* n_content){
	typedef aatc_container_unordered_set_tempspec<dt_content> dt_container;

	int r = 0;
	char textbuf[1000];

	char n_containerTcontentT[1000];
	char n_iterator[1000];
	sprintf_s(n_containerTcontentT, 1000, "%s<%s>", aatc_name_script_container_unordered_set, n_content);
	sprintf_s(n_iterator, 1000, "%s%s<%s>", aatc_name_script_container_unordered_set, aatc_name_script_iterator, n_content);

	dt_container::staticname_container = aatc_name_script_container_unordered_set;
	dt_container::staticname_content = n_content;

	aatc_container_shared_1tp_tempspec_Register<dt_container, dt_content, GOTFUNC_EQUALS, GOTFUNC_LESS, GOTFUNC_HASH,
		aatc_container_unordered_set_needfunc_BACK_WRITE,
		aatc_container_unordered_set_needfunc_BACK_READ,
		aatc_container_unordered_set_needfunc_FRONT_WRITE,
		aatc_container_unordered_set_needfunc_FRONT_READ,
		aatc_container_unordered_set_needfunc_ERASE_POSITION,
		aatc_container_unordered_set_needfunc_ERASE_VALUE,
		aatc_container_unordered_set_needfunc_OP_INDEX,
		aatc_container_unordered_set_needfunc_RESERVE,
		aatc_container_unordered_set_needfunc_INSERT,
		aatc_container_unordered_set_needfunc_SORT_NATIVE,
		aatc_container_unordered_set_needfunc_SORT_GENERIC,
		aatc_container_unordered_set_needfunc_CONTAINS_NATIVE>
	(engine, aatc_name_script_container_unordered_set, n_content);

	aect_iterator_shared_tempspec<dt_container, dt_content>::Register<aatc_N, aatc_Y>(engine, n_iterator, n_content, n_containerTcontentT);

	sprintf_s(textbuf, 1000, "%s begin()", n_iterator, n_content);
	r = engine->RegisterObjectMethod(n_containerTcontentT, textbuf, asFunctionPtr(aatc_reghelp_construct_hosted<aect_iterator_shared_tempspec<dt_container, dt_content>, dt_container*>), asCALL_CDECL_OBJLAST); assert(r >= 0);
}
Пример #2
0
	void ApiRegistrar::RegisterFunction( const Function& descriptor ) {
		const auto	scriptThunk( [] ( asIScriptGeneric* generic ) {
			VirtualMachineContext	context( *generic );
			reinterpret_cast<NativeFunction*>(generic->GetAuxiliary())( context );
		} );

		_declarationFormatter.RenderDeclaration( _declaration, descriptor );

		const auto	registerResult( _scriptEngine.RegisterGlobalFunction( _declaration, asFunctionPtr( asGENFUNC_t( scriptThunk ) ), asECallConvTypes::asCALL_GENERIC, descriptor.nativeFunction ) );

		ETRuntimeAssert( asERetCodes::asSUCCESS <= registerResult );

	//	Clear out the declaration string for the next invocation.
		_declaration.Clear();
	}
Пример #3
0
	void ApiRegistrar::RegisterBehavior( const asITypeInfo& type, asEBehaviours behavior, const Method& method ) {
		const auto scriptThunk( [] ( asIScriptGeneric* generic ) {
			VirtualMachineContext	context( *generic );
			reinterpret_cast<NativeFunction*>(generic->GetAuxiliary())( context );
		} );

		_declarationFormatter.RenderDeclaration( _declaration, method );

		const auto	registerResult( _scriptEngine.RegisterObjectBehaviour( type.GetName(), behavior, _declaration, asFunctionPtr( asGENFUNC_t( scriptThunk ) ), asECallConvTypes::asCALL_GENERIC, method.nativeFunction ) );

		ETRuntimeAssert( asERetCodes::asSUCCESS <= registerResult );

	//	Clear out the declaration string for the next invocation.
		_declaration.Clear();
	}