summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/slice2cppe/Gen.cpp646
-rw-r--r--cpp/src/slice2javae/Gen.cpp150
2 files changed, 302 insertions, 494 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index db93a33ccb2..fbb3dd78242 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -206,13 +206,11 @@ Slice::Gen::generate(const UnitPtr& p)
}
C << _base << "." << _headerExtension << ">";
- H << "\n#include <IceE/LocalObjectF.h>";
H << "\n#include <IceE/ProxyF.h>";
H << "\n#ifndef ICEE_PURE_CLIENT";
H << "\n# include <IceE/ObjectF.h>";
H << "\n#endif";
H << "\n#include <IceE/Exception.h>";
- H << "\n#include <IceE/LocalObject.h>";
H << "\n#include <IceE/ScopedArray.h>";
if(p->usesProxies())
@@ -821,30 +819,27 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << nl << "return false;";
C << eb;
- if(!p->isLocal())
- {
- //
- // None of these member functions is virtual!
- //
- H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*) const;";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*);";
+ //
+ // None of these member functions is virtual!
+ //
+ H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*) const;";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*);";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
- }
- C << eb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
+ C << sb;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData());
+ }
+ C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
- C << sb;
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
- {
- writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
- }
- C << eb;
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
+ C << sb;
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ {
+ writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData());
}
+ C << eb;
H << eb << ';';
@@ -1266,11 +1261,6 @@ Slice::Gen::ProxyDeclVisitor::visitModuleEnd(const ModulePtr& p)
void
Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
- if(p->isLocal())
- {
- return;
- }
-
string name = fixKwd(p->name());
H << sp << nl << "class " << name << ';';
@@ -1330,11 +1320,6 @@ Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p)
bool
Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p->isLocal())
- {
- return false;
- }
-
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
string name = fixKwd(p->name());
@@ -1647,19 +1632,11 @@ Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
string name = fixKwd(p->name());
- if(!p->isLocal())
- {
- H << sp << nl << "#ifndef ICEE_PURE_CLIENT";
- }
-
+ H << sp << nl << "#ifndef ICEE_PURE_CLIENT";
H << sp << nl << "class " << name << ';';
H << nl << _dllExport << "bool operator==(const " << name << "&, const " << name << "&);";
H << nl << _dllExport << "bool operator<(const " << name << "&, const " << name << "&);";
-
- if(!p->isLocal())
- {
- H << sp << nl << "#endif // ICEE_PURE_CLIENT";
- }
+ H << sp << nl << "#endif // ICEE_PURE_CLIENT";
}
Slice::Gen::ObjectVisitor::ObjectVisitor(Output& h, Output& c, const string& dllExport) :
@@ -1709,23 +1686,13 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
DataMemberList dataMembers = p->dataMembers();
DataMemberList allDataMembers = p->allDataMembers();
- if(!p->isLocal())
- {
- H << sp << nl << "#ifndef ICEE_PURE_CLIENT";
- }
+ H << sp << nl << "#ifndef ICEE_PURE_CLIENT";
H << sp << nl << "class " << _dllExport << name << " : ";
H.useCurrentPosAsIndent();
if(bases.empty())
{
- if(p->isLocal())
- {
- H << "virtual public ::Ice::LocalObject";
- }
- else
- {
- H << "virtual public ::Ice::Object";
- }
+ H << "virtual public ::Ice::Object";
}
else
{
@@ -1745,10 +1712,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << nl << "public:" << sp;
H.inc();
- if(!p->isLocal())
- {
- H << nl << "typedef " << name << "Prx ProxyType;";
- }
+ H << nl << "typedef " << name << "Prx ProxyType;";
H << nl << "typedef " << name << "Ptr PointerType;";
H << nl;
@@ -1901,76 +1865,73 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
*/
}
- if(!p->isLocal())
- {
- StringList ids;
- getIds(p, ids);
+ StringList ids;
+ getIds(p, ids);
- StringList::const_iterator firstIter = ids.begin();
- StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped());
- assert(scopedIter != ids.end());
- StringList::difference_type scopedPos = ice_distance(firstIter, scopedIter);
+ StringList::const_iterator firstIter = ids.begin();
+ StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped());
+ assert(scopedIter != ids.end());
+ StringList::difference_type scopedPos = ice_distance(firstIter, scopedIter);
- StringList::const_iterator q;
+ StringList::const_iterator q1;
+ H << sp;
+ H << nl << "virtual bool ice_isA"
+ << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "virtual ::std::vector< ::std::string> ice_ids"
+ << "(const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;";
+ H << nl << "static const ::std::string& ice_staticId();";
+ if(!dataMembers.empty())
+ {
H << sp;
- H << nl << "virtual bool ice_isA"
- << "(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "virtual ::std::vector< ::std::string> ice_ids"
- << "(const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;";
- H << nl << "static const ::std::string& ice_staticId();";
- if(!dataMembers.empty())
- {
- H << sp;
- }
+ }
- string flatName = p->flattenedScope() + p->name() + "_ids";
+ string flatName = p->flattenedScope() + p->name() + "_ids";
- C << sp;
- C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] =";
- C << sb;
- q = ids.begin();
- while(q != ids.end())
+ C << sp;
+ C << nl << "static const ::std::string " << flatName << '[' << ids.size() << "] =";
+ C << sb;
+ q1 = ids.begin();
+ while(q1 != ids.end())
+ {
+ C << nl << '"' << *q1 << '"';
+ if(++q1 != ids.end())
{
- C << nl << '"' << *q << '"';
- if(++q != ids.end())
- {
- C << ',';
- }
+ C << ',';
}
- C << eb << ';';
+ }
+ C << eb << ';';
- C << sp << nl << "#ifndef ICEE_PURE_CLIENT";
+ C << sp << nl << "#ifndef ICEE_PURE_CLIENT";
- C << sp;
- C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2)
- << "::ice_isA(const ::std::string& _s, const ::Ice::Current&) const";
- C << sb;
- C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", _s);";
- C << eb;
+ C << sp;
+ C << nl << "bool" << nl << fixKwd(p->scoped()).substr(2)
+ << "::ice_isA(const ::std::string& _s, const ::Ice::Current&) const";
+ C << sb;
+ C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", _s);";
+ C << eb;
- C << sp;
- C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2)
- << "::ice_ids(const ::Ice::Current&) const";
- C << sb;
- C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName
- << '[' << ids.size() << "]);";
- C << eb;
+ C << sp;
+ C << nl << "::std::vector< ::std::string>" << nl << fixKwd(p->scoped()).substr(2)
+ << "::ice_ids(const ::Ice::Current&) const";
+ C << sb;
+ C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName
+ << '[' << ids.size() << "]);";
+ C << eb;
- C << sp;
- C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2)
- << "::ice_id(const ::Ice::Current&) const";
- C << sb;
- C << nl << "return " << flatName << '[' << scopedPos << "];";
- C << eb;
+ C << sp;
+ C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2)
+ << "::ice_id(const ::Ice::Current&) const";
+ C << sb;
+ C << nl << "return " << flatName << '[' << scopedPos << "];";
+ C << eb;
- C << sp;
- C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()";
- C << sb;
- C << nl << "return " << flatName << '[' << scopedPos << "];";
- C << eb;
- }
+ C << sp;
+ C << nl << "const ::std::string&" << nl << fixKwd(p->scoped()).substr(2) << "::ice_staticId()";
+ C << sb;
+ C << nl << "return " << flatName << '[' << scopedPos << "];";
+ C << eb;
return true;
}
@@ -1981,86 +1942,82 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
string scoped = fixKwd(p->scoped());
string scope = fixKwd(p->scope());
- if(!p->isLocal())
- {
- ClassList bases = p->bases();
- ClassDefPtr base;
- if(!bases.empty() && !bases.front()->isInterface())
- {
- base = bases.front();
- }
-
- OperationList allOps = p->allOperations();
- if(!allOps.empty())
- {
- StringList allOpNames;
+ ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ base = bases.front();
+ }
+
+ OperationList allOps = p->allOperations();
+ if(!allOps.empty())
+ {
+ StringList allOpNames;
#if defined(__IBMCPP__) && defined(NDEBUG)
//
// See comment for transform above
//
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
- ::IceUtil::constMemFun<string,Operation>(&Contained::name));
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
+ ::IceUtil::constMemFun<string,Operation>(&Contained::name));
#else
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
- ::IceUtil::constMemFun(&Contained::name));
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
+ ::IceUtil::constMemFun(&Contained::name));
#endif
- allOpNames.push_back("ice_id");
- allOpNames.push_back("ice_ids");
- allOpNames.push_back("ice_isA");
- allOpNames.push_back("ice_ping");
- allOpNames.sort();
- allOpNames.unique();
-
- StringList::const_iterator q;
-
- H << sp;
- H << nl
- << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
-
- string flatName = p->flattenedScope() + p->name() + "_all";
- C << sp;
- C << nl << "static ::std::string " << flatName << "[] =";
- C << sb;
- q = allOpNames.begin();
- while(q != allOpNames.end())
+ allOpNames.push_back("ice_id");
+ allOpNames.push_back("ice_ids");
+ allOpNames.push_back("ice_isA");
+ allOpNames.push_back("ice_ping");
+ allOpNames.sort();
+ allOpNames.unique();
+
+ StringList::const_iterator q;
+
+ H << sp;
+ H << nl
+ << "virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
+
+ string flatName = p->flattenedScope() + p->name() + "_all";
+ C << sp;
+ C << nl << "static ::std::string " << flatName << "[] =";
+ C << sb;
+ q = allOpNames.begin();
+ while(q != allOpNames.end())
+ {
+ C << nl << '"' << *q << '"';
+ if(++q != allOpNames.end())
{
- C << nl << '"' << *q << '"';
- if(++q != allOpNames.end())
- {
- C << ',';
- }
+ C << ',';
}
- C << eb << ';';
- C << sp;
- C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
- << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
- C << sb;
-
- C << nl << "::std::pair< ::std::string*, ::std::string*> r = "
- << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size()
- << ", current.operation);";
- C << nl << "if(r.first == r.second)";
- C << sb;
- C << nl << "return ::IceInternal::DispatchOperationNotExist;";
- C << eb;
- C << sp;
- C << nl << "switch(r.first - " << flatName << ')';
+ }
+ C << eb << ';';
+ C << sp;
+ C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
+ << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
+ C << sb;
+
+ C << nl << "::std::pair< ::std::string*, ::std::string*> r = "
+ << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size()
+ << ", current.operation);";
+ C << nl << "if(r.first == r.second)";
+ C << sb;
+ C << nl << "return ::IceInternal::DispatchOperationNotExist;";
+ C << eb;
+ C << sp;
+ C << nl << "switch(r.first - " << flatName << ')';
+ C << sb;
+ int i = 0;
+ for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ {
+ C << nl << "case " << i++ << ':';
C << sb;
- int i = 0;
- for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
- {
- C << nl << "case " << i++ << ':';
- C << sb;
- C << nl << "return ___" << *q << "(in, current);";
- C << eb;
- }
- C << eb;
- C << sp;
- C << nl << "assert(false);";
- C << nl << "return ::IceInternal::DispatchOperationNotExist;";
+ C << nl << "return ___" << *q << "(in, current);";
C << eb;
}
-
+ C << eb;
+ C << sp;
+ C << nl << "assert(false);";
+ C << nl << "return ::IceInternal::DispatchOperationNotExist;";
+ C << eb;
}
//
@@ -2075,49 +2032,23 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
H << eb << ';';
+ H << sp << nl << "#endif // ICEE_PURE_CLIENT";
- if(!p->isLocal())
- {
- H << sp << nl << "#endif // ICEE_PURE_CLIENT";
- }
-
- if(p->isLocal())
- {
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) == static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::LocalObject&>(l) < static_cast<const ::Ice::LocalObject&>(r);";
- C << eb;
- }
- else
- {
- string name = p->name();
-
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);";
- C << eb;
- C << sp;
- C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
- << "& l, const " << scoped << "& r)";
- C << sb;
- C << nl << "return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);";
- C << eb;
- }
+ string name = p->name();
- if(!p->isLocal())
- {
- C << sp << nl << "#endif // ICEE_PURE_CLIENT";
- }
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);";
+ C << eb;
+ C << sp;
+ C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped
+ << "& l, const " << scoped << "& r)";
+ C << sb;
+ C << nl << "return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);";
+ C << eb;
+ C << sp << nl << "#endif // ICEE_PURE_CLIENT";
_useWstring = resetUseWstring(_useWstringHist);
}
@@ -2187,26 +2118,17 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
args += paramName;
}
- if(!cl->isLocal())
- {
- if(!paramList.empty())
- {
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
- }
-
- params += "const ::Ice::Current& = ::Ice::Current())";
- paramsDecl += "const ::Ice::Current& __current)";
- args += "__current)";
- }
- else
+ if(!paramList.empty())
{
- params += ')';
- paramsDecl += ')';
- args += ')';
+ params += ", ";
+ paramsDecl += ", ";
+ args += ", ";
}
+ params += "const ::Ice::Current& = ::Ice::Current())";
+ paramsDecl += "const ::Ice::Current& __current)";
+ args += "__current)";
+
bool isConst = (p->mode() == Operation::Nonmutating) || p->hasMetaData("cpp:const");
string deprecateSymbol = getDeprecateSymbol(p, cl);
@@ -2215,75 +2137,72 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
H << nl << deprecateSymbol << "virtual " << retS << ' ' << fixKwd(name) << params << (isConst ? " const" : "")
<< " = 0;";
- if(!cl->isLocal())
- {
- H << nl << "::IceInternal::DispatchStatus ___" << name
- << "(::IceInternal::Incoming&, const ::Ice::Current&)" << (isConst ? " const" : "") << ';';
+ H << nl << "::IceInternal::DispatchStatus ___" << name
+ << "(::IceInternal::Incoming&, const ::Ice::Current&)" << (isConst ? " const" : "") << ';';
- C << sp;
- C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
- << "(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)" << (isConst ? " const" : "");
- C << sb;
+ C << sp;
+ C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
+ << "(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)" << (isConst ? " const" : "");
+ C << sb;
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
#if defined(__SUNPRO_CC)
- throws.sort(derivedToBaseCompare);
+ throws.sort(derivedToBaseCompare);
#else
- throws.sort(Slice::DerivedToBaseCompare());
+ throws.sort(Slice::DerivedToBaseCompare());
#endif
- C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
+ C << nl << "__checkMode(" << operationModeToString(p->mode()) << ", __current.mode);";
- if(!inParams.empty())
- {
- C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
- }
- if(ret || !outParams.empty() || !throws.empty())
- {
- C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
- }
+ if(!inParams.empty())
+ {
+ C << nl << "::IceInternal::BasicStream* __is = __inS.is();";
+ }
+ if(ret || !outParams.empty() || !throws.empty())
+ {
+ C << nl << "::IceInternal::BasicStream* __os = __inS.os();";
+ }
- writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
- writeUnmarshalCode(C, inParams, 0, StringList(), true);
- writeAllocateCode(C, outParams, 0, StringList(), _useWstring);
- if(!throws.empty())
+ writeAllocateCode(C, inParams, 0, StringList(), _useWstring, true);
+ writeUnmarshalCode(C, inParams, 0, StringList(), true);
+ writeAllocateCode(C, outParams, 0, StringList(), _useWstring);
+ if(!throws.empty())
+ {
+ C << nl << "try";
+ C << sb;
+ }
+ C << nl;
+ if(ret)
+ {
+ C << retS << " __ret = ";
+ }
+ C << fixKwd(name) << args << ';';
+ writeMarshalCode(C, outParams, ret, p->getMetaData());
+ if(!throws.empty())
+ {
+ C << eb;
+ ExceptionList::const_iterator r;
+ for(r = throws.begin(); r != throws.end(); ++r)
{
- C << nl << "try";
+ C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
C << sb;
- }
- C << nl;
- if(ret)
- {
- C << retS << " __ret = ";
- }
- C << fixKwd(name) << args << ';';
- writeMarshalCode(C, outParams, ret, p->getMetaData());
- if(!throws.empty())
- {
+ C << nl << "__os->write(__ex);";
+ C << nl << "return ::IceInternal::DispatchUserException;";
C << eb;
- ExceptionList::const_iterator r;
- for(r = throws.begin(); r != throws.end(); ++r)
- {
- C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
- C << sb;
- C << nl << "__os->write(__ex);";
- C << nl << "return ::IceInternal::DispatchUserException;";
- C << eb;
- }
}
- C << nl << "return ::IceInternal::DispatchOK;";
- C << eb;
- }
+ }
+ C << nl << "return ::IceInternal::DispatchOK;";
+ C << eb;
}
void
@@ -2442,17 +2361,10 @@ Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p)
string scoped = fixKwd(p->scoped());
H << sp;
- if(!p->isLocal())
- {
- H << nl << "#ifndef ICEE_PURE_CLIENT";
- H << nl << _dllExport << "::Ice::Object* upCast(" << scoped << "*);";
- H << nl << "#endif // ICEE_PURE_CLIENT";
- H << nl << _dllExport << "::IceProxy::Ice::Object* upCast(::IceProxy" << scoped << "*);";
- }
- else
- {
- H << nl << _dllExport << "::Ice::LocalObject* upCast(" << scoped << "*);";
- }
+ H << nl << "#ifndef ICEE_PURE_CLIENT";
+ H << nl << _dllExport << "::Ice::Object* upCast(" << scoped << "*);";
+ H << nl << "#endif // ICEE_PURE_CLIENT";
+ H << nl << _dllExport << "::IceProxy::Ice::Object* upCast(::IceProxy" << scoped << "*);";
}
bool
@@ -2461,17 +2373,10 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
string scoped = fixKwd(p->scoped());
C << sp;
- if(!p->isLocal())
- {
- C << nl << "#ifndef ICEE_PURE_CLIENT";
- C << nl << "::Ice::Object* IceInternal::upCast(" << scoped << "* p) { return p; }";
- C << nl << "#endif // ICEE_PURE_CLIENT";
- C << nl << "::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy" << scoped << "* p) { return p; }";
- }
- else
- {
- C << nl << "::Ice::LocalObject* IceInternal::upCast(" << scoped << "* p) { return p; }";
- }
+ C << nl << "#ifndef ICEE_PURE_CLIENT";
+ C << nl << "::Ice::Object* IceInternal::upCast(" << scoped << "* p) { return p; }";
+ C << nl << "#endif // ICEE_PURE_CLIENT";
+ C << nl << "::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy" << scoped << "* p) { return p; }";
return true;
}
@@ -2510,64 +2415,55 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
string name = p->name();
string scoped = fixKwd(p->scoped());
- if(!p->isLocal())
- {
- H << sp << nl << "#ifndef ICEE_PURE_CLIENT";
- }
+ H << sp << nl << "#ifndef ICEE_PURE_CLIENT";
H << sp;
H << nl << "typedef ::IceInternal::Handle< " << scoped << "> " << name << "Ptr;";
- if(!p->isLocal())
- {
- H << sp << nl << "#endif // ICEE_PURE_CLIENT" << sp;
+ H << sp << nl << "#endif // ICEE_PURE_CLIENT" << sp;
- H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
+ H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
- H << sp;
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
- }
+ H << sp;
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
}
bool
Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(!p->isLocal())
- {
- string name = p->name();
- string scoped = fixKwd(p->scoped());
- string scope = fixKwd(p->scope());
-
- string factory;
- string type;
- if(!p->isAbstract())
- {
- type = scoped + "::ice_staticId()";
- factory = scoped + "::ice_factory()";
- }
- else
- {
- type = "\"\"";
- factory = "0";
- }
+ string name = p->name();
+ string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
- << scope << name << "Prx& v)";
- C << sb;
- C << nl << "::Ice::ObjectPrx proxy;";
- C << nl << "__is->read(proxy);";
- C << nl << "if(!proxy)";
- C << sb;
- C << nl << "v = 0;";
- C << eb;
- C << nl << "else";
- C << sb;
- C << nl << "v = new ::IceProxy" << scoped << ';';
- C << nl << "v->__copyFrom(proxy);";
- C << eb;
- C << eb;
+ string factory;
+ string type;
+ if(!p->isAbstract())
+ {
+ type = scoped + "::ice_staticId()";
+ factory = scoped + "::ice_factory()";
}
+ else
+ {
+ type = "\"\"";
+ factory = "0";
+ }
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
+ << scope << name << "Prx& v)";
+ C << sb;
+ C << nl << "::Ice::ObjectPrx proxy;";
+ C << nl << "__is->read(proxy);";
+ C << nl << "if(!proxy)";
+ C << sb;
+ C << nl << "v = 0;";
+ C << eb;
+ C << nl << "else";
+ C << sb;
+ C << nl << "v = new ::IceProxy" << scoped << ';';
+ C << nl << "v->__copyFrom(proxy);";
+ C << eb;
+ C << eb;
return true;
}
@@ -2780,14 +2676,12 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
#endif
H << typeString;
}
- if(!p->isLocal())
+
+ if(!paramList.empty())
{
- if(!paramList.empty())
- {
- H << ',' << nl;
- }
- H << "const Ice::Current&";
+ H << ',' << nl;
}
+ H << "const Ice::Current&";
H.restoreIndent();
bool isConst = (op->mode() == Operation::Nonmutating) || op->hasMetaData("cpp:const");
@@ -2824,14 +2718,12 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
#endif
C << typeString << ' ' << fixKwd((*q)->name());
}
- if(!p->isLocal())
+
+ if(!paramList.empty())
{
- if(!paramList.empty())
- {
- C << ',' << nl;
- }
- C << "const Ice::Current& current";
+ C << ',' << nl;
}
+ C << "const Ice::Current& current";
C.restoreIndent();
C << ')';
C << (isConst ? " const" : "");
diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp
index 13e728b15cb..36a91cd5009 100644
--- a/cpp/src/slice2javae/Gen.cpp
+++ b/cpp/src/slice2javae/Gen.cpp
@@ -771,10 +771,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
return false;
}
- if(!p->isLocal())
- {
- writeOperations(p, false);
- }
+ writeOperations(p, false);
writeOperations(p, true);
return false;
@@ -787,7 +784,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
ClassList bases = p->bases();
string package = getPackage(p);
string opIntfName = "Operations";
- if(noCurrent || p->isLocal())
+ if(noCurrent)
{
opIntfName += "NC";
}
@@ -860,7 +857,7 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
out << nl << " **/";
}
out << nl << retS << ' ' << fixKwd(opname) << spar << params;
- if(!noCurrent && !p->isLocal())
+ if(!noCurrent)
{
out << "Ice.Current __current";
}
@@ -887,10 +884,6 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
string package = getPackage(p);
string absolute = getAbsolute(p, "", "_", "Tie");
string opIntfName = "Operations";
- if(p->isLocal())
- {
- opIntfName += "NC";
- }
//
// Don't generate a TIE class for a non-abstract class
@@ -913,14 +906,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public class " << '_' << name << "Tie";
if(p->isInterface())
{
- if(p->isLocal())
- {
- out << " implements " << fixKwd(name) << ", Ice.TieBase";
- }
- else
- {
- out << " extends " << '_' << name << "Disp implements Ice.TieBase";
- }
+ out << " extends " << '_' << name << "Disp implements Ice.TieBase";
}
else
{
@@ -962,22 +948,6 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "return _ice_delegate.equals(((" << '_' << name << "Tie)rhs)._ice_delegate);";
out << eb;
- if(p->isLocal())
- {
- out << sp << nl << "public java.lang.Object" << nl << "ice_clone()";
- out.inc();
- out << nl << "throws IceUtil.CloneException";
- out.dec();
- out << sb;
- out << sp << nl << "return new _" << name << "Tie(_ice_delegate);";
- out << eb;
-
- out << sp << nl << "public int" << nl << "ice_hash()";
- out << sb;
- out << nl << "return hashCode();";
- out << eb;
- }
-
out << sp << nl << "public int" << nl << "hashCode()";
out << sb;
out << nl << "return _ice_delegate.hashCode();";
@@ -1000,10 +970,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
out << nl << "public " << retS << nl << opName << spar << params;
- if(!p->isLocal())
- {
- out << "Ice.Current __current";
- }
+ out << "Ice.Current __current";
out << epar;
ExceptionList throws = (*r)->throws();
@@ -1017,10 +984,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << "return ";
}
out << "_ice_delegate." << opName << spar << args;
- if(!p->isLocal())
- {
- out << "__current";
- }
+ out << "__current";
out << epar << ';';
out << eb;
}
@@ -1107,23 +1071,9 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << sp << nl << "public interface " << fixKwd(name) << " extends ";
out.useCurrentPosAsIndent();
- if(p->isLocal())
- {
- out << "Ice.LocalObject";
- }
- else
- {
- out << "Ice.Object";
- }
+ out << "Ice.Object";
out << "," << nl << '_' << name;
- if(!p->isLocal())
- {
- out << "Operations, _" << name << "OperationsNC";
- }
- else
- {
- out << "OperationsNC";
- }
+ out << "Operations, _" << name << "OperationsNC";
if(!bases.empty())
{
ClassList::const_iterator q = bases.begin();
@@ -1146,14 +1096,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out.useCurrentPosAsIndent();
if(bases.empty() || bases.front()->isInterface())
{
- if(p->isLocal())
- {
- out << " extends Ice.LocalObjectImpl";
- }
- else
- {
- out << " extends Ice.ObjectImpl";
- }
+ out << " extends Ice.ObjectImpl";
}
else
{
@@ -1168,10 +1111,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
StringList implements;
if(p->isAbstract())
{
- if(!p->isLocal())
- {
- implements.push_back("_" + name + "Operations");
- }
+ implements.push_back("_" + name + "Operations");
implements.push_back("_" + name + "OperationsNC");
}
if(!bases.empty())
@@ -1258,7 +1198,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Marshalling & dispatch support.
//
- if(!p->isInterface() && !p->isLocal())
+ if(!p->isInterface())
{
writeDispatch(out, p);
}
@@ -2076,27 +2016,24 @@ Slice::Gen::HolderVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDeclPtr decl = p->declaration();
writeHolder(decl);
- if(!p->isLocal())
- {
- string name = p->name();
- string absolute = getAbsolute(p, "", "", "PrxHolder");
+ string name = p->name();
+ string absolute = getAbsolute(p, "", "", "PrxHolder");
- if(open(absolute))
- {
- Output& out = output();
- out << sp << nl << "public final class " << name << "PrxHolder";
- out << sb;
- out << sp << nl << "public" << nl << name << "PrxHolder()";
- out << sb;
- out << eb;
- out << sp << nl << "public" << nl << name << "PrxHolder(" << name << "Prx value)";
- out << sb;
- out << nl << "this.value = value;";
- out << eb;
- out << sp << nl << "public " << name << "Prx value;";
- out << eb;
- close();
- }
+ if(open(absolute))
+ {
+ Output& out = output();
+ out << sp << nl << "public final class " << name << "PrxHolder";
+ out << sb;
+ out << sp << nl << "public" << nl << name << "PrxHolder()";
+ out << sb;
+ out << eb;
+ out << sp << nl << "public" << nl << name << "PrxHolder(" << name << "Prx value)";
+ out << sb;
+ out << nl << "this.value = value;";
+ out << eb;
+ out << sp << nl << "public " << name << "Prx value;";
+ out << eb;
+ close();
}
return false;
@@ -2162,11 +2099,6 @@ Slice::Gen::HelperVisitor::HelperVisitor(const string& dir) :
bool
Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p->isLocal())
- {
- return false;
- }
-
//
// Proxy helper
//
@@ -2781,11 +2713,6 @@ Slice::Gen::ProxyVisitor::ProxyVisitor(const string& dir) :
bool
Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p->isLocal())
- {
- return false;
- }
-
string name = p->name();
ClassList bases = p->bases();
string package = getPackage(p);
@@ -2886,7 +2813,7 @@ Slice::Gen::DispatcherVisitor::DispatcherVisitor(const string& dir) :
bool
Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p->isLocal() || !p->isInterface())
+ if(!p->isInterface())
{
return false;
}
@@ -3124,14 +3051,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public final class " << name << 'I';
if(p->isInterface())
{
- if(p->isLocal())
- {
- out << " extends Ice.LocalObjectImpl implements " << fixKwd(name);
- }
- else
- {
- out << " extends _" << name << "Disp";
- }
+ out << " extends _" << name << "Disp";
}
else
{
@@ -3148,7 +3068,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList::const_iterator r;
for(r = ops.begin(); r != ops.end(); ++r)
{
- writeOperation(out, package, *r, p->isLocal());
+ writeOperation(out, package, *r, false);
}
out << eb;
@@ -3205,10 +3125,6 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
out << " implements " << '_' << name << "Operations";
- if(p->isLocal())
- {
- out << "NC";
- }
out << sb;
out << nl << "public" << nl << name << "I()";
@@ -3234,13 +3150,13 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "/*";
out << nl << " * Implemented by " << bases.front()->name() << 'I';
out << nl << " *";
- writeOperation(out, package, *r, p->isLocal());
+ writeOperation(out, package, *r, false);
out << sp;
out << nl << "*/";
}
else
{
- writeOperation(out, package, *r, p->isLocal());
+ writeOperation(out, package, *r, false);
}
}