Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
@ -85,7 +85,8 @@ namespace CppSharp.Passes
if (!type.IsInterface && baseProperty != null && baseProperty.IsVirtual && setter.IsVirtual)
{
bool isReadOnly = baseProperty.SetMethod == null;
GenerateProperty(setter.Namespace, baseProperty.GetMethod,
var name = GetReadWritePropertyName(baseProperty.GetMethod, afterSet);
GenerateProperty(name, setter.Namespace, baseProperty.GetMethod,
readOnly || isReadOnly ? null : setter);
}
next:
@ -1,4 +1,5 @@
using System;
using System.Reflection;
using CommonTest;
using CppSharp.Utils;
using NUnit.Framework;
@ -775,4 +776,13 @@ This is a very long string. This is a very long string. This is a very long stri
Assert.That(VirtFuncWithStringParam.VirtualFunctionWithStringParam("anyRandomString").Equals(5));
[Test]
public void TestOverriddenSetter()
var propertyInfo = typeof(HasOverridenSetter).GetProperty("Virtual",
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
Assert.That(propertyInfo, Is.Not.Null);
Assert.That(propertyInfo.CanWrite);
@ -489,6 +489,37 @@ std::string& HasStdString::getStdString()
return s;
TestProperties::TestProperties() : Field(0)
int TestProperties::getFieldValue()
return Field;
void TestProperties::setFieldValue(int Value)
Field = Value;
bool TestProperties::isVirtual()
return false;
void TestProperties::setVirtual(bool value)
HasOverridenSetter::HasOverridenSetter()
void HasOverridenSetter::setVirtual(bool value)
TypeMappedIndex::TypeMappedIndex()
@ -780,4 +811,4 @@ void ImplementsVirtualFunctionsWithStringParams::PureVirtualFunctionWithStringPa
int HasVirtualFunctionsWithStringParams::VirtualFunctionWithStringParam(std::string testString)
return 5;
@ -578,13 +578,19 @@ public:
int getFieldValue();
void setFieldValue(int Value);
bool isVirtual();
virtual void setVirtual(bool value);
private:
int FieldValue;
};
TestProperties::TestProperties() : Field(0) {}
int TestProperties::getFieldValue() { return Field; }
void TestProperties::setFieldValue(int Value) { Field = Value; }
class DLL_API HasOverridenSetter : public TestProperties
public:
HasOverridenSetter();
void setVirtual(bool value);
class DLL_API TypeMappedIndex
@ -1297,4 +1303,4 @@ public:
ImplementsVirtualFunctionsWithStringParams();
~ImplementsVirtualFunctionsWithStringParams();
virtual void PureVirtualFunctionWithStringParams(std::string testString);