当前位置: 首页>>代码示例>>C#>>正文


C# MappingAction.MapToIdlBoxedValueType方法代码示例

本文整理汇总了C#中MappingAction.MapToIdlBoxedValueType方法的典型用法代码示例。如果您正苦于以下问题:C# MappingAction.MapToIdlBoxedValueType方法的具体用法?C# MappingAction.MapToIdlBoxedValueType怎么用?C# MappingAction.MapToIdlBoxedValueType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MappingAction的用法示例。


在下文中一共展示了MappingAction.MapToIdlBoxedValueType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CallActionForDNArray

 /// <summary>
 /// call the appropriate mapping action for a CLSType array
 /// </summary>
 private object CallActionForDNArray(ref Type clsType,
                                     ref AttributeExtCollection modifiedAttributes, 
                                     AttributeExtCollection allAttributes,                                            
                                     MappingAction action) {
     // distinguish the different cases here
     Attribute idlMappingAttr = modifiedAttributes.GetHighestOrderAttribute();
     if (idlMappingAttr is IdlSequenceAttribute) {
         modifiedAttributes = modifiedAttributes.RemoveAttribute(idlMappingAttr);
         int bound = (int)
             ((IdlSequenceAttribute)idlMappingAttr).Bound;
         return action.MapToIdlSequence(clsType, bound, allAttributes, modifiedAttributes);
     } else if (idlMappingAttr is IdlArrayAttribute) {
         IdlArrayAttribute arrayAttr = (IdlArrayAttribute)idlMappingAttr;
         modifiedAttributes = modifiedAttributes.RemoveAttribute(idlMappingAttr);
         int[] dimensions = DetermineIdlArrayDimensions(clsType, arrayAttr, ref modifiedAttributes);
         return action.MapToIdlArray(clsType, dimensions, allAttributes, modifiedAttributes);
     } else {
         Type boxed = GetBoxedArrayType(clsType);
         Type needsBoxingFrom = clsType;
         clsType = boxed; // transform
         return action.MapToIdlBoxedValueType(boxed, needsBoxingFrom);
     }
 }
开发者ID:JnS-Software-LLC,项目名称:iiop-net,代码行数:26,代码来源:ClsToIDLMapper.cs

示例2: MapClsTypeWithTransform


//.........这里部分代码省略.........
                    mapType = MapType.Interface;
                } else if (IsMarshalByRef(clsType)) {
                    mapType = MapType.MarshalByRef;
                } else if (IsMappablePrimitiveType(clsType)) {
                    mapType = MapType.Primitive;
                } else if (IsEnum(clsType)) { 
                    if (HasEnumFlagsAttributes(clsType)) {
                        mapType = MapType.Flags;
                    } else {
                        // enums with more than Int32.MaxValue elements can't be mapped to idl.
                        // but not possibly to check this, because in .NET 1.0, no support for Array.LongLength.
                        mapType = MapType.Enum;
                    }
                } else if (IsArray(clsType)) { 
                    mapType = MapType.Array;
                } else if (clsType.IsSubclassOf(ReflectionHelper.BoxedValueBaseType)) {
                    // a boxed value type, which needs not to be boxed/unboxed but should be handled like a normal value type
                    mapType = MapType.BoxedValue2;
                } else if (clsType.IsSubclassOf(s_exceptType) || clsType.Equals(s_exceptType)) {
                    mapType = MapType.Exception;
                } else if (IsMarshalledAsStruct(clsType)) {
                     mapType = MapType.Struct;
                } else if (IsMarshalledAsUnion(clsType)) {
                    mapType = MapType.Union;
                } else if (clsType.Equals(ReflectionHelper.ObjectType)) {
                    mapType = MapType.Object;
                } else if (clsType.Equals(s_anyType)) {
                    mapType = MapType.Any;
                } else if (clsType.Equals(ReflectionHelper.TypeType) || clsType.IsSubclassOf(ReflectionHelper.TypeType)) {
                    mapType = MapType.TypeDesc;
                } else if (clsType.Equals(s_corbaTypeCodeImplType) || clsType.IsSubclassOf(s_corbaTypeCodeImplType) ||
                           clsType.Equals(ReflectionHelper.CorbaTypeCodeType)) {
                    mapType = MapType.TypeCode;
                } else if (!UnmappableType(clsType)) {
                    if (IsValueTypeConcrete(clsType)) {
                        mapType = MapType.ConcreteValue;
                    } else {
                        // other types are mapped to an abstract value type
                        mapType = MapType.AbstractValue;
                    }
                } else {
                    // not mappable: clsType
                    mapType = MapType.Unmappable;
                }
                
                lock(mapTypes)
                    mapTypes[key] = mapType;
            }
            
            switch(mapType)
            {
                case MapType.BoxedValueNotFound:
                    Trace.WriteLine("boxed type not found for boxed value attribute"); 
                    throw new NO_IMPLEMENT(10001, CompletionStatus.Completed_MayBe);
                case MapType.BoxedValue:
                    Type boxed = GetBoxedValueType((BoxedValueAttribute)boxedValAttr);
                    Type needsBoxingFrom = clsType;
                    clsType = boxed; // transformation
                    return action.MapToIdlBoxedValueType(boxed, needsBoxingFrom);
                case MapType.Interface:
                    return CallActionForDNInterface(ref clsType, action);
                case MapType.MarshalByRef:
                    return action.MapToIdlConcreteInterface(clsType);
                case MapType.Primitive:
                    return CallActionForDNPrimitveType(ref clsType, ref attributes, action);
                case MapType.Flags:
                    return action.MapToIdlFlagsEquivalent(clsType);
                case MapType.Enum:
                    // enums with more than Int32.MaxValue elements can't be mapped to idl.
                    // but not possibly to check this, because in .NET 1.0, no support for Array.LongLength.
                    return action.MapToIdlEnum(clsType);
                case MapType.Array:
                    return CallActionForDNArray(ref clsType, ref attributes, originalAttributes, action);
                case MapType.BoxedValue2:
                    // a boxed value type, which needs not to be boxed/unboxed but should be handled like a normal value type
                    return action.MapToIdlBoxedValueType(clsType, null);
                case MapType.Exception:
                    return action.MapException(clsType);
                case MapType.Struct:
                     return action.MapToIdlStruct(clsType);
                case MapType.Union:
                    return action.MapToIdlUnion(clsType);
                case MapType.Object:
                    return CallActionForDNObject(ref clsType, ref attributes, action);
                case MapType.Any:
                    return action.MapToIdlAny(clsType);
                case MapType.TypeDesc:
                    return action.MapToTypeDesc(clsType);
                case MapType.TypeCode:
                    return action.MapToTypeCode(clsType);
                case MapType.ConcreteValue:
                    return action.MapToIdlConcreateValueType(clsType);
                case MapType.AbstractValue:
                    // other types are mapped to an abstract value type
                    return action.MapToIdlAbstractValueType(clsType);                   
            }
            // not mappable: clsType
            throw new BAD_PARAM(18800, CompletionStatus.Completed_MayBe, "The type " + clsType.AssemblyQualifiedName +
                               " is not mappable to idl");
        }
开发者ID:JnS-Software-LLC,项目名称:iiop-net,代码行数:101,代码来源:ClsToIDLMapper.cs


注:本文中的MappingAction.MapToIdlBoxedValueType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。