summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/RubyUtil.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-06-19 16:26:44 -0230
committerDwayne Boone <dwayne@zeroc.com>2007-06-19 16:26:44 -0230
commit919ed411281c1436f8e5bebdba86ac5e7c9f2dd1 (patch)
tree2b8a9c077d1ef329eb6c77460c3916fd1833910d /cpp/src/Slice/RubyUtil.cpp
parenthttp://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2140 - Remove code no long... (diff)
parentbug 2120 - using CollocationOptimized (diff)
downloadice-919ed411281c1436f8e5bebdba86ac5e7c9f2dd1.tar.bz2
ice-919ed411281c1436f8e5bebdba86ac5e7c9f2dd1.tar.xz
ice-919ed411281c1436f8e5bebdba86ac5e7c9f2dd1.zip
Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice
Diffstat (limited to 'cpp/src/Slice/RubyUtil.cpp')
-rw-r--r--cpp/src/Slice/RubyUtil.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index 39fcd879c66..f0c664629f8 100644
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -353,14 +353,39 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
DataMemberList members = p->dataMembers();
if(!members.empty())
{
+ bool prot = p->hasMetaData("protected");
+ DataMemberList protectedMembers;
+ DataMemberList::iterator q;
+
_out << sp << nl << "attr_accessor ";
- for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
+ for(q = members.begin(); q != members.end(); ++q)
{
if(q != members.begin())
{
_out << ", ";
}
_out << ":" << fixIdent((*q)->name(), IdentNormal);
+ if(prot || (*q)->hasMetaData("protected"))
+ {
+ protectedMembers.push_back(*q);
+ }
+ }
+
+ if(!protectedMembers.empty())
+ {
+ _out << nl << "protected ";
+ for(q = protectedMembers.begin(); q != protectedMembers.end(); ++q)
+ {
+ if(q != protectedMembers.begin())
+ {
+ _out << ", ";
+ }
+ //
+ // We need to list the symbols of the reader and the writer (e.g., ":member" and ":member=").
+ //
+ _out << ":" << fixIdent((*q)->name(), IdentNormal) << ", :"
+ << fixIdent((*q)->name(), IdentNormal) << '=';
+ }
}
}