예제 #1
0
        public SwiftTranslator(Poco2SwiftType configuration, ITypeFilter filter, DocumentationCache documentation, IAppDomainProxy appDomain)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            if (documentation == null)
            {
                throw new ArgumentNullException("documentation");
            }

            if (appDomain == null)
            {
                throw new ArgumentNullException("appDomain");
            }

            _configuration = configuration;
            _filter        = filter;
            _documentation = documentation;
            _appDomain     = appDomain;

            InitPredefinedMapTypes();
            InitExternalTypes();
        }
예제 #2
0
        public FileSwiftWriter(Poco2SwiftType configuration, bool swift_12, string outputDir)
            : base(configuration, swift_12)
        {
            if (String.IsNullOrEmpty(outputDir))
            {
                throw new ArgumentNullException("outputDir");
            }

            _outputDir = outputDir;
        }
예제 #3
0
        public SwiftWriter(Poco2SwiftType configuration, bool swift_12)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _configuration          = configuration;
            this.IsEmittingSwift_12 = swift_12;
        }
예제 #4
0
        public DataContractFilter(Poco2SwiftType configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _configuration = configuration;

            CacheConfiguration();
        }
예제 #5
0
        private void ReadConfiguration()
        {
            Poco2SwiftType configuration = null;

            if (_configPath == null)
            {
                configuration = new Poco2SwiftType();
            }
            else
            {
                XmlSerializer serializer = new XmlSerializer(typeof(Poco2SwiftType));

                using (var textReader = File.OpenText(_configPath))
                {
                    using (var xmlReader = XmlReader.Create(textReader))
                    {
                        configuration = (Poco2SwiftType)serializer.Deserialize(xmlReader);

                        configuration.PostDeserialize();
                    }
                }
            }

            _configuration = configuration;

            foreach (var @enum in configuration.enumerations)
            {
                if (@enum.EffectiveFullName != null)
                {
                    @enum.forceinclude = true;
                }

                _configuredEnums.Add(@enum.EffectiveName, @enum);
            }

            foreach (var @class in configuration.classes)
            {
                if (@class.EffectiveFullName != null)
                {
                    @class.forceinclude = true;
                }

                _configuredClasses.Add(@class.EffectiveName, @class);
            }
        }