|
|
@ -893,14 +893,12 @@ namespace CppSharp.Generators.CSharp |
|
|
|
|
|
|
|
|
|
|
|
private void GenerateClassProperties(Class @class) |
|
|
|
private void GenerateClassProperties(Class @class) |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var prop in @class.Properties) |
|
|
|
foreach (var prop in @class.Properties.Where(p => !p.Ignore)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (prop.Ignore) continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PushBlock(CSharpBlockKind.Property); |
|
|
|
PushBlock(CSharpBlockKind.Property); |
|
|
|
WriteLine("{0} {1} {2}", |
|
|
|
WriteLine("{0} {1} {2}", |
|
|
|
prop.Access == AccessSpecifier.Public ? "public" : "protected", |
|
|
|
prop.Access == AccessSpecifier.Public ? "public" : "protected", |
|
|
|
prop.Type, SafeIdentifier(prop.Name)); |
|
|
|
prop.Type, GetPropertyName(prop)); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
|
|
|
|
|
|
|
|
if (prop.Field != null) |
|
|
|
if (prop.Field != null) |
|
|
@ -925,6 +923,12 @@ namespace CppSharp.Generators.CSharp |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string GetPropertyName(Property prop) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return prop.Parameters.Count == 0 ? SafeIdentifier(prop.Name) |
|
|
|
|
|
|
|
: string.Format("this[{0}]", FormatMethodParameters(prop.Parameters)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void GenerateVariable(Class @class, Type type, Variable variable) |
|
|
|
private void GenerateVariable(Class @class, Type type, Variable variable) |
|
|
|
{ |
|
|
|
{ |
|
|
|
PushBlock(CSharpBlockKind.Variable); |
|
|
|
PushBlock(CSharpBlockKind.Variable); |
|
|
@ -1469,7 +1473,7 @@ namespace CppSharp.Generators.CSharp |
|
|
|
|
|
|
|
|
|
|
|
var functionName = GetFunctionIdentifier(function); |
|
|
|
var functionName = GetFunctionIdentifier(function); |
|
|
|
Write("public static {0} {1}(", function.OriginalReturnType, functionName); |
|
|
|
Write("public static {0} {1}(", function.OriginalReturnType, functionName); |
|
|
|
GenerateMethodParameters(function); |
|
|
|
Write(FormatMethodParameters(function.Parameters)); |
|
|
|
WriteLine(")"); |
|
|
|
WriteLine(")"); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
|
|
|
|
|
|
|
@ -1517,7 +1521,7 @@ namespace CppSharp.Generators.CSharp |
|
|
|
else |
|
|
|
else |
|
|
|
Write("{0} {1}(", method.OriginalReturnType, functionName); |
|
|
|
Write("{0} {1}(", method.OriginalReturnType, functionName); |
|
|
|
|
|
|
|
|
|
|
|
GenerateMethodParameters(method); |
|
|
|
Write(FormatMethodParameters(method.Parameters)); |
|
|
|
|
|
|
|
|
|
|
|
Write(")"); |
|
|
|
Write(")"); |
|
|
|
|
|
|
|
|
|
|
@ -1938,25 +1942,16 @@ namespace CppSharp.Generators.CSharp |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void GenerateMethodParameters(Function function) |
|
|
|
private string FormatMethodParameters(IEnumerable<Parameter> @params) |
|
|
|
{ |
|
|
|
|
|
|
|
var @params = new List<string>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < function.Parameters.Count; ++i) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
var param = function.Parameters[i]; |
|
|
|
return string.Join(", ", |
|
|
|
|
|
|
|
from param in @params |
|
|
|
if (param.Kind == ParameterKind.IndirectReturnType) |
|
|
|
where param.Kind != ParameterKind.IndirectReturnType |
|
|
|
continue; |
|
|
|
let typeName = param.CSharpType(this.TypePrinter) |
|
|
|
|
|
|
|
select string.Format("{0}{1} {2}", GetParameterUsage(param.Usage), |
|
|
|
var typeName = param.CSharpType(TypePrinter); |
|
|
|
|
|
|
|
@params.Add(string.Format("{0}{1} {2}", GetParameterUsage(param.Usage), |
|
|
|
|
|
|
|
typeName, SafeIdentifier(param.Name))); |
|
|
|
typeName, SafeIdentifier(param.Name))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Write(string.Join(", ", @params)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
public bool GenerateTypedef(TypedefDecl typedef) |
|
|
|
public bool GenerateTypedef(TypedefDecl typedef) |
|
|
|