Example #1
0
bool IsTypeCompatible(VarType dest, VarType from, bool& FtoIwarning)
{
	bool ret = false;
	bool destIsI = false;
	FtoIwarning = false;

	if (dest == VarType::kBoolean && from == VarType::kBoolean)
		return true;

	if (dest == VarType::kExternType && from == VarType::kExternType)
		return true;

	switch (dest) {
	case kInt:
	case kInt2:
	case kInt3:
	case kInt4:
	case kInt8:
		destIsI = true;
	case kFloat:
	case kFloat2:
	case kFloat3:
	case kFloat4:
	case kFloat8:
		ret = TypeElementCnt(dest) <= TypeElementCnt(from);
	}

	if (destIsI && !IsIntegerType(from))
		FtoIwarning = true;

	return ret;
}
Example #2
0
bool Property::Value::Get( bool& booleanValue ) const
{
  bool converted = false;
  if( mImpl && IsIntegerType( mImpl->type ) )
  {
    booleanValue = mImpl->integerValue;
    converted = true;
  }
  return converted;
}
bool asCDataType::IsSamePrimitiveBaseType(const asCDataType &dt) const
{
	if( !IsPrimitive() || !dt.IsPrimitive() ) return false;
	
	if( IsIntegerType()  && dt.IsIntegerType()  ) return true;
	if( IsUnsignedType() && dt.IsUnsignedType() ) return true;
	if( IsFloatType()    && dt.IsFloatType()    ) return true;
	if( IsDoubleType()   && dt.IsDoubleType()   ) return true;
	if( IsBooleanType()  && dt.IsBooleanType()  ) return true;
	if( IsFloatType()    && dt.IsDoubleType()   ) return true;
	if( IsDoubleType()   && dt.IsFloatType()    ) return true;

	return false;
}
Example #4
0
bool Property::Value::Get( int& integerValue ) const
{
  bool converted = false;
  if( mImpl )
  {
    if( IsIntegerType( mImpl->type ) )
    {
      integerValue = mImpl->integerValue;
      converted = true;
    }
    else if( mImpl->type == FLOAT )
    {
      integerValue = static_cast< int >( mImpl->floatValue );
      converted = true;
    }
  }
  return converted;
}