Inheritance: SlimDX.Generator.FunctionModel
Exemplo n.º 1
0
        /// <summary>
        /// Parses interface method model definitions within a JSON tree.
        /// </summary>
        /// <param name="root">The root of the JSON tree for the interface.</param>
        /// <param name="api">The API model being constructed.</param>
        /// <returns>A list of interface method models.</returns>
        static List<MethodModel> ParseInterfaceMethods(JObject root, ApiModel api)
        {
            var results = new List<MethodModel>();

            JToken items;
            if (root.TryGetValue("methods", out items))
            {
                foreach (var item in items)
                {
                    var key = (string)item["key"];
                    var type = api.FindType((string)item["type"]);
                    var index = int.Parse(item["index"].Value<string>());
                    var model = new MethodModel(api, key, type, index);
                    foreach (var parameter in ParseFunctionParameters(item as JObject, api))
                        model.AddParameter(parameter);

                    results.Add(model);
                }
            }

            return results;
        }
Exemplo n.º 2
0
 public void AddMethod(MethodModel model)
 {
     if (model == null)
         throw new ArgumentNullException("model");
     methods.Add(model);
 }