public TypeScriptProcesser()
 {
     _managedTypeConvertor = new ManagedTypeGenerator();
     _objectGenerator      = new ObjectCodeGenerator();
     _enumGenerator        = new EnumCodeGenerator();
     _assemblyHelper       = new AssemblyHelper();
 }
Example #2
0
 public DefaultGenerators(Ioc ioc)
 {
     ExpressionConstant = new ExpressionConstantCodeGenerator(ioc);
     GuidConstant       = new GuidConstantCodeGenerator(ioc);
     ResultConstant     = new ResultConstantCodeGenerator(ioc);
     ResultRegistration = new ResultRegistrationCodeGenerator(ioc);
     Property           = new PropertyCodeGenerator(ioc);
     Enum = new EnumCodeGenerator(ioc);
     ExplicitOffsetField = new FieldCodeGenerator(ioc, true);
     AutoLayoutField     = new FieldCodeGenerator(ioc, false);
     Struct                = new StructCodeGenerator(ioc);
     NativeStruct          = new NativeStructCodeGenerator(ioc);
     NativeInvocation      = new NativeInvocationCodeGenerator(ioc);
     Callable              = new CallableCodeGenerator(ioc);
     Method                = new MethodCodeGenerator(ioc);
     Function              = new FunctionCodeGenerator(ioc);
     FunctionImport        = new FunctionImportCodeGenerator(ioc);
     Interface             = new InterfaceCodeGenerator(ioc);
     Group                 = new GroupCodeGenerator(ioc);
     ShadowCallable        = new ShadowCallbackGenerator(ioc);
     ReverseCallableProlog = new ReverseCallablePrologCodeGenerator(ioc);
     Vtbl        = new VtblGenerator(ioc);
     Marshalling = new MarshallingRegistry(ioc);
     Config      = ioc.GeneratorConfig;
 }
Example #3
0
        private void GenerateCode()
        {
            try
            {
                _codeWriter.DeleteGeneratedFiles();

                foreach (var item in _schema.Enums)
                {
                    EnumCodeGenerator.Generate(item, Settings);
                }
                foreach (var item in _schema.Structs)
                {
                    if (string.IsNullOrEmpty(item.switchEnum))
                    {
                        ObjectCodeGenerator.Generate(item, ObjectType.SimpleStruct, Settings);
                    }
                    else
                    {
                        ObjectCodeGenerator.Generate(item, ObjectType.MutableStruct, Settings);
                    }
                }
                foreach (var item in _schema.Configurations)
                {
                    ObjectCodeGenerator.Generate(item, ObjectType.SimpleObject, Settings);
                    DatabaseCodeGenerator.AddConfiguration(item.name, item.typeid);
                }

                foreach (var item in _schema.Objects)
                {
                    if (string.IsNullOrEmpty(item.switchEnum))
                    {
                        ObjectCodeGenerator.Generate(item, ObjectType.SimpleObject, Settings);
                    }
                    else
                    {
                        ObjectCodeGenerator.Generate(item, ObjectType.MutableObject, Settings);
                    }

                    DatabaseCodeGenerator.AddClass(item.name, item.typeid);
                }

                DatabaseCodeGenerator.Generate(Settings);
            }
            catch (Exception e)
            {
                Debug.LogError("Code generation falied");
                Debug.LogException(e);

                _codeWriter.DeleteGeneratedFiles();
            }
        }
Example #4
0
        private void GenerateCode()
        {
            var schema = DatabaseSchema.Load("Schema");
            var writer = new CodeWriter {
                RootFolder = "Assets/Database/Scripts/Generated"
            };

            var enumGenerator       = new EnumCodeGenerator(writer);
            var databaseGenerator   = new DatabaseCodeGenerator(schema, writer);
            var objectCodeGenerator = new ObjectCodeGenerator(schema, writer);

            var builder = new CodeBuilder(schema, writer, enumGenerator, databaseGenerator, objectCodeGenerator);

            builder.Build();
        }
 public EnumCodeGeneratorTest()
 {
     _generator = new EnumCodeGenerator();
 }