public string GetParam(OdcmProperty type) { if (type.IsComplex()) { return(type.IsSystem() ? string.Empty : type.GetTypeString() + " *" + type.Name.ToLowerFirstChar()); } return(type.GetTypeString() + " " + type.Name); }
/// <summary> /// Adds a property line inside an entity or complex type object /// </summary> /// <param name="prop">property</param> private void AddProperties(OdcmProperty prop) { if (prop.LongDescription != null || prop.Description != null) { List <string> multiLineDescriptions = SplitString(prop.GetSanitizedLongDescription()); if (multiLineDescriptions.Count() == 1) { sb.AppendLine($"{NamespaceIndent}{TabSpace}// {multiLineDescriptions.First()}"); } else { sb.AppendLine($"{NamespaceIndent}{TabSpace}/**"); foreach (var descriptionLine in multiLineDescriptions) { sb.AppendLine($"{NamespaceIndent}{TabSpace} * {descriptionLine}"); } sb.AppendLine($"{NamespaceIndent}{TabSpace} */"); } } var typeName = GetFullyQualifiedTypeScriptTypeName(prop.GetTypeString(), prop.Projection.Type.Namespace.GetNamespaceName()); if (prop.IsNullable) { typeName = $"NullableOption<{typeName}>"; } sb.AppendLine($"{NamespaceIndent}{TabSpace}{prop.Name}?: {typeName};"); }
public static string GetFullType(this OdcmProperty property) { string result; if (property.IsCollection) { result = !property.IsSystem() && property.GetTypeString() != "NSData" ? string.Format("NSMutableArray<{0}>", property.GetTypeString()) : "NSMutableArray"; } else { result = property.GetTypeString(); } return(result); }
public static bool IsByteArray(this OdcmProperty property) { var t = property.GetTypeString(); return(t == "byte[]"); }
public string GetClass(OdcmProperty type) { return(type.IsComplex() ? string.Format("[{0}{1} class]", GetPrefix(), type.GetTypeString()) : "nil"); }
public static bool IsComplex(this OdcmProperty property) { string t = property.GetTypeString(); return(!(t == "int" || t == "BOOL" || t == "Byte")); }
public static bool IsSystem(this OdcmProperty property) { string t = property.GetTypeString(); return(t == "int" || t == "BOOL" || t == "Byte" || t == "NSString" || t == "NSDate"); }