Beispiel #1
0
bool asCDataType::CanBeInstantiated() const
{
    if( GetSizeOnStackDWords() == 0 ) // Void
        return false;

    if( !IsObject() && !IsFuncdef() ) // Primitives
        return true;

    if (IsNullHandle()) // null
        return false;

    if( IsObjectHandle() && !(typeInfo->flags & asOBJ_NOHANDLE) ) // Handles
        return true;

    // Funcdefs cannot be instantiated without being handles
    // The exception being delegates, but these can only be created as temporary objects
    if (IsFuncdef())
        return false;

    asCObjectType *ot = typeInfo->CastToObjectType();
    if( ot && (ot->flags & asOBJ_REF) && ot->beh.factories.GetLength() == 0 ) // ref types without factories
        return false;

    if( ot && (ot->flags & asOBJ_ABSTRACT) && !IsObjectHandle() ) // Can't instantiate abstract classes
        return false;

    return true;
}
Beispiel #2
0
bool asCDataType::IsObjectConst() const
{
    if( IsObjectHandle() )
        return IsHandleToConst();

    return IsReadOnly();
}
bool asCDataType::CanBeInstanciated() const
{
	if( GetSizeOnStackDWords() == 0 ||
		(IsObject() && 
		 (objectType->flags & asOBJ_REF) &&        // It's a ref type and
		 ((objectType->flags & asOBJ_NOHANDLE) ||  // the ref type doesn't support handles or
		  (!IsObjectHandle() &&                    // it's not a handle and
		   objectType->beh.factories.GetLength() == 0))) ) // the ref type cannot be instanciated
		return false;

	// An ASHANDLE type can only be declared as a handle, even though it is a value type
	if( IsObject() && (objectType->flags & asOBJ_ASHANDLE) && !IsObjectHandle() )
		return false;

	return true;
}
Beispiel #4
0
bool asCDataType::CanBeInstantiated() const
{
	if( GetSizeOnStackDWords() == 0 ) // Void
		return false;

	if( !IsObject() ) // Primitives
		return true;

	if( IsObjectHandle() && !(objectType->flags & asOBJ_NOHANDLE) ) // Handles
		return true;

	if( funcDef ) // Funcdefs can be instantiated as delegates
		 return true;

	if( (objectType->flags & asOBJ_REF) && objectType->beh.factories.GetLength() == 0 ) // ref types without factories
		return false;

	if( (objectType->flags & asOBJ_ABSTRACT) && !IsObjectHandle() ) // Can't instantiate abstract classes
		return false;

	return true;
}