summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cs/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cs/Gen.cpp')
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 93b926534e1..acc531ecd22 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -3031,6 +3031,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
bool isClass = false;
bool propertyMapping = false;
bool isValue = false;
+ bool isProtected = false;
ContainedPtr cont = ContainedPtr::dynamicCast(p->container());
assert(cont);
if(StructPtr::dynamicCast(cont))
@@ -3057,6 +3058,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
propertyMapping = true;
}
+ isProtected = cont->hasMetaData("protected") || p->hasMetaData("protected");
}
_out << sp;
@@ -3072,14 +3074,28 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
dataMemberName += "_prop";
}
- _out << nl << (propertyMapping ? "private" : "public") << ' ' << type << ' ' << dataMemberName << ';';
+
+ _out << nl;
+ if(propertyMapping)
+ {
+ _out << "private";
+ }
+ else if(isProtected)
+ {
+ _out << "protected";
+ }
+ else
+ {
+ _out << "public";
+ }
+ _out << ' ' << type << ' ' << dataMemberName << ';';
if(!propertyMapping)
{
return;
}
- _out << nl << "public";
+ _out << nl << (isProtected ? "protected" : "public");
if(!isValue)
{
_out << " virtual";