generator: Use TextWriter instead of StreamWriter in base classes

Giving users of the writer more possibility, such as generating the
code in strings before actually using it.
This commit is contained in:
Thibault Saunier 2017-10-03 10:10:04 -03:00
parent 2d71de1360
commit 2852b771ea
5 changed files with 14 additions and 5 deletions

View file

@ -97,7 +97,7 @@ namespace GtkSharp.Generation {
return NS + "Sharp." + Name + "Wrapper.GetManagedDelegate (" + var + ")"; return NS + "Sharp." + Name + "Wrapper.GetManagedDelegate (" + var + ")";
} }
public void WriteAccessors (StreamWriter sw, string indent, string var) public void WriteAccessors (TextWriter sw, string indent, string var)
{ {
sw.WriteLine (indent + "get {"); sw.WriteLine (indent + "get {");
sw.WriteLine (indent + "\treturn " + FromNative (var) + ";"); sw.WriteLine (indent + "\treturn " + FromNative (var) + ";");

View file

@ -35,6 +35,15 @@ namespace GtkSharp.Generation {
} }
} }
public override string GenerateGetSizeOf () {
return NS + "." + Name + ".abi_info.Size";
}
public override string GenerateAlign () {
return NS + "." + Name + ".abi_info.Align";
}
public override string MarshalType { public override string MarshalType {
get { get {
return "IntPtr"; return "IntPtr";
@ -58,7 +67,7 @@ namespace GtkSharp.Generation {
return FromNative (var, false); return FromNative (var, false);
} }
public void WriteAccessors (StreamWriter sw, string indent, string var) public void WriteAccessors (TextWriter sw, string indent, string var)
{ {
sw.WriteLine (indent + "get {"); sw.WriteLine (indent + "get {");
sw.WriteLine (indent + "\treturn " + FromNative (var, false) + ";"); sw.WriteLine (indent + "\treturn " + FromNative (var, false) + ";");

View file

@ -23,7 +23,7 @@ namespace GtkSharp.Generation {
public interface IAccessor { public interface IAccessor {
void WriteAccessors (System.IO.StreamWriter sw, string indentation, string field_name); void WriteAccessors (System.IO.TextWriter sw, string indentation, string field_name);
} }
} }

View file

@ -44,7 +44,7 @@ namespace GtkSharp.Generation {
return "(long) " + var; return "(long) " + var;
} }
public void WriteAccessors (StreamWriter sw, string indent, string var) public void WriteAccessors (TextWriter sw, string indent, string var)
{ {
sw.WriteLine (indent + "get {"); sw.WriteLine (indent + "get {");
sw.WriteLine (indent + "\treturn " + FromNative (var) + ";"); sw.WriteLine (indent + "\treturn " + FromNative (var) + ";");

View file

@ -44,7 +44,7 @@ namespace GtkSharp.Generation {
return "(ulong) " + var; return "(ulong) " + var;
} }
public void WriteAccessors (StreamWriter sw, string indent, string var) public void WriteAccessors (TextWriter sw, string indent, string var)
{ {
sw.WriteLine (indent + "get {"); sw.WriteLine (indent + "get {");
sw.WriteLine (indent + "\treturn " + FromNative (var) + ";"); sw.WriteLine (indent + "\treturn " + FromNative (var) + ";");