summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp418
1 files changed, 209 insertions, 209 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 8fd318910e1..4bf0998c922 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -160,7 +160,7 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) :
_name(name)
{
ContainedPtr cont = ContainedPtr::dynamicCast(_container);
- if (cont)
+ if(cont)
{
_scoped = cont->scoped();
}
@@ -188,10 +188,10 @@ ModulePtr
Slice::Container::createModule(const string& name)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ModulePtr module = ModulePtr::dynamicCast(*p);
- if (module)
+ if(module)
{
continue; // Reopening modules is permissible
}
@@ -212,12 +212,12 @@ ClassDefPtr
Slice::Container::createClassDef(const string& name, bool intf, const ClassList& bases, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*p);
- if (decl)
+ if(decl)
{
- if (checkInterfaceAndLocal(name, false, intf, decl->isInterface(), local, decl->isLocal()))
+ if(checkInterfaceAndLocal(name, false, intf, decl->isInterface(), local, decl->isLocal()))
{
continue;
}
@@ -226,16 +226,16 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
}
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if (def)
+ if(def)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
def->updateIncludeLevel();
return def;
}
string msg = "redefinition of ";
- if (intf)
+ if(intf)
{
msg += "interface";
}
@@ -253,7 +253,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
string msg = "redefinition of `";
msg += name;
msg += "' as ";
- if (intf)
+ if(intf)
{
msg += "interface";
}
@@ -268,7 +268,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
ClassDefPtr def = new ClassDef(this, name, intf, bases, local);
_contents.push_back(def);
- for (ContainedList::const_iterator q = matches.begin(); q != matches.end(); ++q)
+ for(ContainedList::const_iterator q = matches.begin(); q != matches.end(); ++q)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
decl->_definition = def;
@@ -291,12 +291,12 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
ClassDefPtr def;
ContainedList matches = _unit->findContents(thisScope() + name);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDefPtr clDef = ClassDefPtr::dynamicCast(*p);
- if (clDef)
+ if(clDef)
{
- if (checkInterfaceAndLocal(name, true, intf, clDef->isInterface(), local, clDef->isLocal()))
+ if(checkInterfaceAndLocal(name, true, intf, clDef->isInterface(), local, clDef->isLocal()))
{
assert(!def);
def = clDef;
@@ -307,9 +307,9 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
}
ClassDeclPtr clDecl = ClassDeclPtr::dynamicCast(*p);
- if (clDecl)
+ if(clDecl)
{
- if (checkInterfaceAndLocal(name, false, intf, clDecl->isInterface(), local, clDecl->isLocal()))
+ if(checkInterfaceAndLocal(name, false, intf, clDecl->isInterface(), local, clDecl->isLocal()))
{
continue;
}
@@ -320,7 +320,7 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
string msg = "declaration of already defined `";
msg += name;
msg += "' as ";
- if (intf)
+ if(intf)
{
msg += "interface";
}
@@ -337,12 +337,12 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
// have a declaration for the class in this container, we don't
// create another one.
//
- for (ContainedList::const_iterator q = _contents.begin(); q != _contents.end(); ++q)
+ for(ContainedList::const_iterator q = _contents.begin(); q != _contents.end(); ++q)
{
- if ((*q)->name() == name)
+ if((*q)->name() == name)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
- if (decl)
+ if(decl)
{
return decl;
}
@@ -354,7 +354,7 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
ClassDeclPtr decl = new ClassDecl(this, name, intf, local);
_contents.push_back(decl);
- if (def)
+ if(def)
{
decl->_definition = def;
}
@@ -366,12 +366,12 @@ ExceptionPtr
Slice::Container::createException(const string& name, const ExceptionPtr& base, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
ExceptionPtr p = ExceptionPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
p->updateIncludeLevel();
return p;
@@ -400,12 +400,12 @@ StructPtr
Slice::Container::createStruct(const string& name, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
StructPtr p = StructPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
p->updateIncludeLevel();
return p;
@@ -434,12 +434,12 @@ SequencePtr
Slice::Container::createSequence(const string& name, const TypePtr& type, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
SequencePtr p = SequencePtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -467,12 +467,12 @@ DictionaryPtr
Slice::Container::createDictionary(const string& name, const TypePtr& keyType, const TypePtr& valueType, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DictionaryPtr p = DictionaryPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -500,12 +500,12 @@ EnumPtr
Slice::Container::createEnum(const string& name, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
EnumPtr p = EnumPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -533,12 +533,12 @@ EnumeratorPtr
Slice::Container::createEnumerator(const string& name)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
EnumeratorPtr p = EnumeratorPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -593,9 +593,9 @@ Slice::Container::lookupType(const string& scoped, bool printError)
"LocalObject"
};
- for (unsigned int i = 0; i < sizeof(builtinTable) / sizeof(const char*); ++i)
+ for(unsigned int i = 0; i < sizeof(builtinTable) / sizeof(const char*); ++i)
{
- if (sc == builtinTable[i])
+ if(sc == builtinTable[i])
{
TypeList result;
result.push_back(_unit->builtin(static_cast<Builtin::Kind>(i)));
@@ -625,30 +625,30 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
//
// Absolute scoped name?
//
- if (sc.size() >= 2 && sc[0] == ':')
+ if(sc.size() >= 2 && sc[0] == ':')
{
return _unit->lookupTypeNoBuiltin(sc.substr(2), printError);
}
TypeList results;
- if (sc.rfind('*') == sc.length() - 1)
+ if(sc.rfind('*') == sc.length() - 1)
{
//
// Proxies.
//
ContainedList matches = _unit->findContents(thisScope() + sc.substr(0, sc.length() - 1));
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if (def)
+ if(def)
{
continue; // Ignore class definitions
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if (!cl)
+ if(!cl)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -666,18 +666,18 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
// Non-Proxies.
//
ContainedList matches = _unit->findContents(thisScope() + sc);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if (def)
+ if(def)
{
continue; // Ignore class definitions
}
ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
- if (ex)
+ if(ex)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -688,9 +688,9 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
}
TypePtr type = TypePtr::dynamicCast(*p);
- if (!type)
+ if(!type)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -703,12 +703,12 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
}
}
- if (results.empty())
+ if(results.empty())
{
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if (!contained)
+ if(!contained)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -741,27 +741,27 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
//
// Absolute scoped name?
//
- if (sc.size() >= 2 && sc[0] == ':')
+ if(sc.size() >= 2 && sc[0] == ':')
{
return _unit->lookupContained(sc.substr(2), printError);
}
ContainedList matches = _unit->findContents(thisScope() + sc);
ContainedList results;
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
- if (!ClassDefPtr::dynamicCast(*p)) // Ignore class definitions
+ if(!ClassDefPtr::dynamicCast(*p)) // Ignore class definitions
{
results.push_back(*p);
}
}
- if (results.empty())
+ if(results.empty())
{
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if (!contained)
+ if(!contained)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -782,18 +782,18 @@ ExceptionPtr
Slice::Container::lookupException(const string& scoped, bool printError)
{
ContainedList contained = lookupContained(scoped, printError);
- if (contained.empty())
+ if(contained.empty())
{
return 0;
}
ExceptionList exceptions;
- for (ContainedList::iterator p = contained.begin(); p != contained.end(); ++p)
+ for(ContainedList::iterator p = contained.begin(); p != contained.end(); ++p)
{
ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
- if (!ex)
+ if(!ex)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += scoped;
@@ -812,10 +812,10 @@ ModuleList
Slice::Container::modules()
{
ModuleList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ModulePtr q = ModulePtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -827,10 +827,10 @@ ClassList
Slice::Container::classes()
{
ClassList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ClassDefPtr q = ClassDefPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -842,10 +842,10 @@ ExceptionList
Slice::Container::exceptions()
{
ExceptionList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -857,10 +857,10 @@ StructList
Slice::Container::structs()
{
StructList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
StructPtr q = StructPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -872,10 +872,10 @@ SequenceList
Slice::Container::sequences()
{
SequenceList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
SequencePtr q = SequencePtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -887,10 +887,10 @@ DictionaryList
Slice::Container::dictionaries()
{
DictionaryList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DictionaryPtr q = DictionaryPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -902,10 +902,10 @@ EnumList
Slice::Container::enums()
{
EnumList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
EnumPtr q = EnumPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -916,16 +916,16 @@ Slice::Container::enums()
bool
Slice::Container::hasNonLocalClassDecls()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if (cl && !cl->isLocal())
+ if(cl && !cl->isLocal())
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasNonLocalClassDecls())
+ if(container && container->hasNonLocalClassDecls())
{
return true;
}
@@ -937,15 +937,15 @@ Slice::Container::hasNonLocalClassDecls()
bool
Slice::Container::hasClassDecls()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (ClassDeclPtr::dynamicCast(*p))
+ if(ClassDeclPtr::dynamicCast(*p))
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasClassDecls())
+ if(container && container->hasClassDecls())
{
return true;
}
@@ -957,15 +957,15 @@ Slice::Container::hasClassDecls()
bool
Slice::Container::hasClassDefs()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (ClassDefPtr::dynamicCast(*p))
+ if(ClassDefPtr::dynamicCast(*p))
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasClassDefs())
+ if(container && container->hasClassDefs())
{
return true;
}
@@ -977,20 +977,20 @@ Slice::Container::hasClassDefs()
bool
Slice::Container::hasOtherConstructedOrExceptions()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (ConstructedPtr::dynamicCast(*p) && !ClassDeclPtr::dynamicCast(*p) && !ClassDefPtr::dynamicCast(*p))
+ if(ConstructedPtr::dynamicCast(*p) && !ClassDeclPtr::dynamicCast(*p) && !ClassDefPtr::dynamicCast(*p))
{
return true;
}
- if (ExceptionPtr::dynamicCast(*p))
+ if(ExceptionPtr::dynamicCast(*p))
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasOtherConstructedOrExceptions())
+ if(container && container->hasOtherConstructedOrExceptions())
{
return true;
}
@@ -1004,7 +1004,7 @@ Slice::Container::thisScope()
{
string s;
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if (contained)
+ if(contained)
{
s = contained->scoped();
}
@@ -1015,26 +1015,26 @@ Slice::Container::thisScope()
void
Slice::Container::mergeModules()
{
- for (ContainedList::iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ModulePtr mod1 = ModulePtr::dynamicCast(*p);
- if (!mod1)
+ if(!mod1)
{
continue;
}
ContainedList::iterator q = p;
++q;
- while (q != _contents.end())
+ while(q != _contents.end())
{
ModulePtr mod2 = ModulePtr::dynamicCast(*q);
- if (!mod2)
+ if(!mod2)
{
++q;
continue;
}
- if (mod1->name() != mod2->name())
+ if(mod1->name() != mod2->name())
{
++q;
continue;
@@ -1042,7 +1042,7 @@ Slice::Container::mergeModules()
mod1->_contents.splice(mod1->_contents.end(), mod2->_contents);
- if (mod1->_comment.length() < mod2->_comment.length())
+ if(mod1->_comment.length() < mod2->_comment.length())
{
mod1->_comment.swap(mod2->_comment);
}
@@ -1066,10 +1066,10 @@ Slice::Container::sort()
void
Slice::Container::sortContents()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container)
+ if(container)
{
container->sort();
container->sortContents();
@@ -1080,7 +1080,7 @@ Slice::Container::sortContents()
void
Slice::Container::visit(ParserVisitor* visitor)
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
(*p)->visit(visitor);
}
@@ -1090,10 +1090,10 @@ void
Slice::Container::containerRecDependencies(set<ConstructedPtr>& dependencies)
{
ContainedList::iterator p;
- for (p = _contents.begin(); p != _contents.end(); ++p)
+ for(p = _contents.begin(); p != _contents.end(); ++p)
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(*p);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -1112,7 +1112,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
bool local, bool localOther)
{
string definedOrDeclared;
- if (defined)
+ if(defined)
{
definedOrDeclared = "defined";
}
@@ -1121,7 +1121,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
definedOrDeclared = "declared";
}
- if (!intf && intfOther)
+ if(!intf && intfOther)
{
string msg = "class `";
msg += name;
@@ -1132,7 +1132,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if (intf && !intfOther)
+ if(intf && !intfOther)
{
string msg = "interface `";
msg += name;
@@ -1143,7 +1143,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if (!local && localOther)
+ if(!local && localOther)
{
string msg = "non-local `";
msg += name;
@@ -1154,7 +1154,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if (local && !localOther)
+ if(local && !localOther)
{
string msg = "local `";
msg += name;
@@ -1187,12 +1187,12 @@ Slice::Module::uses(const ContainedPtr&)
void
Slice::Module::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitModuleStart(this))
+ if(visitor->visitModuleStart(this))
{
Container::visit(visitor);
visitor->visitModuleEnd(this);
@@ -1276,12 +1276,12 @@ Slice::ClassDecl::visit(ParserVisitor* visitor)
void
Slice::ClassDecl::recDependencies(set<ConstructedPtr>& dependencies)
{
- if (_definition)
+ if(_definition)
{
_definition->containerRecDependencies(dependencies);
ClassList bases = _definition->bases();
ClassList::iterator p;
- for (p = bases.begin(); p != bases.end(); ++p)
+ for(p = bases.begin(); p != bases.end(); ++p)
{
(*p)->declaration()->recDependencies(dependencies);
}
@@ -1317,12 +1317,12 @@ Slice::ClassDef::createOperation(const string& name,
const ExceptionList& throws)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
OperationPtr p = OperationPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1346,11 +1346,11 @@ Slice::ClassDef::createOperation(const string& name,
allParams.insert(allParams.end(), outParams.begin(), outParams.end());
TypeStringList::const_iterator p = allParams.begin();
- while (p != allParams.end())
+ while(p != allParams.end())
{
TypeStringList::const_iterator q = p;
++q;
- while (q != allParams.end())
+ while(q != allParams.end())
{
//
// Complain about duplicate parameters only if they are
@@ -1359,7 +1359,7 @@ Slice::ClassDef::createOperation(const string& name,
// signature (but the missing parameters have been reported
// already).
//
- if (p->second == q->second && p->second != "")
+ if(p->second == q->second && p->second != "")
{
string msg = "duplicate parameter `";
msg += p->second;
@@ -1373,10 +1373,10 @@ Slice::ClassDef::createOperation(const string& name,
}
}
- if (name == this->name())
+ if(name == this->name())
{
string msg;
- if (isInterface())
+ if(isInterface())
{
msg = "interface name `";
}
@@ -1401,12 +1401,12 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
assert(!isInterface());
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1425,10 +1425,10 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (name == this->name())
+ if(name == this->name())
{
string msg;
- if (isInterface())
+ if(isInterface())
{
msg = "interface name `";
}
@@ -1467,7 +1467,7 @@ Slice::ClassDef::allBases()
ClassList result = _bases;
result.sort();
result.unique();
- for (ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
+ for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
ClassList li = (*p)->allBases();
result.merge(li);
@@ -1480,10 +1480,10 @@ OperationList
Slice::ClassDef::operations()
{
OperationList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
OperationPtr q = OperationPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1497,7 +1497,7 @@ Slice::ClassDef::allOperations()
OperationList result = operations();
result.sort();
result.unique();
- for (ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
+ for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
OperationList li = (*p)->allOperations();
result.merge(li);
@@ -1510,10 +1510,10 @@ DataMemberList
Slice::ClassDef::dataMembers()
{
DataMemberList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1524,19 +1524,19 @@ Slice::ClassDef::dataMembers()
bool
Slice::ClassDef::isAbstract()
{
- if (isInterface() || _bases.size() > 1) // Is this an interface, or does it derive from interfaces?
+ if(isInterface() || _bases.size() > 1) // Is this an interface, or does it derive from interfaces?
{
return true;
}
- if (!_bases.empty() && _bases.front()->isAbstract())
+ if(!_bases.empty() && _bases.front()->isAbstract())
{
return true;
}
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (OperationPtr::dynamicCast(*p))
+ if(OperationPtr::dynamicCast(*p))
{
return true;
}
@@ -1580,12 +1580,12 @@ Slice::ClassDef::uses(const ContainedPtr&)
void
Slice::ClassDef::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitClassDefStart(this))
+ if(visitor->visitClassDefStart(this))
{
Container::visit(visitor);
visitor->visitClassDefEnd(this);
@@ -1607,7 +1607,7 @@ Slice::ClassDef::ClassDef(const ContainerPtr& container, const string& name, boo
// interfaces
//
#ifndef NDEBUG
- for (ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
+ for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
assert(p == _bases.begin() || (*p)->isInterface());
}
@@ -1646,12 +1646,12 @@ DataMemberPtr
Slice::Exception::createDataMember(const string& name, const TypePtr& type)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1670,7 +1670,7 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (name == this->name())
+ if(name == this->name())
{
string msg = "exception name `";
msg += name;
@@ -1688,10 +1688,10 @@ DataMemberList
Slice::Exception::dataMembers()
{
DataMemberList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1709,7 +1709,7 @@ ExceptionList
Slice::Exception::allBases()
{
ExceptionList result;
- if (_base)
+ if(_base)
{
result = _base->allBases();
result.push_front(_base);
@@ -1739,12 +1739,12 @@ Slice::Exception::uses(const ContainedPtr&)
void
Slice::Exception::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitExceptionStart(this))
+ if(visitor->visitExceptionStart(this))
{
Container::visit(visitor);
visitor->visitExceptionEnd(this);
@@ -1768,12 +1768,12 @@ DataMemberPtr
Slice::Struct::createDataMember(const string& name, const TypePtr& type)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1792,7 +1792,7 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (name == this->name())
+ if(name == this->name())
{
string msg = "struct name `";
msg += name;
@@ -1801,7 +1801,7 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (type.get() == this)
+ if(type.get() == this)
{
string msg = "struct `";
msg += name;
@@ -1819,10 +1819,10 @@ DataMemberList
Slice::Struct::dataMembers()
{
DataMemberList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1845,12 +1845,12 @@ Slice::Struct::uses(const ContainedPtr&)
void
Slice::Struct::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitStructStart(this))
+ if(visitor->visitStructStart(this))
{
Container::visit(visitor);
visitor->visitStructEnd(this);
@@ -1892,7 +1892,7 @@ bool
Slice::Sequence::uses(const ContainedPtr& contained)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -1910,7 +1910,7 @@ void
Slice::Sequence::recDependencies(set<ConstructedPtr>& dependencies)
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(_type);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -1953,7 +1953,7 @@ Slice::Dictionary::uses(const ContainedPtr& contained)
{
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_keyType);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -1961,7 +1961,7 @@ Slice::Dictionary::uses(const ContainedPtr& contained)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_valueType);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -1981,7 +1981,7 @@ Slice::Dictionary::recDependencies(set<ConstructedPtr>& dependencies)
{
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(_keyType);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -1990,7 +1990,7 @@ Slice::Dictionary::recDependencies(set<ConstructedPtr>& dependencies)
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(_valueType);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -2118,7 +2118,7 @@ Slice::Operation::uses(const ContainedPtr& contained)
{
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_returnType);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2126,19 +2126,19 @@ Slice::Operation::uses(const ContainedPtr& contained)
TypeStringList::const_iterator p;
- for (p = _inParams.begin(); p != _inParams.end(); ++p)
+ for(p = _inParams.begin(); p != _inParams.end(); ++p)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(p->first);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
}
- for (p = _outParams.begin(); p != _outParams.end(); ++p)
+ for(p = _outParams.begin(); p != _outParams.end(); ++p)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(p->first);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2146,10 +2146,10 @@ Slice::Operation::uses(const ContainedPtr& contained)
ExceptionList::const_iterator q;
- for (q = _throws.begin(); q != _throws.end(); ++q)
+ for(q = _throws.begin(); q != _throws.end(); ++q)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(*q);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2196,7 +2196,7 @@ bool
Slice::DataMember::uses(const ContainedPtr& contained)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2239,18 +2239,18 @@ Slice::Unit::setComment(const string& comment)
_currentComment = "";
string::size_type end = 0;
- while (true)
+ while(true)
{
string::size_type begin = comment.find_first_not_of(" \t\r\n*", end);
- if (begin == string::npos)
+ if(begin == string::npos)
{
break;
}
end = comment.find('\n', begin);
- if (end != string::npos)
+ if(end != string::npos)
{
- if (end + 1 > begin)
+ if(end + 1 > begin)
{
_currentComment += comment.substr(begin, end + 1 - begin);
}
@@ -2258,9 +2258,9 @@ Slice::Unit::setComment(const string& comment)
else
{
end = comment.find_last_not_of(" \t\r\n*");
- if (end != string::npos)
+ if(end != string::npos)
{
- if (end + 1 > begin)
+ if(end + 1 > begin)
{
_currentComment += comment.substr(begin, end + 1 - begin);
}
@@ -2297,13 +2297,13 @@ Slice::Unit::scanPosition(const char* s)
string::size_type idx;
idx = line.find("line");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx + 4);
}
idx = line.find_first_not_of(" \t\r#");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
@@ -2311,18 +2311,18 @@ Slice::Unit::scanPosition(const char* s)
_currentLine = atoi(line.c_str()) - 1;
idx = line.find_first_of(" \t\r");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
idx = line.find_first_not_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
idx = line.find_first_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
_currentFile = line.substr(0, idx);
line.erase(0, idx + 1);
@@ -2333,21 +2333,21 @@ Slice::Unit::scanPosition(const char* s)
}
idx = line.find_first_not_of(" \t\r");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
int val = atoi(line.c_str());
- if (val == 1)
+ if(val == 1)
{
- if (++_currentIncludeLevel == 1)
+ if(++_currentIncludeLevel == 1)
{
- if (find(_includeFiles.begin(), _includeFiles.end(), _currentFile) == _includeFiles.end())
+ if(find(_includeFiles.begin(), _includeFiles.end(), _currentFile) == _includeFiles.end())
{
_includeFiles.push_back(_currentFile);
}
}
}
- else if (val == 2)
+ else if(val == 2)
{
--_currentIncludeLevel;
}
@@ -2355,7 +2355,7 @@ Slice::Unit::scanPosition(const char* s)
}
else
{
- if (_currentIncludeLevel == 0)
+ if(_currentIncludeLevel == 0)
{
_topLevelFile = _currentFile;
}
@@ -2366,7 +2366,7 @@ Slice::Unit::scanPosition(const char* s)
int
Slice::Unit::currentIncludeLevel()
{
- if (_all)
+ if(_all)
{
return 0;
}
@@ -2434,9 +2434,9 @@ Slice::Unit::removeContent(const ContainedPtr& contained)
map<string, ContainedList>::iterator p = _contentMap.find(scoped);
assert(p != _contentMap.end());
ContainedList::iterator q;
- for (q = p->second.begin(); q != p->second.end(); ++q)
+ for(q = p->second.begin(); q != p->second.end(); ++q)
{
- if (q->get() == contained.get())
+ if(q->get() == contained.get())
{
p->second.erase(q);
return;
@@ -2453,7 +2453,7 @@ Slice::Unit::findContents(const string& scoped)
map<string, ContainedList>::const_iterator p = _contentMap.find(scoped);
- if (p != _contentMap.end())
+ if(p != _contentMap.end())
{
return p->second;
}
@@ -2472,10 +2472,10 @@ Slice::Unit::findDerivedClasses(const ClassDefPtr& cl)
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ClassDefPtr r = ClassDefPtr::dynamicCast(*q);
- if (r)
+ if(r)
{
ClassList bases = r->bases();
- if (find(bases.begin(), bases.end(), cl) != bases.end())
+ if(find(bases.begin(), bases.end(), cl) != bases.end())
{
derived.push_back(r);
}
@@ -2496,10 +2496,10 @@ Slice::Unit::findDerivedExceptions(const ExceptionPtr& ex)
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ExceptionPtr r = ExceptionPtr::dynamicCast(*q);
- if (r)
+ if(r)
{
ExceptionPtr base = r->base();
- if (base && base == ex)
+ if(base && base == ex)
{
derived.push_back(r);
}
@@ -2519,7 +2519,7 @@ Slice::Unit::findUsedBy(const ContainedPtr& contained)
{
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
- if ((*q)->uses(contained))
+ if((*q)->uses(contained))
{
usedBy.push_back(*q);
}
@@ -2538,14 +2538,14 @@ Slice::Unit::usesProxies()
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
- if (decl && !decl->isLocal())
+ if(decl && !decl->isLocal())
{
return true;
}
}
}
- if (_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
+ if(_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
{
return true;
}
@@ -2561,25 +2561,25 @@ Slice::Unit::usesNonLocals()
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ConstructedPtr constr = ConstructedPtr::dynamicCast(*q);
- if (constr && !constr->isLocal())
+ if(constr && !constr->isLocal())
{
return true;
}
ExceptionPtr exc = ExceptionPtr::dynamicCast(*q);
- if (exc && !exc->isLocal())
+ if(exc && !exc->isLocal())
{
return true;
}
}
}
- if (_builtins.find(Builtin::KindObject) != _builtins.end())
+ if(_builtins.find(Builtin::KindObject) != _builtins.end())
{
return true;
}
- if (_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
+ if(_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
{
return true;
}
@@ -2610,14 +2610,14 @@ Slice::Unit::parse(FILE* file, bool debug)
yyin = file;
int status = yyparse();
- if (_errors)
+ if(_errors)
{
status = EXIT_FAILURE;
}
- if (status == EXIT_FAILURE)
+ if(status == EXIT_FAILURE)
{
- while (!_containerStack.empty())
+ while(!_containerStack.empty())
{
popContainer();
}
@@ -2643,7 +2643,7 @@ Slice::Unit::destroy()
void
Slice::Unit::visit(ParserVisitor* visitor)
{
- if (visitor->visitUnitStart(this))
+ if(visitor->visitUnitStart(this))
{
Container::visit(visitor);
visitor->visitUnitEnd(this);
@@ -2654,7 +2654,7 @@ BuiltinPtr
Slice::Unit::builtin(Builtin::Kind kind)
{
map<Builtin::Kind, BuiltinPtr>::const_iterator p = _builtins.find(kind);
- if (p != _builtins.end())
+ if(p != _builtins.end())
{
return p->second;
}