Browse Source

Code formatting fixes.

pull/492/head
triton 10 years ago
parent
commit
95c34277a3
  1. 2
      src/Generator/AST/Utils.cs
  2. 19
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

2
src/Generator/AST/Utils.cs

@ -39,7 +39,7 @@ namespace CppSharp.AST
if (method.Access == AccessSpecifier.Private && !method.IsOverride && !method.IsExplicitlyGenerated) if (method.Access == AccessSpecifier.Private && !method.IsOverride && !method.IsExplicitlyGenerated)
return true; return true;
//Ignore copy constructor if a base class don't has or has a private copy constructor // Ignore copy constructor if a base class don't has or has a private copy constructor
if (method.IsCopyConstructor) if (method.IsCopyConstructor)
{ {
if (!options.GenerateCopyConstructors) if (!options.GenerateCopyConstructors)

19
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -99,7 +99,8 @@ namespace CppSharp.Generators.CSharp
get { return "cs"; } get { return "cs"; }
} }
public CSharpTextTemplate(Driver driver, IEnumerable<TranslationUnit> units, CSharpTypePrinter typePrinter, CSharpExpressionPrinter expressionPrinter) public CSharpTextTemplate(Driver driver, IEnumerable<TranslationUnit> units,
CSharpTypePrinter typePrinter, CSharpExpressionPrinter expressionPrinter)
: base(driver, units) : base(driver, units)
{ {
TypePrinter = typePrinter; TypePrinter = typePrinter;
@ -500,8 +501,7 @@ namespace CppSharp.Generators.CSharp
GenerateClassInternalHead(@class); GenerateClassInternalHead(@class);
WriteStartBraceIndent(); WriteStartBraceIndent();
var typePrinter = TypePrinter; TypePrinter.PushContext(CSharpTypePrinterContextKind.Native);
typePrinter.PushContext(CSharpTypePrinterContextKind.Native);
GenerateClassFields(@class, GenerateClassInternalsField, true); GenerateClassFields(@class, GenerateClassInternalsField, true);
if (@class.IsGenerated) if (@class.IsGenerated)
@ -512,18 +512,17 @@ namespace CppSharp.Generators.CSharp
var functions = GatherClassInternalFunctions(@class); var functions = GatherClassInternalFunctions(@class);
foreach (var function in functions) foreach (var function in functions)
{
GenerateInternalFunction(function); GenerateInternalFunction(function);
} }
}
typePrinter.PopContext(); TypePrinter.PopContext();
WriteCloseBraceIndent(); WriteCloseBraceIndent();
PopBlock(NewLineKind.BeforeNextBlock); PopBlock(NewLineKind.BeforeNextBlock);
} }
private IEnumerable<Function> GatherClassInternalFunctions(Class @class, bool includeCtors = true) private IEnumerable<Function> GatherClassInternalFunctions(Class @class,
bool includeCtors = true)
{ {
var functions = new List<Function>(); var functions = new List<Function>();
if (@class.IsValueType) if (@class.IsValueType)
@ -780,7 +779,8 @@ namespace CppSharp.Generators.CSharp
return Tuple.Create(library, decl.Mangled); return Tuple.Create(library, decl.Mangled);
} }
private void GeneratePropertySetter<T>(QualifiedType returnType, T decl, Class @class, bool isAbstract = false) private void GeneratePropertySetter<T>(QualifiedType returnType, T decl,
Class @class, bool isAbstract = false)
where T : Declaration, ITypedDecl where T : Declaration, ITypedDecl
{ {
if (!(decl is Function || decl is Field) ) if (!(decl is Function || decl is Field) )
@ -936,7 +936,8 @@ namespace CppSharp.Generators.CSharp
} }
} }
private void GeneratePropertyGetter<T>(QualifiedType returnType, T decl, Class @class, bool isAbstract = false) private void GeneratePropertyGetter<T>(QualifiedType returnType, T decl,
Class @class, bool isAbstract = false)
where T : Declaration, ITypedDecl where T : Declaration, ITypedDecl
{ {
PushBlock(CSharpBlockKind.Method); PushBlock(CSharpBlockKind.Method);

Loading…
Cancel
Save