示例#1
0
bool ExtBuiltinCallback::getResult(const ExtScriptObject& so, ExtVariant** _result)
{
	// Set the result
	*_result = result;
	// Did the callback throw an AS exception?
	if(exceptionThrown)
	{
		so.setException(exception.raw_buf());
		LOG(LOG_ERROR, "ASObject exception caught in external callback");
		return false;
	}
	return success;
}
示例#2
0
bool ExtASCallback::getResult(const ExtScriptObject& so, ExtVariant** _result)
{
	// syncEvent should be not-NULL since call() should have set it
	if(syncEvent == NULL)
		return false;

	// We've no use for syncEvent anymore
	syncEvent->decRef();
	// Clean up pointers
	syncEvent = NULL;
	funcEvent = NULL;
	// Did the callback throw an AS exception?
	if(exception != NULL)
	{
		if(result != NULL)
			result->decRef();

		// Pass on the exception to the container through the script object
		so.setException(exception->toString().raw_buf());
		exception->decRef();
		LOG(LOG_ERROR, "ASObject exception caught in external callback");
		success = false;
	}
	// Did the callback return a non-NULL result?
	else if(result != NULL)
	{
		// Convert the result
		*_result = new ExtVariant(result);
		result->decRef();
		success = true;
	}
	// No exception but also not result, still a success
	else
		success = true;

	// Clean up pointers
	result = NULL;
	exception = NULL;
	return success;
}
示例#3
0
bool ExtASCallback::getResult(const ExtScriptObject& so, ExtVariant** _result)
{
	funcEvent = NullRef;
	// Did the callback throw an AS exception?
	if(exceptionThrown)
	{
		if(result != NULL)
			delete result;

		// Pass on the exception to the container through the script object
		so.setException(exception.raw_buf());
		LOG(LOG_ERROR, "ASObject exception caught in external callback");
		success = false;
	}
	// There was an error executing the function
	else if(!funcWasCalled)
	{
		success = false;
	}
	// Did the callback return a non-NULL result?
	else if(result != NULL)
	{
		// Convert the result
		*_result = result;
		success = true;
	}
	// No exception but also no result, still a success
	else
		success = true;

	// Clean up pointers
	result = NULL;
	exceptionThrown = false;
	exception = "";
	return success;
}