コード例 #1
0
 /// <summary>determines the mapping for primitive types</summary>
 private object CallActionForDNPrimitveType(ref Type clsType, ref AttributeExtCollection modifiedAttributes, MappingAction action) {
     if (clsType.Equals(ReflectionHelper.Int16Type)) {
         return action.MapToIdlShort(clsType);
     } else if (clsType.Equals(ReflectionHelper.Int32Type)) {
         return action.MapToIdlLong(clsType);
     } else if (clsType.Equals(ReflectionHelper.Int64Type)) {
         return action.MapToIdlLongLong(clsType);
     } else if (clsType.Equals(ReflectionHelper.BooleanType)) {
         return action.MapToIdlBoolean(clsType);
     } else if (clsType.Equals(ReflectionHelper.ByteType)) {
         return action.MapToIdlOctet(clsType);
     } else if (clsType.Equals(ReflectionHelper.StringType)) {
         // distinguish cases
         return CallActionForDNString(ref clsType, ref modifiedAttributes, action);
     } else if (clsType.Equals(ReflectionHelper.CharType)) {
         // distinguish cases
         bool useWide = UseWideOk(ref modifiedAttributes);
         if (useWide) {
             return action.MapToIdlWChar(clsType);
         } else {
             return action.MapToIdlChar(clsType);
         }
     } else if (clsType.Equals(ReflectionHelper.DoubleType)) {
         return action.MapToIdlDouble(clsType);
     } else if (clsType.Equals(ReflectionHelper.SingleType)) {
         return action.MapToIdlFloat(clsType);
     } else if (clsType.Equals(ReflectionHelper.UInt16Type)) {
         return action.MapToIdlUShort(clsType);
     } else if (clsType.Equals(ReflectionHelper.UInt32Type)) {
         return action.MapToIdlULong(clsType);
     } else if (clsType.Equals(ReflectionHelper.UInt64Type)) {
         return action.MapToIdlULongLong(clsType);
     } else if (clsType.Equals(ReflectionHelper.SByteType)) {
         return action.MapToIdlSByteEquivalent(clsType);
     } else if (clsType.Equals(ReflectionHelper.VoidType)) {
         return action.MapToIdlVoid(clsType);
     } else {
         // not mappable as primitive type: clsType
         throw new INTERNAL(18801, CompletionStatus.Completed_MayBe);
     }
 }