/// <summary>helper to determine if the string is mapped as a normal primitive value or as boxed value type</summary> private bool MapStringAsValueType(ref AttributeExtCollection modifiedAttributes) { Attribute mapAsWStringValueAttr; modifiedAttributes = modifiedAttributes.RemoveAttributeOfType(ReflectionHelper.StringValueAttributeType, out mapAsWStringValueAttr); return mapAsWStringValueAttr != null; }
/// <summary> /// call the appropriate mapping action, if the CLS type is System.Object /// </summary> /// <returns> /// an optional result of the mapping, some implementation of MappingAction will return null here /// </returns> private object CallActionForDNObject(ref Type clsType, ref AttributeExtCollection modifiedAttributes, MappingAction action) { // distinguis the different cases here Attribute typeAttr; modifiedAttributes = modifiedAttributes.RemoveAttributeOfType(s_objectIdlTypeAttrType, out typeAttr); IdlTypeObject oType = IdlTypeObject.Any; if (typeAttr != null) { oType = ((ObjectIdlTypeAttribute)typeAttr).IdlType; } switch (oType) { case IdlTypeObject.Any: return action.MapToIdlAny(clsType); case IdlTypeObject.AbstractBase: return action.MapToAbstractBase(clsType); case IdlTypeObject.ValueBase: return action.MapToValueBase(clsType); default: // unknown object attribute value: oType throw new MARSHAL(18807, CompletionStatus.Completed_MayBe); } }
/// <summary> /// helper for string/char mapping; removes the wchar attribute if present /// </summary> private bool UseWideOk(ref AttributeExtCollection modifiedAttributes) { bool useWide = MappingConfiguration.Instance.UseWideCharByDefault; Attribute wideAttr; modifiedAttributes = modifiedAttributes.RemoveAttributeOfType(ReflectionHelper.WideCharAttributeType, out wideAttr); if (wideAttr != null) { useWide = ((WideCharAttribute)wideAttr).IsAllowed; } return useWide; }