Example #1
0
        static void Main(string[] args)
        {
            DateTime beginTime = DateTime.Now;
            Console.Write("Starting ... " + beginTime + "\n");

            bool debug = false;

            SrcMap data = new SrcMap();
            CppLexParser parser = new CppLexParser();

            string output = args[0];

            for (int i = 1; i < args.Length; i++)
            {
                foreach (var file in Directory.EnumerateFiles(args[i], "*.*", SearchOption.AllDirectories))
                {
                    if (file.EndsWith(".h"))
                    {
                        SourceFile header = new SourceFile();
                        header.location = file;
                        header.data = File.ReadAllText(file);
                        data.headers.Add(header);
                    }
                    else if (file.EndsWith(".cpp"))
                    {
                        SourceFile header = new SourceFile();
                        header.location = file;
                        header.data = File.ReadAllText(file);
                        data.sources.Add(header);
                    }
                }
            }

            parser.Parse(data);

            Console.Write("Parsing done\n");

            if (debug)
            {
                foreach (var cls in data.allClasses)
                {
                    Console.Write("class: " + cls.name + ": ");
                    cls.baseClasses.ForEach(x => Console.Write(x.type + " " + x.className + " (" + (x.lexClass != null).ToString() + ")"));
                    if (cls.isTemplate)
                        Console.Write(" TEMPLATE!!!");
                    Console.Write("\n");
                }

            // 				var iobjectClass = data.allClasses.Find(x => x.name == "o2::IObject");
            // 				var reflectableClasses = data.allClasses.FindAll(x => x.IsBasedOn(iobjectClass) && !x.isTemplate).ToList();
            // 				reflectableClasses.ForEach(x => PrintClass(x, ""));

            // 				using (var writer = new System.IO.StreamWriter("map.xml"))
            // 				{
            // 					var serializer = new XmlSerializer(data.GetType());
            // 					serializer.Serialize(writer, data);
            // 					writer.Flush();
            // 				}
            }

            CppReflectionGenerator reflGenerator = new CppReflectionGenerator();
            reflGenerator.Generate(output, "", data);

            Console.Write("Complete! " + (DateTime.Now - beginTime).ToString());
        }
Example #2
0
        static void Main(string[] args)
        {
            DateTime beginTime = DateTime.Now;

            Console.Write("Starting ... " + beginTime + "\n");

            bool debug = false;

            SrcMap       data   = new SrcMap();
            CppLexParser parser = new CppLexParser();

            string output = args[0];

            for (int i = 1; i < args.Length; i++)
            {
                foreach (var file in Directory.EnumerateFiles(args[i], "*.*", SearchOption.AllDirectories))
                {
                    if (file.EndsWith(".h"))
                    {
                        SourceFile header = new SourceFile();
                        header.location = file;
                        header.data     = File.ReadAllText(file);
                        data.headers.Add(header);
                    }
                    else if (file.EndsWith(".cpp"))
                    {
                        SourceFile header = new SourceFile();
                        header.location = file;
                        header.data     = File.ReadAllText(file);
                        data.sources.Add(header);
                    }
                }
            }

            parser.Parse(data);

            Console.Write("Parsing done\n");

            if (debug)
            {
                foreach (var cls in data.allClasses)
                {
                    Console.Write("class: " + cls.name + ": ");
                    cls.baseClasses.ForEach(x => Console.Write(x.type + " " + x.className + " (" + (x.lexClass != null).ToString() + ")"));
                    if (cls.isTemplate)
                    {
                        Console.Write(" TEMPLATE!!!");
                    }
                    Console.Write("\n");
                }

//              var iobjectClass = data.allClasses.Find(x => x.name == "o2::IObject");
//              var reflectableClasses = data.allClasses.FindAll(x => x.IsBasedOn(iobjectClass) && !x.isTemplate).ToList();
//              reflectableClasses.ForEach(x => PrintClass(x, ""));

//              using (var writer = new System.IO.StreamWriter("map.xml"))
//              {
//                  var serializer = new XmlSerializer(data.GetType());
//                  serializer.Serialize(writer, data);
//                  writer.Flush();
//              }
            }

            CppReflectionGenerator reflGenerator = new CppReflectionGenerator();

            reflGenerator.Generate(output, "", data);

            Console.Write("Complete! " + (DateTime.Now - beginTime).ToString());
        }