summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/PythonUtil.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2007-06-19 11:25:17 -0700
committerMark Spruiell <mes@zeroc.com>2007-06-19 11:25:17 -0700
commitddcfe70b4f05fb00e466486fc19076147f79298d (patch)
treeacfa4428263b22b3f9226d04a3fe8f910bd21bdd /cpp/src/Slice/PythonUtil.cpp
parentFor UDP multicast bind to the multicast address rather than 0.0.0.0 unless on... (diff)
downloadice-ddcfe70b4f05fb00e466486fc19076147f79298d.tar.bz2
ice-ddcfe70b4f05fb00e466486fc19076147f79298d.tar.xz
ice-ddcfe70b4f05fb00e466486fc19076147f79298d.zip
bug 2245 - adding support for protected class data members
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r--cpp/src/Slice/PythonUtil.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index 9815b210aea..7278922735d 100644
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -742,13 +742,19 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out.inc();
_out << nl;
}
+ bool isProtected = p->hasMetaData("protected");
for(DataMemberList::iterator r = members.begin(); r != members.end(); ++r)
{
if(r != members.begin())
{
_out << ',' << nl;
}
- _out << "('" << fixIdent((*r)->name()) << "', ";
+ _out << "('";
+ if(isProtected || (*r)->hasMetaData("protected"))
+ {
+ _out << '_';
+ }
+ _out << fixIdent((*r)->name()) << "', ";
writeMetaData((*r)->getMetaData());
_out << ", ";
writeType((*r)->type());
@@ -1703,7 +1709,14 @@ Slice::Python::CodeVisitor::collectClassMembers(const ClassDefPtr& p, MemberInfo
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
{
MemberInfo m;
- m.fixedName = fixIdent((*q)->name());
+ if(p->hasMetaData("protected") || (*q)->hasMetaData("protected"))
+ {
+ m.fixedName = "_" + fixIdent((*q)->name());
+ }
+ else
+ {
+ m.fixedName = fixIdent((*q)->name());
+ }
m.type = (*q)->type();
m.inherited = inherited;
m.metaData = (*q)->getMetaData();