diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 913a666d..56395ee7 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -463,14 +463,15 @@ namespace CppSharp.Generators.CSharp WriteStartBraceIndent(); foreach (var method in @class.Methods.Where(m => - !ASTUtils.CheckIgnoreMethod(m) && m.Access == AccessSpecifier.Public)) + !ASTUtils.CheckIgnoreFunction(m.OriginalFunction) && + m.Access == AccessSpecifier.Public)) { PushBlock(BlockKind.Method); GenerateDeclarationCommon(method); var functionName = GetMethodIdentifier(method); - Write("{0} {1}(", method.OriginalReturnType, functionName); + Write($"{method.OriginalReturnType} {functionName}("); Write(FormatMethodParameters(method.Parameters)); @@ -478,14 +479,19 @@ namespace CppSharp.Generators.CSharp PopBlock(NewLineKind.BeforeNextBlock); } - foreach (var prop in @class.Properties.Where(p => p.IsGenerated && p.Access == AccessSpecifier.Public)) + foreach (var prop in @class.Properties.Where(p => p.IsGenerated && + (p.GetMethod == null || p.GetMethod.OriginalFunction == null || + !p.GetMethod.OriginalFunction.Ignore) && + (p.SetMethod == null || p.SetMethod.OriginalFunction == null || + !p.SetMethod.OriginalFunction.Ignore) && + p.Access == AccessSpecifier.Public)) { PushBlock(BlockKind.Property); var type = prop.Type; if (prop.Parameters.Count > 0 && prop.Type.IsPointerToPrimitiveType()) type = ((PointerType) prop.Type).Pointee; GenerateDeclarationCommon(prop); - Write("{0} {1} {{ ", type, GetPropertyName(prop)); + Write($"{type} {GetPropertyName(prop)} {{ "); if (prop.HasGetter) Write("get; "); if (prop.HasSetter) diff --git a/tests/CSharp/CSharpTemplates.h b/tests/CSharp/CSharpTemplates.h index 46ad0552..a054066c 100644 --- a/tests/CSharp/CSharpTemplates.h +++ b/tests/CSharp/CSharpTemplates.h @@ -36,6 +36,7 @@ public: int getIndependent(); const T* returnTakeDependentPointer(const T* p); T getDependent(const T& t); + const T* propertyReturnDependentPointer(); static T staticDependent(const T& t); template void usesAdditionalDependentType(AdditionalDependentType additionalDependentType); @@ -91,6 +92,12 @@ T IndependentFields::getDependent(const T& t) return t; } +template +const T* IndependentFields::propertyReturnDependentPointer() +{ + return 0; +} + template T IndependentFields::staticDependent(const T& t) { @@ -425,7 +432,7 @@ private: HasDefaultTemplateArgument explicitSpecialization; }; -class DLL_API HasSpecializationForSecondaryBase : T1, DependentValueFields +class DLL_API HasSpecializationForSecondaryBase : T1, DependentValueFields, IndependentFields { public: HasSpecializationForSecondaryBase();