protected IEnumerable <ProcessedProperty> PostProcessSubscriptProperties(IEnumerable <PropertyInfo> properties) { foreach (PropertyInfo property in properties) { ProcessedProperty processedProperty = new ProcessedProperty(property, this); yield return(processedProperty); } }
void ProcessPotentialName(ProcessedProperty processedProperty) { string getSignature = processedProperty.HasGetter ? processedProperty.GetMethod.ObjCSignature : ""; string setSignature = processedProperty.HasSetter ? processedProperty.SetMethod.ObjCSignature : ""; if (RestrictedObjSelectors.IsImportantSelector(getSignature) || RestrictedObjSelectors.IsImportantSelector(setSignature)) { string newName = "managed" + processedProperty.Name.PascalCase(); Delayed.Add(ErrorHelper.CreateWarning(1051, $"Element {processedProperty.Name} is generated instead as {newName} because its name conflicts with an important objective-c selector.")); processedProperty.NameOverride = newName; } }
protected void GenerateSubscript(ProcessedProperty property) { PropertyInfo pi = property.Property; bool hasRead = pi.GetGetMethod() != null; bool hasWrite = pi.GetSetMethod() != null; Type indexType = hasWrite ? pi.GetSetMethod().GetParameters()[0].ParameterType : pi.GetGetMethod().ReturnType; Type paramType = pi.PropertyType; switch (Type.GetTypeCode(indexType)) { case TypeCode.Byte: case TypeCode.SByte: case TypeCode.UInt16: case TypeCode.UInt32: case TypeCode.UInt64: case TypeCode.Int16: case TypeCode.Int32: case TypeCode.Int64: if (hasRead) { GenerateIndexedSubscriptingRead(indexType, paramType); } if (hasWrite) { GenerateIndexedSubscriptingWrite(indexType, paramType); } return; default: if (hasRead) { GenerateKeyedSubscriptingRead(indexType, paramType); } if (hasWrite) { GenerateKeyedSubscriptingWrite(indexType, paramType); } return; } }
protected abstract void Generate(ProcessedProperty property);