示例#1
0
 public FickleType(ServiceClass serviceClass, ServiceModel serviceModel, bool byRef = false, bool isPrimitive = false)
 {
     this.serviceModel = serviceModel;
     this.name = serviceClass.Name;
     this.ServiceClass = serviceClass;
     this.byRef = byRef;
     this.isPrimitive = isPrimitive;
 }
示例#2
0
 public FickleType(ServiceEnum serviceEnum, ServiceModel serviceModel, bool nullable = false, bool byRef = false, bool isPrimitive = false)
 {
     this.serviceModel = serviceModel;
     this.ServiceEnum = serviceEnum;
     this.Nullable = nullable;
     this.name = serviceEnum.Name;
     this.byRef = byRef;
     this.isPrimitive = isPrimitive;
 }
        public override void Generate(ServiceModel serviceModel)
        {
            base.Generate(serviceModel);

            if (this.Options.GeneratePod)
            {
                this.GeneratePodspec(serviceModel);
            }

            this.GenerateMasterHeader(serviceModel);
        }
        public override void Generate(ServiceModel serviceModel)
        {
            this.GenerateHttpStreamSerializerInterface(serviceModel);

            foreach (var assemblyFile in this.Options.MappedTypeAssemblies)
            {
                var dllFile = new FileInfo(assemblyFile);
                var assembly = Assembly.LoadFile(dllFile.FullName);

                foreach (var mappedType in assembly.GetTypes())
                {
                    this.mappedTypes[mappedType.Name] = mappedType;
                }
            }

            base.Generate(serviceModel);
        }
        protected override ServiceModel ProcessPregeneration(ServiceModel serviceModel)
        {
            serviceModel = new JavaServiceModelResponseAmender(serviceModel, this.Options).Ammend();

            return serviceModel;
        }
 protected override ServiceModel ProcessPregeneration(ServiceModel serviceModel)
 {
     return serviceModel;
 }
        protected virtual void GenerateHttpStreamSerializerInterface(ServiceModel serviceModel)
        {
            using (var writer = this.GetTextWriterForFile("IHttpStreamSerializer.cs"))
            {
                var serializerInterfaceWriter = new SerializerInterfaceWriter(writer, this.Options);

                serializerInterfaceWriter.Write(this.Options.ServiceModelInfo);
            }
        }
 public ObjectiveServiceModelResponseAmender(ServiceModel serviceModel, CodeGenerationOptions options)
     : base(serviceModel, options)
 {
 }
 public ServiceExpressionBuilder(ServiceModel serviceModel, CodeGenerationOptions codeGenerationOptions)
 {
     this.ServiceModel = serviceModel;
     this.CodeGenerationOptions = codeGenerationOptions;
 }
        protected virtual void GenerateMasterHeader(ServiceModel serviceModel)
        {
            using (var writer = this.GetTextWriterForFile(this.Options.ServiceModelInfo.Name + ".h"))
            {
                var headerWriter = new ObjectiveCodeGenerator(writer);

                var includeExpressions = serviceModel.Classes
                    .Select(c => FickleExpression.Include(c.Name + ".h"))
                    .Concat(serviceModel.Enums.Select(c => FickleExpression.Include(c.Name + ".h")))
                    .Concat(serviceModel.Gateways.Select(c => FickleExpression.Include(c.Name + ".h")));

                var comment = new CommentExpression("This file is AUTO GENERATED");

                var commentGroup = new[] { comment }.ToStatementisedGroupedExpression();
                var headerGroup = includeExpressions.ToStatementisedGroupedExpression();

                var headerExpressions = new List<Expression>
                {
                    commentGroup,
                    headerGroup
                };

                headerWriter.Visit(headerExpressions.ToGroupedExpression(GroupedExpressionsExpressionStyle.Wide));
            }
        }
        protected virtual void GeneratePodspec(ServiceModel serviceModel)
        {
            using (var writer = this.GetTextWriterForFile(this.Options.ServiceModelInfo.Name + ".podspec"))
            {
                var podspecWriter = new PodspecWriter(writer);

                podspecWriter.Write(this.Options.ServiceModelInfo);
            }
        }
示例#12
0
 public CodeGenerationContext(ServiceModel serviceModel, CodeGenerationOptions options)
 {
     this.Options = options;
     this.ServiceModel = serviceModel;
 }
示例#13
0
 protected virtual ServiceModel ProcessPregeneration(ServiceModel serviceModel)
 {
     return serviceModel;
 }
示例#14
0
        public virtual void Generate(ServiceModel serviceModel)
        {
            serviceModel = this.ProcessPregeneration(serviceModel);

            var codeGenerationContext = new CodeGenerationContext(serviceModel, this.Options);
            var serviceExpressionBuilder = new ServiceExpressionBuilder(serviceModel, this.Options);

            if (this.Options.GenerateClasses)
            {
                foreach (var expression in serviceModel.Classes.Select(serviceExpressionBuilder.Build)
                    .Cast<TypeDefinitionExpression>())
                {
                    var currentExpression = expression;

                    this.GenerateClass(codeGenerationContext, currentExpression);
                }
            }

            if (this.Options.GenerateGateways)
            {
                foreach (var expression in serviceModel.Gateways.Select(serviceExpressionBuilder.Build)
                    .Cast<TypeDefinitionExpression>())
                {
                    var currentExpression = expression;

                    this.GenerateGateway(codeGenerationContext, currentExpression);
                }
            }

            if (this.Options.GenerateEnums)
            {
                foreach (var expression in serviceModel.Enums.Select(serviceExpressionBuilder.Build).Cast<TypeDefinitionExpression>())
                {
                    var currentExpression = expression;

                    this.GenerateEnum(codeGenerationContext, currentExpression);
                }
            }

            var assembly = Assembly.GetExecutingAssembly();
            var prefix = this.GetType().Namespace + ".Prelude.";

            foreach (var resourceName in assembly.GetManifestResourceNames().Where(resourceName => resourceName.StartsWith(prefix)))
            {
                using (var input = new StreamReader(assembly.GetManifestResourceStream(resourceName)))
                {
                    using (var output = this.GetTextWriterForFile(resourceName.Substring(prefix.Length)))
                    {
                        int x;

                        while ((x = input.Read()) != -1)
                        {
                            output.Write((char)x);
                        }
                    }
                }
            }
        }
 public override void Generate(ServiceModel serviceModel)
 {
     base.Generate(serviceModel);
     this.GeneratePodspec(serviceModel);
 }
 protected ServiceModelResponseAmender(ServiceModel serviceModel, CodeGenerationOptions options)
 {
     this.serviceModel = serviceModel;
     this.options = options;
 }