Browse Source

Rename TypeDatabase to TypeMapDatabase and move its initialization to the ctor.

pull/1/head
triton 13 years ago
parent
commit
0c40927ab8
  1. 7
      src/Generator/Driver.cs
  2. 3
      src/Generator/Generators/CLI/CLITypePrinter.cs
  3. 4
      src/Generator/Types/TypeMap.cs

7
src/Generator/Driver.cs

@ -14,13 +14,15 @@ namespace Cxxi
private readonly Options options; private readonly Options options;
private readonly Library library; private readonly Library library;
private readonly ILibrary transform; private readonly ILibrary transform;
public TypeDatabase typeDatabase; private readonly TypeMapDatabase typeDatabase;
public Driver(Options options, ILibrary transform) public Driver(Options options, ILibrary transform)
{ {
this.options = options; this.options = options;
this.transform = transform; this.transform = transform;
this.library = new Library(options.OutputNamespace, options.LibraryName); this.library = new Library(options.OutputNamespace, options.LibraryName);
typeDatabase = new TypeMapDatabase();
typeDatabase.SetupTypeMaps();
} }
public void ParseCode() public void ParseCode()
@ -60,9 +62,6 @@ namespace Cxxi
public void ProcessCode() public void ProcessCode()
{ {
typeDatabase = new TypeDatabase();
typeDatabase.SetupTypeMaps();
// Sort the declarations to be in original order. // Sort the declarations to be in original order.
foreach (var unit in library.TranslationUnits) foreach (var unit in library.TranslationUnits)
SortDeclarations(unit); SortDeclarations(unit);

3
src/Generator/Generators/CLI/CLITypePrinter.cs

@ -1,13 +1,12 @@
using System; using System;
using Cxxi;
using Cxxi.Types; using Cxxi.Types;
namespace Cxxi.Generators.CLI namespace Cxxi.Generators.CLI
{ {
public class CLITypePrinter : ITypeVisitor<string>, IDeclVisitor<string> public class CLITypePrinter : ITypeVisitor<string>, IDeclVisitor<string>
{ {
private ITypeMapDatabase TypeMapDatabase;
public Library Library { get; set; } public Library Library { get; set; }
private readonly ITypeMapDatabase TypeMapDatabase;
public CLITypePrinter(ITypeMapDatabase database, Library library) public CLITypePrinter(ITypeMapDatabase database, Library library)
{ {

4
src/Generator/Types/TypeMap.cs

@ -67,11 +67,11 @@ namespace Cxxi.Types
bool FindTypeMap(string name, out TypeMap typeMap); bool FindTypeMap(string name, out TypeMap typeMap);
} }
public class TypeDatabase : ITypeMapDatabase public class TypeMapDatabase : ITypeMapDatabase
{ {
public IDictionary<string, System.Type> TypeMaps { get; set; } public IDictionary<string, System.Type> TypeMaps { get; set; }
public TypeDatabase() public TypeMapDatabase()
{ {
TypeMaps = new Dictionary<string, System.Type>(); TypeMaps = new Dictionary<string, System.Type>();
} }

Loading…
Cancel
Save