예제 #1
0
파일: Function.cpp 프로젝트: MattPD/poco
bool Function::isVirtual() const
{
	if (_flags & FN_VIRTUAL)
	{
		return true;
	}
	else if (isDestructor())
	{
		Struct* pClass = dynamic_cast<Struct*>(nameSpace());
		return pClass && pClass->hasVirtualDestructor();
	}
	else return getOverridden() != 0;
	return false;
}
예제 #2
0
파일: methodcall.cpp 프로젝트: KDE/qyoto
void MethodCall::callMethod()
{
	if (_called) return;
	_called = true;
	Smoke::ClassFn fn = _smoke->classes[method().classId].classFn;
	void *ptr = 0;

	if (_o != 0 && _o->ptr != 0) {
		const Smoke::Class &cl = _smoke->classes[method().classId];

		ptr = _o->smoke->cast(	_o->ptr,
								_o->classId,
								_o->smoke->idClass(cl.className, true).index );
	}
	_items = -1;
	
	/*
	 * special case the QApplication/QCoreApplication constructor call
	 * the int reference has to stay valid all the time, so create an additional pointer here
	 */
	if (isConstructor() && (   strcmp(_smoke->methodNames[method().name], "QApplication") == 0
				|| strcmp(_smoke->methodNames[method().name], "QCoreApplication") == 0)) {
		int* i = new int(_sp[1].s_int);
		_stack[1].s_voidp = i;
	}
	
	(*fn)(method().method, ptr, _stack);
	
	if (isConstructor()) {
		Smoke::StackItem _s[2];
		_s[1].s_class = qyoto_modules[_smoke].binding;
		fn(0, _stack[0].s_voidp, _s);
		_o = alloc_smokeqyoto_object(true, _smoke, method().classId, _stack[0].s_voidp);
		(*SetSmokeObject)(_target, _o);
		mapPointer(_target, _o, _o->classId, 0);
	} else if (isDestructor()) {
		void *check = (*GetSmokeObject)(_target);
		if (check) {
			unmapPointer(_o, _o->classId, 0);
			(*SetSmokeObject)(_target, 0);
			free_smokeqyoto_object(_o);
		}
	} else {
		Qyoto::MethodReturnValue r(_smoke, _method, _stack, _retval);
	}
}
예제 #3
0
파일: methodcall.cpp 프로젝트: KDE/qyoto
MethodCall::MethodCall(Smoke *smoke, Smoke::Index method, void * target, Smoke::Stack sp, int items) :
	_cur(-1), _smoke(smoke), _method(method), _target(target), _o(0), _sp(sp), _items(items), _called(false)
{
	if (!isConstructor() && !isStatic()) {
		_o = (smokeqyoto_object*) (*GetSmokeObject)(_target);
		if (_o != 0 && _o->ptr != 0) {
			if (	isDestructor() 
					&& (!_o->allocated || IsContainedInstance(_o)
					    || _o->smoke->isDerivedFrom(_o->smoke->className(_o->classId), "QCoreApplication")) )
			{
				_called = true;
			}
		} else {
			// not a constructor, not static, pointer invalid -> object already destroyed
			_called = true;
		}
	}

	_args = _smoke->argumentList + _smoke->methods[_method].args;
	_items = _smoke->methods[_method].numArgs;
	numItems = items;
	_stack = new Smoke::StackItem[items + 1];
	_retval = _sp;
}
예제 #4
0
파일: Function.cpp 프로젝트: MattPD/poco
bool Function::isMethod() const
{
	return !isConstructor() && !isDestructor() && nameSpace()->kind() == Symbol::SYM_STRUCT;
}