summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-09-15 08:13:54 +0000
committerMarc Laukien <marc@zeroc.com>2001-09-15 08:13:54 +0000
commit4cada81a1bf05eb8ea49b09b53fc09deb843bc46 (patch)
treea2a4f20406a6c841cbc2bc3629c19842f4bc6702 /cpp/src/slice2cpp
parentmissing .depend (diff)
downloadice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.tar.bz2
ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.tar.xz
ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.zip
started with phonebook demo
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp47
-rw-r--r--cpp/src/slice2cpp/GenUtil.cpp10
2 files changed, 21 insertions, 36 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 9f1643335ac..a27b87f263f 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -350,18 +350,14 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
{
string scoped = p->scoped();
string scope = p->scope();
- if (scope.size())
- {
- scope.erase(0, 2);
- }
H << sp;
H << nl << "class __U__" << name << " { };";
H << nl << _dllExport << "void __write(::IceInternal::Stream*, const " << name << "&, __U__" << name << ");";
H << nl << _dllExport << "void __read(::IceInternal::Stream*, " << name << "&, __U__" << name << ");";
C << sp;
- C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, const " << scoped << "& v, ::"
- << scope << "::__U__" << name << ')';
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, const " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
C << sb;
C << nl << "__os->write(::Ice::Int(v.size()));";
C << nl << scoped << "::const_iterator p;";
@@ -371,8 +367,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
C << eb;
C << eb;
C << sp;
- C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "& v, ::" << scope
- << "::__U__" << name << ')';
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
C << sb;
C << nl << "::Ice::Int sz;";
C << nl << "__is->read(sz);";
@@ -414,18 +410,14 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
string scoped = p->scoped();
string scope = p->scope();
- if (scope.size())
- {
- scope.erase(0, 2);
- }
H << sp;
H << nl << "class __U__" << name << " { };";
H << nl << _dllExport << "void __write(::IceInternal::Stream*, const " << name << "&, __U__" << name << ");";
H << nl << _dllExport << "void __read(::IceInternal::Stream*, " << name << "&, __U__" << name << ");";
C << sp;
- C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, const " << scoped << "& v, ::"
- << scope << "::__U__" << name << ')';
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, const " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
C << sb;
C << nl << "__os->write(::Ice::Int(v.size()));";
C << nl << scoped << "::const_iterator p;";
@@ -436,8 +428,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
C << eb;
C << eb;
C << sp;
- C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "& v, ::" << scope
- << "::__U__" << name << ')';
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped
+ << "& v, " << scope << "__U__" << name << ')';
C << sb;
C << nl << "::Ice::Int sz;";
C << nl << "__is->read(sz);";
@@ -472,10 +464,6 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
string scoped = p->scoped();
string scope = p->scope();
- if (scope.size())
- {
- scope.erase(0, 2);
- }
int sz = enumerators.size();
@@ -483,7 +471,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
H << nl << _dllExport << "void __write(::IceInternal::Stream*, " << name << ");";
H << nl << _dllExport << "void __read(::IceInternal::Stream*, " << name << "&);";
C << sp;
- C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, " << scoped << " v)";
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, " << scoped << " v)";
C << sb;
if (sz <= 0x7f)
{
@@ -503,7 +491,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
}
C << eb;
C << sp;
- C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "& v)";
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped << "& v)";
C << sb;
if (sz <= 0x7f)
{
@@ -788,7 +776,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << nl << "while (true)";
C << sb;
C << nl << "::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase = __getDelegate();";
- C << nl << "::IceDelegate" << scope << "* __del = dynamic_cast< ::IceDelegate" << scope << "*>(__delBase.get());";
+ C << nl << "::IceDelegate" << scope.substr(0, scope.size() - 2) << "* __del = dynamic_cast< ::IceDelegate"
+ << scope.substr(0, scope.size() - 2) << "*>(__delBase.get());";
C << nl << "try";
C << sb;
C << nl;
@@ -1070,7 +1059,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
{
string name = p->name();
string scoped = p->scoped();
- string scope = p->scope();
+// string scope = p->scope();
TypePtr ret = p->returnType();
string retS = returnTypeToString(ret);
@@ -1734,7 +1723,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
{
H << nl << exp2 << "::IceInternal::DispatchStatus ___" << name << "(::IceInternal::Incoming&);";
C << sp;
- C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "::___" << name
+ C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
<< "(::IceInternal::Incoming& __in)";
C << sb;
if (!inParams.empty())
@@ -1938,18 +1927,14 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
string scoped = p->scoped();
string scope = p->scope();
- if (scope.size())
- {
- scope.erase(0, 2);
- }
C << sp;
- C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, const " << scoped << "Prx& v)";
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::Stream* __os, const " << scoped << "Prx& v)";
C << sb;
C << nl << "__os->write(::Ice::ObjectPrx(v));";
C << eb;
C << sp;
- C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "Prx& v)";
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::Stream* __is, " << scoped << "Prx& v)";
C << sb;
C << nl << "::Ice::ObjectPrx proxy;";
C << nl << "__is->read(proxy);";
diff --git a/cpp/src/slice2cpp/GenUtil.cpp b/cpp/src/slice2cpp/GenUtil.cpp
index 9fa50d2553c..96c480a89d3 100644
--- a/cpp/src/slice2cpp/GenUtil.cpp
+++ b/cpp/src/slice2cpp/GenUtil.cpp
@@ -303,8 +303,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
else
{
- out << nl << seq->scope() << "::__" << func << stream << ", " << param << ", " << seq->scope()
- << "::__U__" << seq->name() << "());";
+ out << nl << seq->scope() << "__" << func << stream << ", " << param << ", " << seq->scope()
+ << "__U__" << seq->name() << "());";
}
return;
}
@@ -312,8 +312,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if (dict)
{
- out << nl << dict->scope() << "::__" << func << stream << ", " << param << ", " << dict->scope()
- << "::__U__" << dict->name() << "());";
+ out << nl << dict->scope() << "__" << func << stream << ", " << param << ", " << dict->scope()
+ << "__U__" << dict->name() << "());";
return;
}
@@ -328,7 +328,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
constructed = proxy->_class();
}
- out << nl << constructed->scope() << "::__" << func << stream << ", " << param << ");";
+ out << nl << constructed->scope() << "__" << func << stream << ", " << param << ");";
}
void