public Templates(Schema Schema) { this.Inner = new OS.Cpp.Templates(new OS.Schema { Types = new List <OS.TypeDef> { }, TypeRefs = new List <OS.TypeDef> { OS.TypeDef.CreatePrimitive(new OS.PrimitiveDef { Name = new List <String> { "Unit" }, GenericParameters = new List <OS.VariableDef> { }, Description = "", Attributes = new List <KeyValuePair <String, List <String> > > { } }), OS.TypeDef.CreatePrimitive(new OS.PrimitiveDef { Name = new List <String> { "Boolean" }, GenericParameters = new List <OS.VariableDef> { }, Description = "", Attributes = new List <KeyValuePair <String, List <String> > > { } }) }, Imports = new List <String> { } }); }
public Writer(Schema Schema, String NamespaceName) { this.Schema = Schema; this.NamespaceName = NamespaceName; InnerSchema = PlainObjectSchemaGenerator.Generate(Schema, NamespaceName); TypeDict = OS.ObjectSchemaExtensions.GetMap(InnerSchema).ToDictionary(p => p.Key.Split('.').Last(), p => p.Value, StringComparer.OrdinalIgnoreCase); InnerWriter = new OS.Cpp.Templates(InnerSchema); if (!Schema.TypeRefs.Concat(Schema.Types).Where(t => t.OnPrimitive && t.Primitive.Name == "Int").Any()) { throw new InvalidOperationException("PrimitiveMissing: Int"); } }