Exemplo n.º 1
0
        public void ParameterMapping(SpecPrototype prototype, string commandName,
                                     ref string name, out string attribute, out string type)
        {
            attribute = null;
            type      = null;
            foreach (var map in parameterNameMaps)
            {
                if (map is MapParam)
                {
                    MapParam param = (MapParam)map;
                    if (param.CommandTargetRegex == null ||
                        param.CommandTargetRegex.IsMatch(commandName) &&
                        param.IsMatch(prototype.Declaration.Name))
                    {
                        name = param.Replace(name);

                        if (!string.IsNullOrEmpty(param.Attribute))
                        {
                            attribute = param.Attribute;
                        }
                        if (!string.IsNullOrEmpty(param.Type))
                        {
                            type = param.Type;
                        }
                    }
                }
                else
                {
                    name = map.Replace(name);
                }
            }
        }
Exemplo n.º 2
0
        public string TypeMapping(SpecPrototype prototype)
        {
            string returnType;

            if (prototype.Declaration.Pointers > 0)
            {
                returnType = "IntPtr";
            }
            //else if ( prototype.EnumGroup != null && groups.ContainsKey ( prototype.EnumGroup ) )
            //{
            //	returnType = prototype.EnumGroup;
            //}
            else
            {
                returnType = prototype.Declaration.Type;
                if (!string.IsNullOrWhiteSpace(returnType))
                {
                    foreach (var map in typeMaps)
                    {
                        returnType = map.Replace(returnType, map.Type);
                    }
                    if (returnType == prototype.Declaration.Type)
                    {
                        Console.WriteLine("Type mapping not found! " + returnType);
                    }
                }
                else
                {
                    returnType = "void";
                }
            }
            return(returnType);
        }
Exemplo n.º 3
0
        public void CommandMapping(SpecPrototype prototype, ref string name, out string returnType)
        {
            returnType = null;
            foreach (var map in commandNameMaps)
            {
                if (map.IsMatch(prototype.Declaration.Name))
                {
                    name = map.Replace(name);

                    var cmdMap = map as MapCommand;
                    if (cmdMap != null && !string.IsNullOrEmpty(cmdMap.Type))
                    {
                        returnType = cmdMap.Type;
                    }
                }
            }
        }