diff options
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 400 |
1 files changed, 200 insertions, 200 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 860e69ff20c..de127ea1e9c 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -27,38 +27,38 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c _dllExport(dllExport), _impl(imp) { - for (vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p) + for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p) { - if (p->length() && (*p)[p->length() - 1] != '/') + if(p->length() && (*p)[p->length() - 1] != '/') { *p += '/'; } } string::size_type pos = _base.rfind('/'); - if (pos != string::npos) + if(pos != string::npos) { _base.erase(0, pos + 1); } - if (_impl) + if(_impl) { string fileImplH = _base + "I.h"; string fileImplC = _base + "I.cpp"; - if (!dir.empty()) + if(!dir.empty()) { fileImplH = dir + '/' + fileImplH; fileImplC = dir + '/' + fileImplC; } struct stat st; - if (stat(fileImplH.c_str(), &st) == 0) + if(stat(fileImplH.c_str(), &st) == 0) { cerr << name << ": `" << fileImplH << "' already exists - will not overwrite" << endl; return; } - if (stat(fileImplC.c_str(), &st) == 0) + if(stat(fileImplC.c_str(), &st) == 0) { cerr << name << ": `" << fileImplC << "' already exists - will not overwrite" << endl; @@ -66,7 +66,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c } implH.open(fileImplH.c_str()); - if (!implH) + if(!implH) { cerr << name << ": can't open `" << fileImplH << "' for writing: " << strerror(errno) << endl; @@ -74,7 +74,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c } implC.open(fileImplC.c_str()); - if (!implC) + if(!implC) { cerr << name << ": can't open `" << fileImplC << "' for writing: " << strerror(errno) << endl; @@ -82,7 +82,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c } string s = fileImplH; - if (_include.size()) + if(_include.size()) { s = _include + '/' + s; } @@ -94,21 +94,21 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c string fileH = _base + ".h"; string fileC = _base + ".cpp"; - if (!dir.empty()) + if(!dir.empty()) { fileH = dir + '/' + fileH; fileC = dir + '/' + fileC; } H.open(fileH.c_str()); - if (!H) + if(!H) { cerr << name << ": can't open `" << fileH << "' for writing: " << strerror(errno) << endl; return; } C.open(fileC.c_str()); - if (!C) + if(!C) { cerr << name << ": can't open `" << fileC << "' for writing: " << strerror(errno) << endl; return; @@ -120,7 +120,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c C << "\n// Generated from file `" << changeInclude(_base, _includePaths) << ".ice'\n"; string s = fileH; - if (_include.size()) + if(_include.size()) { s = _include + '/' + s; } @@ -135,7 +135,7 @@ Slice::Gen::~Gen() H << "\n\n#endif\n"; C << '\n'; - if (_impl) + if(_impl) { implH << "\n\n#endif\n"; implC << '\n'; @@ -145,11 +145,11 @@ Slice::Gen::~Gen() bool Slice::Gen::operator!() const { - if (!H || !C) + if(!H || !C) { return true; } - if (_impl && (!implH || !implC)) + if(_impl && (!implH || !implC)) { return true; } @@ -160,7 +160,7 @@ void Slice::Gen::generate(const UnitPtr& unit) { C << "\n#include <"; - if (_include.size()) + if(_include.size()) { C << _include << '/'; } @@ -170,7 +170,7 @@ Slice::Gen::generate(const UnitPtr& unit) H << "\n#include <Ice/ProxyF.h>"; H << "\n#include <Ice/ObjectF.h>"; - if (unit->usesProxies()) + if(unit->usesProxies()) { H << "\n#include <Ice/Exception.h>"; H << "\n#include <Ice/LocalObject.h>"; @@ -200,7 +200,7 @@ Slice::Gen::generate(const UnitPtr& unit) } StringList includes = unit->includeFiles(); - for (StringList::const_iterator q = includes.begin(); q != includes.end(); ++q) + for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q) { H << "\n#include <" << changeInclude(*q, _includePaths) << ".h>"; } @@ -209,7 +209,7 @@ Slice::Gen::generate(const UnitPtr& unit) printVersionCheck(C); printDllExportStuff(H, _dllExport); - if (_dllExport.size()) + if(_dllExport.size()) { _dllExport += " "; } @@ -244,17 +244,17 @@ Slice::Gen::generate(const UnitPtr& unit) ObjectVisitor objectVisitor(H, C, _dllExport); unit->visit(&objectVisitor); - if (_impl) + if(_impl) { implH << "\n#include <"; - if (_include.size()) + if(_include.size()) { implH << _include << '/'; } implH << _base << ".h>"; implC << "#include <"; - if (_include.size()) + if(_include.size()) { implC << _include << '/'; } @@ -273,7 +273,7 @@ Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllEx bool Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasOtherConstructedOrExceptions()) + if(!p->hasOtherConstructedOrExceptions()) { return false; } @@ -306,9 +306,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) H << sp << nl << "class " << name << " : "; H.useCurrentPosAsIndent(); - if (!base) + if(!base) { - if (p->isLocal()) + if(p->isLocal()) { H << "public ::Ice::LocalException"; } @@ -329,12 +329,12 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) H.inc(); H << sp; - if (p->isLocal()) + if(p->isLocal()) { H << nl << _dllExport << name << "(const char*, int);"; C << sp << nl << scoped.substr(2) << "::" << name << "(const char* file, int line) : "; C.inc(); - if (!base) + if(!base) { C << nl << "::Ice::LocalException(file, line)"; } @@ -354,7 +354,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) C << nl << "return name;"; C << eb; - if (p->isLocal()) + if(p->isLocal()) { H << nl << _dllExport << "virtual void ice_print(::std::ostream&) const;"; } @@ -371,7 +371,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) C << nl << "throw *this;"; C << eb; - if (!p->isLocal()) + if(!p->isLocal()) { ExceptionList allBases = p->allBases(); StringList exceptionIds; @@ -389,10 +389,10 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) << "] ="; C << sb; q = exceptionIds.begin(); - while (q != exceptionIds.end()) + while(q != exceptionIds.end()) { C << nl << '"' << *q << '"'; - if (++q != exceptionIds.end()) + if(++q != exceptionIds.end()) { C << ','; } @@ -410,7 +410,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) void Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { - if (!p->isLocal()) + if(!p->isLocal()) { string name = p->name(); string scoped = p->scoped(); @@ -426,7 +426,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) TypeStringList memberList; DataMemberList dataMembers = p->dataMembers(); - for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { memberList.push_back(make_pair((*q)->type(), (*q)->name())); } @@ -497,13 +497,13 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << eb; C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator!=(const " << name << "& __rhs) const"; C << sb; - C << nl << "if (this == &__rhs)"; + C << nl << "if(this == &__rhs)"; C << sb; C << nl << "return false;"; C << eb; - for (q = dataMembers.begin(); q != dataMembers.end(); ++q) + for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - C << nl << "if (" << (*q)->name() << " != __rhs." << (*q)->name() << ')'; + C << nl << "if(" << (*q)->name() << " != __rhs." << (*q)->name() << ')'; C << sb; C << nl << "return true;"; C << eb; @@ -512,17 +512,17 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << eb; C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator<(const " << name << "& __rhs) const"; C << sb; - C << nl << "if (this == &__rhs)"; + C << nl << "if(this == &__rhs)"; C << sb; C << nl << "return false;"; C << eb; - for (q = dataMembers.begin(); q != dataMembers.end(); ++q) + for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - C << nl << "if (" << (*q)->name() << " < __rhs." << (*q)->name() << ')'; + C << nl << "if(" << (*q)->name() << " < __rhs." << (*q)->name() << ')'; C << sb; C << nl << "return true;"; C << eb; - C << nl << "else if (__rhs." << (*q)->name() << " < " << (*q)->name() << ')'; + C << nl << "else if(__rhs." << (*q)->name() << " < " << (*q)->name() << ')'; C << sb; C << nl << "return false;"; C << eb; @@ -530,7 +530,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << nl << "return false;"; C << eb; - if (!p->isLocal()) + if(!p->isLocal()) { // // Neither of these four member functions are virtual! @@ -542,7 +542,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) H << nl << _dllExport << "void ice_unmarshal(const ::std::string&, const ::Ice::StreamPtr&);"; TypeStringList memberList; - for (q = dataMembers.begin(); q != dataMembers.end(); ++q) + for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { memberList.push_back(make_pair((*q)->type(), (*q)->name())); } @@ -590,14 +590,14 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) string name = p->name(); TypePtr type = p->type(); string s = typeToString(type); - if (s[0] == ':') + if(s[0] == ':') { s.insert(0, " "); } H << sp << nl << "typedef ::std::vector<" << s << "> " << name << ';'; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if (!p->isLocal() && + if(!p->isLocal() && (!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy)) { string scoped = p->scoped(); @@ -634,7 +634,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << sb; C << nl << "__os->writeSize(::Ice::Int(v.size()));"; C << nl << scoped << "::const_iterator p;"; - C << nl << "for (p = v.begin(); p != v.end(); ++p)"; + C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; writeMarshalUnmarshalCode(C, type, "(*p)", true); C << eb; @@ -649,7 +649,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) // Don't use v.resize(sz) or v.reserve(sz) here, as it cannot // be checked whether sz is a reasonable value. // - C << nl << "while (sz--)"; + C << nl << "while(sz--)"; C << sb; C << nl << "v.resize(v.size() + 1);"; writeMarshalUnmarshalCode(C, type, "v.back()", false); @@ -662,7 +662,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << sb; C << nl << "__os->startWriteSequence(__name, ::Ice::Int(v.size()));"; C << nl << scoped << "::const_iterator p;"; - C << nl << "for (p = v.begin(); p != v.end(); ++p)"; + C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; writeGenericMarshalUnmarshalCode(C, type, "(*p)", true, "\"e\""); C << eb; @@ -677,7 +677,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) // Don't use v.resize(sz) or v.reserve(sz) here, as it cannot // be checked whether sz is a reasonable value. // - C << nl << "while (sz--)"; + C << nl << "while(sz--)"; C << sb; C << nl << "v.resize(v.size() + 1);"; writeGenericMarshalUnmarshalCode(C, type, "v.back()", false, "\"e\""); @@ -708,14 +708,14 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) TypePtr keyType = p->keyType(); TypePtr valueType = p->valueType(); string ks = typeToString(keyType); - if (ks[0] == ':') + if(ks[0] == ':') { ks.insert(0, " "); } string vs = typeToString(valueType); H << sp << nl << "typedef ::std::map<" << ks << ", " << vs << "> " << name << ';'; - if (!p->isLocal()) + if(!p->isLocal()) { string scoped = p->scoped(); string scope = p->scope(); @@ -751,7 +751,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << sb; C << nl << "__os->writeSize(::Ice::Int(v.size()));"; C << nl << scoped << "::const_iterator p;"; - C << nl << "for (p = v.begin(); p != v.end(); ++p)"; + C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; writeMarshalUnmarshalCode(C, keyType, "p->first", true); writeMarshalUnmarshalCode(C, valueType, "p->second", true); @@ -763,7 +763,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << sb; C << nl << "::Ice::Int sz;"; C << nl << "__is->readSize(sz);"; - C << nl << "while (sz--)"; + C << nl << "while(sz--)"; C << sb; C << nl << "::std::pair<" << ks << ", " << vs << "> pair;"; writeMarshalUnmarshalCode(C, keyType, "pair.first", false); @@ -778,7 +778,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << sb; C << nl << "__os->startWriteDictionary(__name, ::Ice::Int(v.size()));"; C << nl << scoped << "::const_iterator p;"; - C << nl << "for (p = v.begin(); p != v.end(); ++p)"; + C << nl << "for(p = v.begin(); p != v.end(); ++p)"; C << sb; C << nl << "__os->startWriteDictionaryElement();"; writeGenericMarshalUnmarshalCode(C, keyType, "p->first", true, "\"key\""); @@ -792,7 +792,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) << "const ::Ice::StreamPtr& __is, " << scoped << "& v, " << scope << "__U__" << name << ')'; C << sb; C << nl << "::Ice::Int sz = __is->startReadDictionary(__name);"; - C << nl << "while (sz--)"; + C << nl << "while(sz--)"; C << sb; C << nl << "::std::pair<" << ks << ", " << vs << "> pair;"; C << nl << "__is->startReadDictionaryElement();"; @@ -828,17 +828,17 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) H << sp << nl << "enum " << name; H << sb; EnumeratorList::const_iterator en = enumerators.begin(); - while (en != enumerators.end()) + while(en != enumerators.end()) { H << nl << (*en)->name(); - if (++en != enumerators.end()) + if(++en != enumerators.end()) { H << ','; } } H << eb << ';'; - if (!p->isLocal()) + if(!p->isLocal()) { string scoped = p->scoped(); string scope = p->scope(); @@ -857,11 +857,11 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped << " v)"; C << sb; - if (sz <= 0x7f) + if(sz <= 0x7f) { C << nl << "__os->write(static_cast< ::Ice::Byte>(v));"; } - else if (sz <= 0x7fff) + else if(sz <= 0x7fff) { C << nl << "__os->write(static_cast< ::Ice::Short>(v));"; } @@ -874,13 +874,13 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped << "& v)"; C << sb; - if (sz <= 0x7f) + if(sz <= 0x7f) { C << nl << "::Ice::Byte val;"; C << nl << "__is->read(val);"; C << nl << "v = static_cast< " << scoped << ">(val);"; } - else if (sz <= 0x7fff) + else if(sz <= 0x7fff) { C << nl << "::Ice::Short val;"; C << nl << "__is->read(val);"; @@ -901,10 +901,10 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) C << nl << "static const ::std::string " << "__RT__" << name << "[] ="; C << sb; en = enumerators.begin(); - while (en != enumerators.end()) + while(en != enumerators.end()) { C << nl << "\"" << (*en)->name() << "\""; - if (++en != enumerators.end()) + if(++en != enumerators.end()) { C << ','; } @@ -931,7 +931,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) void Slice::Gen::TypesVisitor::emitExceptionBase(const ExceptionPtr& base, const std::string& call) { - if (base) + if(base) { C.zeroIndent(); C << nl << "#ifdef _WIN32"; // COMPILERBUG @@ -955,7 +955,7 @@ Slice::Gen::ProxyDeclVisitor::ProxyDeclVisitor(Output& h, Output& c, const strin bool Slice::Gen::ProxyDeclVisitor::visitUnitStart(const UnitPtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -974,7 +974,7 @@ Slice::Gen::ProxyDeclVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::ProxyDeclVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -995,7 +995,7 @@ Slice::Gen::ProxyDeclVisitor::visitModuleEnd(const ModulePtr& p) void Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p) { - if (p->isLocal()) + if(p->isLocal()) { return; } @@ -1016,7 +1016,7 @@ Slice::Gen::ProxyVisitor::ProxyVisitor(Output& h, Output& c, const string& dllEx bool Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1035,7 +1035,7 @@ Slice::Gen::ProxyVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1056,7 +1056,7 @@ Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p) bool Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) { - if (p->isLocal()) + if(p->isLocal()) { return false; } @@ -1066,7 +1066,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList bases = p->bases(); H << sp << nl << "class " << _dllExport << name << " : "; - if (bases.empty()) + if(bases.empty()) { H << "virtual public ::IceProxy::Ice::Object"; } @@ -1074,10 +1074,10 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) { H.useCurrentPosAsIndent(); ClassList::const_iterator q = bases.begin(); - while (q != bases.end()) + while(q != bases.end()) { H << "virtual public ::IceProxy" << (*q)->scoped(); - if (++q != bases.end()) + if(++q != bases.end()) { H << ',' << nl; } @@ -1157,7 +1157,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) string paramsDecl = "("; // With declarators string args = "("; - for (q = inParams.begin(); q != inParams.end(); ++q) + for(q = inParams.begin(); q != inParams.end(); ++q) { string typeString = inputTypeToString(q->first); params += typeString; @@ -1170,7 +1170,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) args += ", "; } - for (q = outParams.begin(); q != outParams.end(); ++q) + for(q = outParams.begin(); q != outParams.end(); ++q) { string typeString = outputTypeToString(q->first); params += typeString; @@ -1191,7 +1191,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << sp << nl << retS << nl << "IceProxy" << scoped << paramsDecl; C << sb; C << nl << "int __cnt = 0;"; - C << nl << "while (true)"; + C << nl << "while(true)"; C << sb; C << nl << "::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase = __getDelegate();"; C << nl << "::IceDelegate" << scope.substr(0, scope.size() - 2) << "* __del = dynamic_cast< ::IceDelegate" @@ -1199,12 +1199,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; C << nl; - if (ret) + if(ret) { C << "return "; } C << "__del->" << name << args << ";"; - if (!ret) + if(!ret) { C << nl << "return;"; } @@ -1217,7 +1217,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << sb; list<string> metaData = p->getMetaData(); bool nonmutating = find(metaData.begin(), metaData.end(), "nonmutating") != metaData.end(); - if (nonmutating) + if(nonmutating) { C << nl << "__handleException(*__ex.get(), __cnt);"; } @@ -1242,7 +1242,7 @@ Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string& bool Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1261,7 +1261,7 @@ Slice::Gen::DelegateVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1282,7 +1282,7 @@ Slice::Gen::DelegateVisitor::visitModuleEnd(const ModulePtr& p) bool Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p) { - if (p->isLocal()) + if(p->isLocal()) { return false; } @@ -1291,7 +1291,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList bases = p->bases(); H << sp << nl << "class " << _dllExport << name << " : "; - if (bases.empty()) + if(bases.empty()) { H << "virtual public ::IceDelegate::Ice::Object"; } @@ -1299,10 +1299,10 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p) { H.useCurrentPosAsIndent(); ClassList::const_iterator q = bases.begin(); - while (q != bases.end()) + while(q != bases.end()) { H << "virtual public ::IceDelegate" << (*q)->scoped(); - if (++q != bases.end()) + if(++q != bases.end()) { H << ',' << nl; } @@ -1337,14 +1337,14 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) string params = "("; - for (q = inParams.begin(); q != inParams.end(); ++q) + for(q = inParams.begin(); q != inParams.end(); ++q) { string typeString = inputTypeToString(q->first); params += typeString; params += ", "; } - for (q = outParams.begin(); q != outParams.end(); ++q) + for(q = outParams.begin(); q != outParams.end(); ++q) { string typeString = outputTypeToString(q->first); params += typeString; @@ -1364,7 +1364,7 @@ Slice::Gen::DelegateMVisitor::DelegateMVisitor(Output& h, Output& c, const strin bool Slice::Gen::DelegateMVisitor::visitUnitStart(const UnitPtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1383,7 +1383,7 @@ Slice::Gen::DelegateMVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1404,7 +1404,7 @@ Slice::Gen::DelegateMVisitor::visitModuleEnd(const ModulePtr& p) bool Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { - if (p->isLocal()) + if(p->isLocal()) { return false; } @@ -1416,17 +1416,17 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) H << sp << nl << "class " << _dllExport << name << " : "; H.useCurrentPosAsIndent(); H << "virtual public ::IceDelegate" << scoped << ','; - if (bases.empty()) + if(bases.empty()) { H << nl << "virtual public ::IceDelegateM::Ice::Object"; } else { ClassList::const_iterator q = bases.begin(); - while (q != bases.end()) + while(q != bases.end()) { H << nl << "virtual public ::IceDelegateM" << (*q)->scoped(); - if (++q != bases.end()) + if(++q != bases.end()) { H << ','; } @@ -1463,7 +1463,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) string params = "("; string paramsDecl = "("; // With declarators - for (q = inParams.begin(); q != inParams.end(); ++q) + for(q = inParams.begin(); q != inParams.end(); ++q) { string typeString = inputTypeToString(q->first); params += typeString; @@ -1474,7 +1474,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) paramsDecl += ", "; } - for (q = outParams.begin(); q != outParams.end(); ++q) + for(q = outParams.begin(); q != outParams.end(); ++q) { string typeString = outputTypeToString(q->first); params += typeString; @@ -1500,35 +1500,35 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) bool nonmutating = find(metaData.begin(), metaData.end(), "nonmutating") != metaData.end(); C << nl << "::IceInternal::Outgoing __out(__connection, __reference, __operation, " << (nonmutating ? "true" : "false") << ", __context);"; - if (ret || !outParams.empty() || !throws.empty()) + if(ret || !outParams.empty() || !throws.empty()) { C << nl << "::IceInternal::BasicStream* __is = __out.is();"; } - if (!inParams.empty()) + if(!inParams.empty()) { C << nl << "::IceInternal::BasicStream* __os = __out.os();"; } writeMarshalCode(C, inParams, 0); - C << nl << "if (!__out.invoke())"; + C << nl << "if(!__out.invoke())"; C << sb; - if (!throws.empty()) + if(!throws.empty()) { ExceptionList::const_iterator r; C << nl << "static ::std::string __throws[] ="; C << sb; - for (r = throws.begin(); r != throws.end(); ++r) + for(r = throws.begin(); r != throws.end(); ++r) { C << nl << '"' << (*r)->scoped() << '"'; - if (r != throws.end()) + if(r != throws.end()) { C << ','; } } C << eb << ';'; - C << nl << "switch (__is->throwException(__throws, __throws + " << throws.size() << "))"; + C << nl << "switch(__is->throwException(__throws, __throws + " << throws.size() << "))"; C << sb; int cnt = 0; - for (r = throws.begin(); r != throws.end(); ++r) + for(r = throws.begin(); r != throws.end(); ++r) { C << nl << "case " << cnt++ << ':'; C << sb; @@ -1547,7 +1547,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) C << eb; writeAllocateCode(C, TypeStringList(), ret); writeUnmarshalCode(C, outParams, ret); - if (ret) + if(ret) { C << nl << "return __ret;"; } @@ -1562,7 +1562,7 @@ Slice::Gen::DelegateDVisitor::DelegateDVisitor(Output& h, Output& c, const strin bool Slice::Gen::DelegateDVisitor::visitUnitStart(const UnitPtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1581,7 +1581,7 @@ Slice::Gen::DelegateDVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::DelegateDVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDecls()) { return false; } @@ -1602,7 +1602,7 @@ Slice::Gen::DelegateDVisitor::visitModuleEnd(const ModulePtr& p) bool Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) { - if (p->isLocal()) + if(p->isLocal()) { return false; } @@ -1614,17 +1614,17 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) H << sp << nl << "class " << _dllExport << name << " : "; H.useCurrentPosAsIndent(); H << "virtual public ::IceDelegate" << scoped << ','; - if (bases.empty()) + if(bases.empty()) { H << nl << "virtual public ::IceDelegateD::Ice::Object"; } else { ClassList::const_iterator q = bases.begin(); - while (q != bases.end()) + while(q != bases.end()) { H << nl << "virtual public ::IceDelegateD" << (*q)->scoped(); - if (++q != bases.end()) + if(++q != bases.end()) { H << ','; } @@ -1665,7 +1665,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) string paramsDecl = "("; // With declarators string args = "("; - for (q = inParams.begin(); q != inParams.end(); ++q) + for(q = inParams.begin(); q != inParams.end(); ++q) { string typeString = inputTypeToString(q->first); params += typeString; @@ -1678,7 +1678,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) args += ", "; } - for (q = outParams.begin(); q != outParams.end(); ++q) + for(q = outParams.begin(); q != outParams.end(); ++q) { string typeString = outputTypeToString(q->first); params += typeString; @@ -1703,11 +1703,11 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) bool nonmutating = find(metaData.begin(), metaData.end(), "nonmutating") != metaData.end(); C << nl << "__initCurrent(__current, \"" << name << "\", " << (nonmutating ? "true" : "false") << ", __context);"; - C << nl << "while (true)"; + C << nl << "while(true)"; C << sb; C << nl << "::IceInternal::Direct __direct(__adapter, __current);"; C << nl << cl->scoped() << "* __servant = dynamic_cast< " << cl->scoped() << "*>(__direct.facetServant().get());"; - C << nl << "if (!__servant)"; + C << nl << "if(!__servant)"; C << sb; C << nl << "::Ice::OperationNotExistException __opEx(__FILE__, __LINE__);"; C << nl << "__opEx.operation = __current.operation;"; @@ -1716,12 +1716,12 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) C << nl << "try"; C << sb; C << nl; - if (ret) + if(ret) { C << "return "; } C << "__servant->" << name << args << ';'; - if (!ret) + if(!ret) { C << nl << "return;"; } @@ -1730,7 +1730,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) throws.sort(); throws.unique(); ExceptionList::const_iterator r; - for (r = throws.begin(); r != throws.end(); ++r) + for(r = throws.begin(); r != throws.end(); ++r) { C << nl << "catch (const " << (*r)->scoped() << "&)"; C << sb; @@ -1761,7 +1761,7 @@ Slice::Gen::ObjectDeclVisitor::ObjectDeclVisitor(Output& h, Output& c, const str bool Slice::Gen::ObjectDeclVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasClassDecls()) + if(!p->hasClassDecls()) { return false; } @@ -1798,7 +1798,7 @@ Slice::Gen::ObjectVisitor::ObjectVisitor(Output& h, Output& c, const string& dll bool Slice::Gen::ObjectVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasClassDefs()) + if(!p->hasClassDefs()) { return false; } @@ -1826,9 +1826,9 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) string exp1; string exp2; - if (_dllExport.size()) + if(_dllExport.size()) { - if (p->hasDataMembers()) + if(p->hasDataMembers()) { exp2 = _dllExport; } @@ -1841,9 +1841,9 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << sp; H << nl << "class " << exp1 << name << " : "; H.useCurrentPosAsIndent(); - if (bases.empty()) + if(bases.empty()) { - if (p->isLocal()) + if(p->isLocal()) { H << "virtual public ::Ice::LocalObject"; } @@ -1855,10 +1855,10 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) else { ClassList::const_iterator q = bases.begin(); - while (q != bases.end()) + while(q != bases.end()) { H << "virtual public " << (*q)->scoped(); - if (++q != bases.end()) + if(++q != bases.end()) { H << ',' << nl; } @@ -1870,7 +1870,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "public:"; H.inc(); - if (!p->isLocal()) + if(!p->isLocal()) { ClassList allBases = p->allBases(); StringList ids; @@ -1895,7 +1895,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << exp2 << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current());"; H << nl << exp2 << "static const ::std::string& ice_staticId();"; - if (!p->isAbstract()) + if(!p->isAbstract()) { H << sp << nl << exp2 << "static ::Ice::ObjectFactoryPtr _factory;"; H << nl << exp2 << "static const ::Ice::ObjectFactoryPtr& ice_factory();"; @@ -1904,10 +1904,10 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "const ::std::string " << scoped.substr(2) << "::__ids[" << ids.size() << "] ="; C << sb; q = ids.begin(); - while (q != ids.end()) + while(q != ids.end()) { C << nl << '"' << *q << '"'; - if (++q != ids.end()) + if(++q != ids.end()) { C << ','; } @@ -1948,12 +1948,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) string scoped = p->scoped(); string scope = p->scope(); - if (!p->isLocal()) + if(!p->isLocal()) { string exp2; - if (_dllExport.size()) + if(_dllExport.size()) { - if (p->hasDataMembers()) + if(p->hasDataMembers()) { exp2 = _dllExport; } @@ -1961,13 +1961,13 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) ClassList bases = p->bases(); ClassDefPtr base; - if (!bases.empty() && !bases.front()->isInterface()) + if(!bases.empty() && !bases.front()->isInterface()) { base = bases.front(); } OperationList allOps = p->allOperations(); - if (!allOps.empty()) + if(!allOps.empty()) { StringList allOpNames; transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::memFun(&Operation::name)); @@ -1989,10 +1989,10 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "::std::string " << scoped.substr(2) << "::__all[] ="; C << sb; q = allOpNames.begin(); - while (q != allOpNames.end()) + while(q != allOpNames.end()) { C << nl << '"' << *q << '"'; - if (++q != allOpNames.end()) + if(++q != allOpNames.end()) { C << ','; } @@ -2004,15 +2004,15 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << sb; C << nl << "::std::pair<const ::std::string*, const ::std::string*> r = " << "::std::equal_range(__all, __all + " << allOpNames.size() << ", current.operation);"; - C << nl << "if (r.first == r.second)"; + C << nl << "if(r.first == r.second)"; C << sb; C << nl << "return ::IceInternal::DispatchOperationNotExist;"; C << eb; C << sp; - C << nl << "switch (r.first - __all)"; + C << nl << "switch(r.first - __all)"; C << sb; int i = 0; - for (q = allOpNames.begin(); q != allOpNames.end(); ++q) + for(q = allOpNames.begin(); q != allOpNames.end(); ++q) { C << nl << "case " << i++ << ':'; C << sb; @@ -2040,7 +2040,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) TypeStringList memberList; DataMemberList dataMembers = p->dataMembers(); - for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { memberList.push_back(make_pair((*q)->type(), (*q)->name())); } @@ -2079,7 +2079,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) writeGenericMarshalUnmarshalCode(C, p->declaration(), "value", false, "__name"); C << eb; - if (!p->isAbstract()) + if(!p->isAbstract()) { string name = p->name(); string factoryName = "__F__"; @@ -2112,7 +2112,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) H << eb << ';'; - if (p->isLocal()) + if(p->isLocal()) { C << sp; C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped @@ -2188,9 +2188,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) string paramsDecl = "("; // With declarators string args = "("; - for (q = inParams.begin(); q != inParams.end(); ++q) + for(q = inParams.begin(); q != inParams.end(); ++q) { - if (q != inParams.begin()) + if(q != inParams.begin()) { params += ", "; paramsDecl += ", "; @@ -2205,9 +2205,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) args += q->second; } - for (q = outParams.begin(); q != outParams.end(); ++q) + for(q = outParams.begin(); q != outParams.end(); ++q) { - if (q != outParams.begin() || !inParams.empty()) + if(q != outParams.begin() || !inParams.empty()) { params += ", "; paramsDecl += ", "; @@ -2222,9 +2222,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) args += q->second; } - if (!cl->isLocal()) + if(!cl->isLocal()) { - if (!inParams.empty() || !outParams.empty()) + if(!inParams.empty() || !outParams.empty()) { params += ", "; paramsDecl += ", "; @@ -2242,9 +2242,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) } string exp2; - if (_dllExport.size()) + if(_dllExport.size()) { - if (cl->hasDataMembers()) + if(cl->hasDataMembers()) { exp2 = _dllExport; } @@ -2253,7 +2253,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) H << sp; H << nl << exp2 << "virtual " << retS << ' ' << name << params << " = 0;"; - if (!cl->isLocal()) + if(!cl->isLocal()) { ExceptionList throws = p->throws(); throws.sort(); @@ -2265,34 +2265,34 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name << "(::IceInternal::Incoming& __in, const ::Ice::Current& __current)"; C << sb; - if (!inParams.empty()) + if(!inParams.empty()) { C << nl << "::IceInternal::BasicStream* __is = __in.is();"; } - if (ret || !outParams.empty() || !throws.empty()) + if(ret || !outParams.empty() || !throws.empty()) { C << nl << "::IceInternal::BasicStream* __os = __in.os();"; } writeAllocateCode(C, inParams, 0); writeUnmarshalCode(C, inParams, 0); writeAllocateCode(C, outParams, 0); - if (!throws.empty()) + if(!throws.empty()) { C << nl << "try"; C << sb; } C << nl; - if (ret) + if(ret) { C << retS << " __ret = "; } C << name << args << ';'; writeMarshalCode(C, outParams, ret); - if (!throws.empty()) + if(!throws.empty()) { C << eb; ExceptionList::const_iterator r; - for (r = throws.begin(); r != throws.end(); ++r) + for(r = throws.begin(); r != throws.end(); ++r) { C << nl << "catch (const " << (*r)->scoped() << "& __ex)"; C << sb; @@ -2318,7 +2318,7 @@ Slice::Gen::ObjectVisitor::visitDataMember(const DataMemberPtr& p) void Slice::Gen::ObjectVisitor::emitClassBase(const ClassDefPtr& base, const std::string& call) { - if (base) + if(base) { C.zeroIndent(); C << nl << "#ifdef _WIN32"; // COMPILERBUG @@ -2357,7 +2357,7 @@ Slice::Gen::IceInternalVisitor::IceInternalVisitor(Output& h, Output& c, const s bool Slice::Gen::IceInternalVisitor::visitUnitStart(const UnitPtr& p) { - if (!p->hasClassDecls()) + if(!p->hasClassDecls()) { return false; } @@ -2383,7 +2383,7 @@ Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p) H << sp; H << nl << _dllExport << "void incRef(" << scoped << "*);"; H << nl << _dllExport << "void decRef(" << scoped << "*);"; - if (!p->isLocal()) + if(!p->isLocal()) { H << sp; H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);"; @@ -2415,7 +2415,7 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "p->__decRef();"; C << eb; - if (!p->isLocal()) + if(!p->isLocal()) { C << sp; C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)"; @@ -2434,12 +2434,12 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p) << scoped << "Prx& d)"; C << sb; C << nl << "d = 0;"; - C << nl << "if (b)"; + C << nl << "if(b)"; C << sb; - C << nl << "if (f == b->ice_getFacet())"; + C << nl << "if(f == b->ice_getFacet())"; C << sb; C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b.get());"; - C << nl << "if (!d && b->ice_isA(\"" << scoped << "\"))"; + C << nl << "if(!d && b->ice_isA(\"" << scoped << "\"))"; C << sb; C << nl << "d = new ::IceProxy" << scoped << ";"; C << nl << "d->__copyFrom(b);"; @@ -2450,7 +2450,7 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "::Ice::ObjectPrx bb = b->ice_newFacet(f);"; C << nl << "try"; C << sb; - C << nl << "if (bb->ice_isA(\"" << scoped << "\"))"; + C << nl << "if(bb->ice_isA(\"" << scoped << "\"))"; C << sb; C << nl << "d = new ::IceProxy" << scoped << ";"; C << nl << "d->__copyFrom(bb);"; @@ -2468,12 +2468,12 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p) << scoped << "Prx& d)"; C << sb; C << nl << "d = 0;"; - C << nl << "if (b)"; + C << nl << "if(b)"; C << sb; - C << nl << "if (f == b->ice_getFacet())"; + C << nl << "if(f == b->ice_getFacet())"; C << sb; C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b.get());"; - C << nl << "if (!d)"; + C << nl << "if(!d)"; C << sb; C << nl << "d = new ::IceProxy" << scoped << ";"; C << nl << "d->__copyFrom(b);"; @@ -2500,7 +2500,7 @@ Slice::Gen::HandleVisitor::HandleVisitor(Output& h, Output& c, const string& dll bool Slice::Gen::HandleVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasClassDecls()) + if(!p->hasClassDecls()) { return false; } @@ -2528,7 +2528,7 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p) H << sp; H << nl << "typedef ::IceInternal::Handle< " << scoped << "> " << name << "Ptr;"; - if (!p->isLocal()) + if(!p->isLocal()) { H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;"; @@ -2547,7 +2547,7 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p) bool Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) { - if (!p->isLocal()) + if(!p->isLocal()) { string scoped = p->scoped(); string scope = p->scope(); @@ -2565,7 +2565,7 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) C << sb; C << nl << "::Ice::ObjectPrx proxy;"; C << nl << "__is->read(proxy);"; - C << nl << "if (!proxy)"; + C << nl << "if(!proxy)"; C << sb; C << nl << "v = 0;"; C << eb; @@ -2588,7 +2588,7 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) << "const ::Ice::StreamPtr& __is, " << scoped << "Prx& v)"; C << sb; C << nl << "::Ice::ObjectPrx proxy = __is->readProxy(__name);"; - C << nl << "if (!proxy)"; + C << nl << "if(!proxy)"; C << sb; C << nl << "v = 0;"; C << eb; @@ -2613,9 +2613,9 @@ void Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type) { BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if (builtin) + if(builtin) { - switch (builtin->kind()) + switch(builtin->kind()) { case Builtin::KindBool: { @@ -2653,28 +2653,28 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type) } ProxyPtr prx = ProxyPtr::dynamicCast(type); - if (prx) + if(prx) { out << nl << "return 0;"; return; } ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type); - if (cl) + if(cl) { out << nl << "return 0;"; return; } StructPtr st = StructPtr::dynamicCast(type); - if (st) + if(st) { out << nl << "return " << st->scoped() << "();"; return; } EnumPtr en = EnumPtr::dynamicCast(type); - if (en) + if(en) { EnumeratorList enumerators = en->getEnumerators(); out << nl << "return " << en->scope() << enumerators.front()->name() << ';'; @@ -2682,7 +2682,7 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type) } SequencePtr seq = SequencePtr::dynamicCast(type); - if (seq) + if(seq) { out << nl << "return " << seq->scoped() << "();"; return; @@ -2696,7 +2696,7 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type) bool Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) { - if (!p->hasClassDefs()) + if(!p->hasClassDefs()) { return false; } @@ -2718,7 +2718,7 @@ Slice::Gen::ImplVisitor::visitModuleEnd(const ModulePtr& p) bool Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) { - if (!p->isAbstract()) + if(!p->isAbstract()) { return false; } @@ -2730,7 +2730,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList bases = p->bases(); ClassDefPtr base; - if (!bases.empty() && !bases.front()->isInterface()) + if(!bases.empty() && !bases.front()->isInterface()) { base = bases.front(); } @@ -2740,7 +2740,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) H.useCurrentPosAsIndent(); H << "virtual public " << name; ClassList::const_iterator q; - for (q = bases.begin(); q != bases.end(); ++q) + for(q = bases.begin(); q != bases.end(); ++q) { H << ',' << nl << "virtual public " << (*q)->scoped() << "I"; } @@ -2757,7 +2757,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) // // Operations // - for (r = ops.begin(); r != ops.end(); ++r) + for(r = ops.begin(); r != ops.end(); ++r) { OperationPtr op = (*r); string opName = op->name(); @@ -2771,27 +2771,27 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) H << sp << nl << "virtual " << retS << ' ' << opName << '('; H.useCurrentPosAsIndent(); - for (q = inParams.begin(); q != inParams.end(); ++q) + for(q = inParams.begin(); q != inParams.end(); ++q) { - if (q != inParams.begin()) + if(q != inParams.begin()) { H << ',' << nl; } string typeString = inputTypeToString(q->first); H << typeString; } - for (q = outParams.begin(); q != outParams.end(); ++q) + for(q = outParams.begin(); q != outParams.end(); ++q) { - if (!inParams.empty() || q != outParams.begin()) + if(!inParams.empty() || q != outParams.begin()) { H << ',' << nl; } string typeString = outputTypeToString(q->first); H << typeString; } - if (!p->isLocal()) + if(!p->isLocal()) { - if (!inParams.empty() || !outParams.empty()) + if(!inParams.empty() || !outParams.empty()) { H << ',' << nl; } @@ -2802,27 +2802,27 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) C << sp << nl << retS << nl << scoped.substr(2) << "I::" << opName << '('; C.useCurrentPosAsIndent(); - for (q = inParams.begin(); q != inParams.end(); ++q) + for(q = inParams.begin(); q != inParams.end(); ++q) { - if (q != inParams.begin()) + if(q != inParams.begin()) { C << ',' << nl; } string typeString = inputTypeToString(q->first); C << typeString << ' ' << q->second; } - for (q = outParams.begin(); q != outParams.end(); ++q) + for(q = outParams.begin(); q != outParams.end(); ++q) { - if (!inParams.empty() || q != outParams.begin()) + if(!inParams.empty() || q != outParams.begin()) { C << ',' << nl; } string typeString = outputTypeToString(q->first); C << typeString << ' ' << q->second; } - if (!p->isLocal()) + if(!p->isLocal()) { - if (!inParams.empty() || !outParams.empty()) + if(!inParams.empty() || !outParams.empty()) { C << ',' << nl; } @@ -2835,7 +2835,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) // // Return value // - if (ret) + if(ret) { writeReturn(C, ret); } |