コード例 #1
0
        public TranslationUnitPorter(CXCursor translationUnit, string ns, IBindingLocator bindingLocator)
        {
            if (translationUnit.kind != CXCursorKind.CXCursor_TranslationUnit)
                throw new ArgumentException ();

            if (string.IsNullOrWhiteSpace (ns))
                throw new ArgumentException ();

            if (bindingLocator == null)
                throw new ArgumentNullException ();

            this.translationUnit = translationUnit;
            this.bindingLocator = bindingLocator;

            cu = SyntaxFactory.CompilationUnit ();

            IEnumerable<UsingDirectiveSyntax> usings = CreateUsings ();
            foreach (var u in usings)
                cu = cu.AddUsings (u);

            var nsDecl = CreateNamespace (ns);
            foreach (var c in PortClasses ())
                nsDecl = nsDecl.AddMembers (c);

            cu = cu.AddMembers (nsDecl);
        }
コード例 #2
0
 public SourceCodeTranslator(string[] args, IBindingLocator bindingLocator)
 {
     clangArgs = args;
     this.bindingLocator = bindingLocator;
 }