Пример #1
0
        public string GetType(OdcmType type)
        {
            if (type.IsComplex())
            {
                return(type.IsSystem() ? type.GetTypeString() : type.GetTypeString() + " *");
            }

            return(type.GetTypeString());
        }
Пример #2
0
 public string GetParamString(OdcmType p)
 {
     p.GetFullType();
     //if(p == null) return string.Empty;
     if (p.IsComplex())
     {
         return(p.IsSystem() ? string.Empty : p.GetTypeString() + " *" + p.Name.ToLowerFirstChar());
     }
     return(p.GetTypeString() + " " + p.Name);
 }
Пример #3
0
        public static string GetNSNumberValueMethod(this OdcmType type)
        {
            string objectiveCType = type.GetTypeString();

            if (objectiveCType.Equals("int32_t") || objectiveCType.Equals("int16_t"))
            {
                return("intValue");
            }
            if (objectiveCType.Equals("int64_t"))
            {
                return("longLongValue");
            }
            else if (objectiveCType.Equals("BOOL"))
            {
                return("boolValue");
            }
            else if (objectiveCType.Equals("double"))
            {
                return("floatValue");
            }
            else if (type is OdcmEnum)
            {
                return("intValue");
            }

            return(null);
        }
        /// <summary>
        /// Determines whether the type needs fully qualified name or simple type name in the given namespace context
        /// </summary>
        /// <param name="type">type</param>
        /// <param name="namespaceContext">namespace where type is referenced</param>
        /// <param name="format">a generated type format, such as I{0}RequestBuilder</param>
        /// <returns>Either the fully qualified or plain type name</returns>
        public static string GetTypeString(this OdcmType type, string namespaceContext, string format = null)
        {
            var typesNamespace  = type.Namespace.GetNamespaceName().Replace("edm.", "");
            var plainTypeString = type.GetTypeString();

            // refer to core implementation when they are available for Edm types
            var coreModelTypes = new List <string> {
                "Date", "Duration", "TimeOfDay"
            };

            if (typesNamespace == "Edm" && coreModelTypes.Contains(plainTypeString))
            {
                typesNamespace = "Microsoft.Graph";
            }

            if (format != null)
            {
                plainTypeString = string.Format(format, plainTypeString);
            }

            if (string.Equals(typesNamespace, namespaceContext, StringComparison.OrdinalIgnoreCase) ||
                typesNamespace == "Edm")
            {
                return(plainTypeString);
            }
            else
            {
                return(typesNamespace + "." + plainTypeString);
            }
        }
        public static bool IsComplex(this OdcmType type)
        {
            string t = type.GetTypeString();

            return(!(t == "int" || t == "UUID" || t == "datetime" ||
                     t == "bool" || t == "string" || "bytes" == t ||
                     t == "float"));
        }
Пример #6
0
        public static bool IsComplex(this OdcmType type)
        {
            string t = type.GetTypeString();

            return(t.IsComplex());
        }
Пример #7
0
        public static bool IsTypeNullable(this OdcmType type)
        {
            var t = type.GetTypeString();

            return(type is OdcmClass || t == "Date" || t == "Stream" || t == "string" || t == "byte[]");
        }
        public static bool IsComplex(this OdcmType type)
        {
            string t = type.GetTypeString();

            return(!(t == "int" || t == "BOOL" || t == "Byte"));
        }
        public static bool IsSystem(this OdcmType type)
        {
            string t = type.GetTypeString();

            return(t == "int" || t == "BOOL" || t == "Byte" || t == "NSString" || t == "NSDate");
        }
 public static string GetFullType(this OdcmType type)
 {
     return(type.GetTypeString());
 }