summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-07-27 15:54:11 +0000
committerMarc Laukien <marc@zeroc.com>2001-07-27 15:54:11 +0000
commit46fdccd4eed746106dc138cb79fb1c95ed143532 (patch)
tree3dd0fb2ece313646766659f60d158b2d435e0c69 /cpp/src
parentformat changes, bug fix (diff)
downloadice-46fdccd4eed746106dc138cb79fb1c95ed143532.tar.bz2
ice-46fdccd4eed746106dc138cb79fb1c95ed143532.tar.xz
ice-46fdccd4eed746106dc138cb79fb1c95ed143532.zip
added spacing
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/Grammer.y38
-rw-r--r--cpp/src/Slice/OutputUtil.cpp12
-rw-r--r--cpp/src/Slice/Parser.cpp268
-rw-r--r--cpp/src/Slice/Scanner.l22
-rw-r--r--cpp/src/slice2cpp/Gen.cpp290
-rw-r--r--cpp/src/slice2cpp/GenUtil.cpp74
-rw-r--r--cpp/src/slice2cpp/Main.cpp50
-rw-r--r--cpp/src/slice2docbook/Gen.cpp122
-rw-r--r--cpp/src/slice2docbook/GenUtil.cpp34
-rw-r--r--cpp/src/slice2docbook/Main.cpp54
10 files changed, 482 insertions, 482 deletions
diff --git a/cpp/src/Slice/Grammer.y b/cpp/src/Slice/Grammer.y
index a94cd0bd53e..5fdee6c3963 100644
--- a/cpp/src/Slice/Grammer.y
+++ b/cpp/src/Slice/Grammer.y
@@ -170,7 +170,7 @@ module_def
StringTokPtr ident = StringTokPtr::dynamicCast($2);
ContainerPtr cont = unit -> currentContainer();
ModulePtr module = cont -> createModule(ident -> v);
- if(!module)
+ if (!module)
YYERROR; // Can't continue, jump to next yyerrok
unit -> pushContainer(module);
}
@@ -221,13 +221,13 @@ class_def
ContainerPtr cont = unit -> currentContainer();
ClassDefPtr base = ClassDefPtr::dynamicCast($4);
ClassListTokPtr bases = ClassListTokPtr::dynamicCast($5);
- if(base)
+ if (base)
bases -> v.push_front(base);
ClassDefPtr cl = cont -> createClassDef(ident -> v,
local -> v,
false,
bases -> v);
- if(!cl)
+ if (!cl)
YYERROR; // Can't continue, jump to next yyerrok
unit -> pushContainer(cl);
}
@@ -246,10 +246,10 @@ class_extends
ContainerPtr cont = unit -> currentContainer();
list<TypePtr> types = cont -> lookupType(scoped -> v);
$$ = 0;
- if(!types.empty())
+ if (!types.empty())
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(types.front());
- if(!cl)
+ if (!cl)
{
string msg = "`";
msg += scoped -> v;
@@ -259,7 +259,7 @@ class_extends
else
{
ClassDefPtr def = cl -> definition();
- if(!def)
+ if (!def)
{
string msg = "`";
msg += scoped -> v;
@@ -319,7 +319,7 @@ interface_def
local -> v,
true,
bases -> v);
- if(!cl)
+ if (!cl)
YYERROR; // Can't continue, jump to next yyerrok
unit -> pushContainer(cl);
}
@@ -339,10 +339,10 @@ interface_list
StringTokPtr scoped = StringTokPtr::dynamicCast($1);
ContainerPtr cont = unit -> currentContainer();
list<TypePtr> types = cont -> lookupType(scoped -> v);
- if(!types.empty())
+ if (!types.empty())
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(types.front());
- if(!cl || !cl -> isInterface())
+ if (!cl || !cl -> isInterface())
{
string msg = "`";
msg += scoped -> v;
@@ -352,7 +352,7 @@ interface_list
else
{
ClassDefPtr def = cl -> definition();
- if(!def)
+ if (!def)
{
string msg = "`";
msg += scoped -> v;
@@ -373,10 +373,10 @@ interface_list
StringTokPtr scoped = StringTokPtr::dynamicCast($1);
ContainerPtr cont = unit -> currentContainer();
list<TypePtr> types = cont -> lookupType(scoped -> v);
- if(!types.empty())
+ if (!types.empty())
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(types.front());
- if(!cl || !cl -> isInterface())
+ if (!cl || !cl -> isInterface())
{
string msg = "`";
msg += scoped -> v;
@@ -386,7 +386,7 @@ interface_list
else
{
ClassDefPtr def = cl -> definition();
- if(!def)
+ if (!def)
{
string msg = "`";
msg += scoped -> v;
@@ -549,7 +549,7 @@ type
StringTokPtr scoped = StringTokPtr::dynamicCast($1);
ContainerPtr cont = unit -> currentContainer();
list<TypePtr> types = cont -> lookupType(scoped -> v);
- if(types.empty())
+ if (types.empty())
YYERROR; // Can't continue, jump to next yyerrok
$$ = types.front();
}
@@ -558,14 +558,14 @@ type
StringTokPtr scoped = StringTokPtr::dynamicCast($1);
ContainerPtr cont = unit -> currentContainer();
list<TypePtr> types = cont -> lookupType(scoped -> v);
- if(types.empty())
+ if (types.empty())
YYERROR; // Can't continue, jump to next yyerrok
- for(list<TypePtr>::iterator p = types.begin();
+ for (list<TypePtr>::iterator p = types.begin();
p != types.end();
++p)
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if(!cl)
+ if (!cl)
{
string msg = "`";
msg += scoped -> v;
@@ -656,7 +656,7 @@ identifier_list
$$ = ens;
ContainerPtr cont = unit -> currentContainer();
EnumeratorPtr en = cont -> createEnumerator(ident -> v);
- if(en)
+ if (en)
ens -> v.push_front(ident -> v);
}
| ICE_IDENTIFIER
@@ -666,7 +666,7 @@ identifier_list
$$ = ens;
ContainerPtr cont = unit -> currentContainer();
EnumeratorPtr en = cont -> createEnumerator(ident -> v);
- if(en)
+ if (en)
ens -> v.push_front(ident -> v);
}
;
diff --git a/cpp/src/Slice/OutputUtil.cpp b/cpp/src/Slice/OutputUtil.cpp
index 7e2c6ade881..5a34d525bfc 100644
--- a/cpp/src/Slice/OutputUtil.cpp
+++ b/cpp/src/Slice/OutputUtil.cpp
@@ -60,9 +60,9 @@ Slice::Output::open(const char* s)
void
Slice::Output::print(const char* s)
{
- for(unsigned int i = 0; i < strlen(s); ++i)
+ for (unsigned int i = 0; i < strlen(s); ++i)
{
- if(s[i] == '\n')
+ if (s[i] == '\n')
_pos = 0;
else
++_pos;
@@ -143,7 +143,7 @@ Slice::Output::nl()
if (_useTab)
{
- while(indent >= 8)
+ while (indent >= 8)
{
indent -= 8;
_out << '\t';
@@ -152,7 +152,7 @@ Slice::Output::nl()
}
else
{
- while(indent >= _indentSize)
+ while (indent >= _indentSize)
{
indent -= _indentSize;
_out << " ";
@@ -160,7 +160,7 @@ Slice::Output::nl()
}
}
- while(indent > 0)
+ while (indent > 0)
{
--indent;
_out << ' ';
@@ -192,7 +192,7 @@ Slice::Output::eb()
void
Slice::Output::sp()
{
- if(_separator)
+ if (_separator)
_out << '\n';
}
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index f5d8325ba27..69ef9c1eb0d 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -153,10 +153,10 @@ Slice::Contained::Contained(const ContainerPtr& container,
_name(name)
{
ContainedPtr cont = ContainedPtr::dynamicCast(_container);
- if(cont)
+ if (cont)
_scoped = cont -> scoped();
_scoped += "::" + _name;
- if(_unit)
+ if (_unit)
{
_unit -> addContent(this);
_comment = _unit -> currentComment();
@@ -166,7 +166,7 @@ Slice::Contained::Contained(const ContainerPtr& container,
bool
Slice::operator<(Contained& l, Contained& r)
{
- if(l.containedType() != r.containedType())
+ if (l.containedType() != r.containedType())
return static_cast<int>(l.containedType()) <
static_cast<int>(r.containedType());
@@ -196,12 +196,12 @@ ModulePtr
Slice::Container::createModule(const string& name)
{
ContainedList matches = _unit -> findContents(thisScope() + name);
- for(ContainedList::iterator p = matches.begin();
+ for (ContainedList::iterator p = matches.begin();
p != matches.end();
++p)
{
ModulePtr module = ModulePtr::dynamicCast(*p);
- if(module)
+ if (module)
continue; // Reopening modules is permissible
string msg = "redefinition of `";
@@ -221,14 +221,14 @@ Slice::Container::createClassDef(const string& name, bool local, bool intf,
const ClassList& bases)
{
ContainedList matches = _unit -> findContents(thisScope() + name);
- for(ContainedList::iterator p = matches.begin();
+ for (ContainedList::iterator p = matches.begin();
p != matches.end();
++p)
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if(cl)
+ if (cl)
{
- if(checkInterfaceAndLocal(name, false,
+ if (checkInterfaceAndLocal(name, false,
intf, cl -> isInterface(),
local, cl -> isLocal()))
continue;
@@ -237,13 +237,13 @@ Slice::Container::createClassDef(const string& name, bool local, bool intf,
}
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if(def)
+ if (def)
{
- if(_unit -> ignRedefs())
+ if (_unit -> ignRedefs())
return def;
string msg = "redefinition of ";
- if(intf)
+ if (intf)
msg += "interface";
else
msg += "class";
@@ -257,7 +257,7 @@ Slice::Container::createClassDef(const string& name, bool local, bool intf,
string msg = "redefinition of `";
msg += name;
msg += "' as ";
- if(intf)
+ if (intf)
msg += "interface";
else
msg += "class";
@@ -268,7 +268,7 @@ Slice::Container::createClassDef(const string& name, bool local, bool intf,
ClassDefPtr def = new ClassDef(this, name, local, intf, bases);
_contents.push_back(def);
- for(ContainedList::iterator q = matches.begin();
+ for (ContainedList::iterator q = matches.begin();
q != matches.end();
++q)
{
@@ -292,14 +292,14 @@ Slice::Container::createClassDecl(const string& name, bool local, bool intf)
ClassDefPtr def;
ContainedList matches = _unit -> findContents(thisScope() + name);
- for(ContainedList::iterator p = matches.begin();
+ for (ContainedList::iterator p = matches.begin();
p != matches.end();
++p)
{
ClassDefPtr clDef = ClassDefPtr::dynamicCast(*p);
- if(clDef)
+ if (clDef)
{
- if(checkInterfaceAndLocal(name, true,
+ if (checkInterfaceAndLocal(name, true,
intf, clDef -> isInterface(),
local, clDef -> isLocal()))
{
@@ -312,9 +312,9 @@ Slice::Container::createClassDecl(const string& name, bool local, bool intf)
}
ClassDeclPtr clDecl = ClassDeclPtr::dynamicCast(*p);
- if(clDecl)
+ if (clDecl)
{
- if(checkInterfaceAndLocal(name, false,
+ if (checkInterfaceAndLocal(name, false,
intf, clDecl -> isInterface(),
local, clDecl -> isLocal()))
continue;
@@ -325,7 +325,7 @@ Slice::Container::createClassDecl(const string& name, bool local, bool intf)
string msg = "declaration of already defined `";
msg += name;
msg += "' as ";
- if(intf)
+ if (intf)
msg += "interface";
else
msg += "class";
@@ -338,14 +338,14 @@ Slice::Container::createClassDecl(const string& name, bool local, bool intf)
// have a declaration for the class in this container, we don't
// create another one.
//
- for(ContainedList::iterator q = _contents.begin();
+ for (ContainedList::iterator q = _contents.begin();
q != _contents.end();
++q)
{
- if((*q) -> name() == name)
+ if ((*q) -> name() == name)
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*q);
- if(cl)
+ if (cl)
return cl;
assert(ClassDefPtr::dynamicCast(*q));
@@ -355,7 +355,7 @@ Slice::Container::createClassDecl(const string& name, bool local, bool intf)
ClassDeclPtr cl = new ClassDecl(this, name, local, intf);
_contents.push_back(cl);
- if(def)
+ if (def)
cl -> _definition = def;
return cl;
@@ -365,12 +365,12 @@ VectorPtr
Slice::Container::createVector(const string& name, const TypePtr& type)
{
ContainedList matches = _unit -> findContents(thisScope() + name);
- if(!matches.empty())
+ if (!matches.empty())
{
VectorPtr p = VectorPtr::dynamicCast(matches.front());
- if(p)
+ if (p)
{
- if(_unit -> ignRedefs())
+ if (_unit -> ignRedefs())
return p;
string msg = "redefinition of vector `";
@@ -396,12 +396,12 @@ EnumPtr
Slice::Container::createEnum(const string& name, const StringList& enumerators)
{
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;
string msg = "redefinition of enum `";
@@ -427,12 +427,12 @@ EnumeratorPtr
Slice::Container::createEnumerator(const std::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;
string msg = "redefinition of enumerator `";
@@ -458,12 +458,12 @@ NativePtr
Slice::Container::createNative(const string& name)
{
ContainedList matches = _unit -> findContents(thisScope() + name);
- if(!matches.empty())
+ if (!matches.empty())
{
NativePtr p = NativePtr::dynamicCast(matches.front());
- if(p)
+ if (p)
{
- if(_unit -> ignRedefs())
+ if (_unit -> ignRedefs())
return p;
string msg = "redefinition of native `";
@@ -506,11 +506,11 @@ Slice::Container::lookupType(const string& scoped, bool printError)
"LocalObject"
};
- for(unsigned int i = 0;
+ for (unsigned int i = 0;
i < sizeof(builtinTable) / sizeof(const char*);
++i)
{
- if(scoped == builtinTable[i])
+ if (scoped == builtinTable[i])
{
TypeList result;
result.push_back(_unit -> builtin(static_cast<Builtin::Kind>(i)));
@@ -526,17 +526,17 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
{
assert(!scoped.empty());
- if(scoped[0] == ':')
+ if (scoped[0] == ':')
return _unit -> lookupTypeNoBuiltin(scoped.substr(2), printError);
ContainedList matches =
_unit -> findContents(thisScope() + scoped);
- if(matches.empty())
+ if (matches.empty())
{
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if(!contained)
+ if (!contained)
{
- if(printError)
+ if (printError)
{
string msg = "`";
msg += scoped;
@@ -551,18 +551,18 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
else
{
TypeList results;
- for(ContainedList::iterator p = matches.begin();
+ for (ContainedList::iterator p = matches.begin();
p != matches.end();
++p)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(*p);
- if(cl)
+ if (cl)
continue; // Ignore class definitions
TypePtr type = TypePtr::dynamicCast(*p);
- if(!type)
+ if (!type)
{
- if(printError)
+ if (printError)
{
string msg = "`";
msg += scoped;
@@ -582,17 +582,17 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
{
assert(!scoped.empty());
- if(scoped[0] == ':')
+ if (scoped[0] == ':')
return _unit -> lookupContained(scoped.substr(2), printError);
ContainedList matches =
_unit -> findContents(thisScope() + scoped);
- if(matches.empty())
+ if (matches.empty())
{
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if(!contained)
+ if (!contained)
{
- if(printError)
+ if (printError)
{
string msg = "`";
msg += scoped;
@@ -607,11 +607,11 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
else
{
ContainedList results;
- for(ContainedList::iterator p = matches.begin();
+ for (ContainedList::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);
}
return results;
@@ -622,12 +622,12 @@ ModuleList
Slice::Container::modules()
{
ModuleList result;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
ModulePtr q = ModulePtr::dynamicCast(*p);
- if(q)
+ if (q)
result.push_back(q);
}
return result;
@@ -637,12 +637,12 @@ ClassList
Slice::Container::classes()
{
ClassList result;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
ClassDefPtr q = ClassDefPtr::dynamicCast(*p);
- if(q)
+ if (q)
result.push_back(q);
}
return result;
@@ -652,12 +652,12 @@ VectorList
Slice::Container::vectors()
{
VectorList result;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
VectorPtr q = VectorPtr::dynamicCast(*p);
- if(q)
+ if (q)
result.push_back(q);
}
return result;
@@ -667,12 +667,12 @@ EnumList
Slice::Container::enums()
{
EnumList result;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
EnumPtr q = EnumPtr::dynamicCast(*p);
- if(q)
+ if (q)
result.push_back(q);
}
return result;
@@ -682,12 +682,12 @@ NativeList
Slice::Container::natives()
{
NativeList result;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
NativePtr q = NativePtr::dynamicCast(*p);
- if(q)
+ if (q)
result.push_back(q);
}
return result;
@@ -702,16 +702,16 @@ Slice::Container::includeLevel()
bool
Slice::Container::hasProxies()
{
- for(ContainedList::const_iterator p = _contents.begin();
+ 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 -> hasProxies())
+ if (container && container -> hasProxies())
return true;
}
@@ -721,15 +721,15 @@ Slice::Container::hasProxies()
bool
Slice::Container::hasClassDecls()
{
- for(ContainedList::const_iterator p = _contents.begin();
+ 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;
}
@@ -739,15 +739,15 @@ Slice::Container::hasClassDecls()
bool
Slice::Container::hasClassDefs()
{
- for(ContainedList::const_iterator p = _contents.begin();
+ 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;
}
@@ -757,17 +757,17 @@ Slice::Container::hasClassDefs()
bool
Slice::Container::hasOtherConstructedTypes()
{
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
- if(ConstructedPtr::dynamicCast(*p) &&
+ if (ConstructedPtr::dynamicCast(*p) &&
!ClassDeclPtr::dynamicCast(*p) &&
!ClassDefPtr::dynamicCast(*p))
return true;
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container -> hasOtherConstructedTypes())
+ if (container && container -> hasOtherConstructedTypes())
return true;
}
@@ -779,7 +779,7 @@ Slice::Container::thisScope()
{
string s;
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if(contained)
+ if (contained)
s = contained -> scoped();
s += "::";
return s;
@@ -788,26 +788,26 @@ Slice::Container::thisScope()
void
Slice::Container::mergeModules()
{
- for(ContainedList::iterator p = _contents.begin();
+ 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;
@@ -816,7 +816,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 = mod2 -> _comment;
_unit -> removeContent(*q);
@@ -830,12 +830,12 @@ Slice::Container::mergeModules()
void
Slice::Container::sort()
{
- for(ContainedList::iterator p = _contents.begin();
+ for (ContainedList::iterator p = _contents.begin();
p != _contents.end();
++p)
{
ContainerPtr container = ModulePtr::dynamicCast(*p);
- if(container)
+ if (container)
container -> sort();
}
@@ -845,7 +845,7 @@ Slice::Container::sort()
void
Slice::Container::visit(ParserVisitor* visitor)
{
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
@@ -856,7 +856,7 @@ Slice::Container::visit(ParserVisitor* visitor)
Slice::Container::Container(const UnitPtr& unit)
: SyntaxTreeBase(unit)
{
- if(_unit)
+ if (_unit)
_includeLevel = _unit -> currentIncludeLevel();
else
_includeLevel = 0;
@@ -868,12 +868,12 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
bool local, bool localOther)
{
string definedOrDeclared;
- if(defined)
+ if (defined)
definedOrDeclared = "defined";
else
definedOrDeclared = "declared";
- if(!intf && intfOther)
+ if (!intf && intfOther)
{
string msg = "class `";
msg += name;
@@ -884,7 +884,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if(intf && !intfOther)
+ if (intf && !intfOther)
{
string msg = "interface `";
msg += name;
@@ -895,7 +895,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if(!local && localOther)
+ if (!local && localOther)
{
string msg = "non-local `";
msg += name;
@@ -906,7 +906,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if(local && !localOther)
+ if (local && !localOther)
{
string msg = "local `";
msg += name;
@@ -933,7 +933,7 @@ Slice::Module::containedType()
void
Slice::Module::visit(ParserVisitor* visitor)
{
- if(_includeLevel > 0)
+ if (_includeLevel > 0)
return;
visitor -> visitModuleStart(this);
@@ -1027,12 +1027,12 @@ Slice::ClassDef::createOperation(const string& name,
const TypeList& 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;
string msg = "redefinition of operation `";
@@ -1054,13 +1054,13 @@ Slice::ClassDef::createOperation(const string& name,
allParams.insert(allParams.end(), outParams.begin(), outParams.end());
TypeStringList::iterator p = allParams.begin();
- while(p != allParams.end())
+ while (p != allParams.end())
{
TypeStringList::iterator q = p;
++q;
- while(q != allParams.end())
+ while (q != allParams.end())
{
- if(p -> second == q -> second)
+ if (p -> second == q -> second)
{
string msg = "duplicate parameter `";
msg += p -> second;
@@ -1074,10 +1074,10 @@ Slice::ClassDef::createOperation(const string& name,
}
}
- if(name == this -> name())
+ if (name == this -> name())
{
string msg;
- if(isInterface())
+ if (isInterface())
msg = "interface name `";
else
msg = "class name `";
@@ -1099,12 +1099,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;
string msg = "redefinition of data member `";
@@ -1121,10 +1121,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 `";
else
msg = "class name `";
@@ -1151,7 +1151,7 @@ Slice::ClassDef::allBases()
ClassList result = _bases;
result.sort();
result.unique();
- for(ClassList::iterator p = _bases.begin();
+ for (ClassList::iterator p = _bases.begin();
p != _bases.end();
++p)
{
@@ -1166,12 +1166,12 @@ OperationList
Slice::ClassDef::operations()
{
OperationList result;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
OperationPtr q = OperationPtr::dynamicCast(*p);
- if(q)
+ if (q)
result.push_back(q);
}
return result;
@@ -1183,7 +1183,7 @@ Slice::ClassDef::allOperations()
OperationList result = operations();
result.sort();
result.unique();
- for(ClassList::iterator p = _bases.begin();
+ for (ClassList::iterator p = _bases.begin();
p != _bases.end();
++p)
{
@@ -1198,12 +1198,12 @@ DataMemberList
Slice::ClassDef::dataMembers()
{
DataMemberList result;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if(q)
+ if (q)
result.push_back(q);
}
return result;
@@ -1212,17 +1212,17 @@ Slice::ClassDef::dataMembers()
bool
Slice::ClassDef::isAbstract()
{
- if(isInterface())
+ if (isInterface())
return true;
- if(!_bases.empty() && _bases.front() -> isAbstract())
+ if (!_bases.empty() && _bases.front() -> isAbstract())
return true;
- for(ContainedList::const_iterator p = _contents.begin();
+ for (ContainedList::const_iterator p = _contents.begin();
p != _contents.end();
++p)
{
- if(OperationPtr::dynamicCast(*p))
+ if (OperationPtr::dynamicCast(*p))
return true;
}
@@ -1250,7 +1250,7 @@ Slice::ClassDef::containedType()
void
Slice::ClassDef::visit(ParserVisitor* visitor)
{
- if(_includeLevel > 0)
+ if (_includeLevel > 0)
return;
visitor -> visitClassDefStart(this);
@@ -1275,7 +1275,7 @@ Slice::ClassDef::ClassDef(const ContainerPtr& container,
// interfaces
//
#ifndef NDEBUG
- for(ClassList::iterator p = _bases.begin();
+ for (ClassList::iterator p = _bases.begin();
p != _bases.end();
++p)
{
@@ -1517,10 +1517,10 @@ Slice::Unit::setComment(const std::string& comment)
_currentComment.empty();
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);
@@ -1549,26 +1549,26 @@ 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);
_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);
@@ -1577,29 +1577,29 @@ Slice::Unit::scanPosition(const char* s)
_currentFile = line;
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(),
+ if (find(_includeFiles.begin(), _includeFiles.end(),
_currentFile) == _includeFiles.end())
{
_includeFiles.push_back(_currentFile);
}
}
}
- else if(val == 2)
+ else if (val == 2)
{
--_currentIncludeLevel;
}
}
else
{
- if(_currentIncludeLevel == 0)
+ if (_currentIncludeLevel == 0)
_topLevelFile = _currentFile;
}
}
@@ -1608,7 +1608,7 @@ Slice::Unit::scanPosition(const char* s)
int
Slice::Unit::currentIncludeLevel()
{
- if(_all)
+ if (_all)
return 0;
else
return _currentIncludeLevel;
@@ -1672,9 +1672,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;
@@ -1691,7 +1691,7 @@ Slice::Unit::findContents(const string& scoped)
map<string, ContainedList >::iterator p = _contentMap.find(scoped);
- if(p != _contentMap.end())
+ if (p != _contentMap.end())
return p -> second;
else
return ContainedList();
@@ -1722,7 +1722,7 @@ Slice::Unit::parse(FILE* file, bool debug)
extern FILE* yyin;
yyin = file;
int status = yyparse();
- if(yynerrs)
+ if (yynerrs)
status = EXIT_FAILURE;
assert(_containerStack.size() == 1);
@@ -1751,7 +1751,7 @@ BuiltinPtr
Slice::Unit::builtin(Builtin::Kind kind)
{
map<Builtin::Kind, BuiltinPtr>::iterator p = _builtins.find(kind);
- if(p != _builtins.end())
+ if (p != _builtins.end())
return p -> second;
BuiltinPtr builtin = new Builtin(this, kind);
_builtins.insert(make_pair(kind, builtin));
diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l
index bbdd885a298..535dfc4eeaf 100644
--- a/cpp/src/Slice/Scanner.l
+++ b/cpp/src/Slice/Scanner.l
@@ -52,42 +52,42 @@ L [a-zA-Z_]
do
{
c = yyinput();
- if(c == '\n')
+ if (c == '\n')
unit -> nextLine();
}
- while(c != '\n' && c != EOF);
+ while (c != '\n' && c != EOF);
}
"/*" {
// C-style comment
string comment = yytext + 2;
- while(true)
+ while (true)
{
int c = yyinput();
comment += static_cast<char>(c);
- if(c == '\n')
+ if (c == '\n')
{
unit -> nextLine();
}
- else if(c == '*')
+ else if (c == '*')
{
int next = yyinput();
- if(next == '/')
+ if (next == '/')
break;
else
unput(next);
}
- else if(c == EOF)
+ else if (c == EOF)
{
unit -> warning("EOF in comment");
break;
}
}
- if(comment[0] == '*')
+ if (comment[0] == '*')
unit -> setComment(comment);
}
@@ -186,7 +186,7 @@ L [a-zA-Z_]
"\\"?{L}({L}|{D})* {
char* s = yytext;
- if(s[0] == '\\') // Strip leading backslash
+ if (s[0] == '\\') // Strip leading backslash
++s;
StringTokPtr ident = new StringTok;
@@ -198,7 +198,7 @@ L [a-zA-Z_]
"\\"?{L}({L}|{D})*{WS}*"(" {
char* s = yytext;
- if(s[0] == '\\') // Strip leading backslash
+ if (s[0] == '\\') // Strip leading backslash
++s;
StringTokPtr ident = new StringTok;
@@ -211,7 +211,7 @@ L [a-zA-Z_]
{WS} {
// Igore white-space
- if(yytext[0] == '\n')
+ if (yytext[0] == '\n')
unit -> nextLine();
}
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 1f4997233fd..dbe6030ac2f 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -30,7 +30,7 @@ struct ToIfdef
{
char operator()(char c)
{
- if(!isalnum(c))
+ if (!isalnum(c))
return '_';
else
return c;
@@ -47,33 +47,33 @@ Slice::Gen::Gen(const string& name,
_includePaths(includePaths),
_dllExport(dllExport)
{
- for(vector<string>::iterator p = _includePaths.begin();
+ 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 += '/';
}
- if(_dllExport.length())
+ if (_dllExport.length())
_dllExport = " " + _dllExport;
string::size_type pos = _base.rfind('/');
- if(pos != string::npos)
+ if (pos != string::npos)
_base.erase(0, pos + 1);
string fileH = _base + ".h";
string fileC = _base + ".cpp";
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;
@@ -105,7 +105,7 @@ void
Slice::Gen::generate(const UnitPtr& unit)
{
C << "\n#include <";
- if(_include.length())
+ if (_include.length())
C << _include << '/';
C << _base << ".h>";
@@ -113,7 +113,7 @@ Slice::Gen::generate(const UnitPtr& unit)
H << "\n#include <Ice/ObjectF.h>";
H << "\n#include <Ice/LocalObjectF.h>";
H << "\n#include <Ice/Native.h>";
- if(unit -> hasProxies())
+ if (unit -> hasProxies())
{
H << "\n#include <Ice/Proxy.h>";
H << "\n#include <Ice/Object.h>";
@@ -128,7 +128,7 @@ Slice::Gen::generate(const UnitPtr& unit)
}
StringList includes = unit -> includeFiles();
- for(StringList::iterator q = includes.begin();
+ for (StringList::iterator q = includes.begin();
q != includes.end();
++q)
{
@@ -185,20 +185,20 @@ string
Slice::Gen::changeInclude(const string& orig)
{
string file = orig;
- for(vector<string>::iterator p = _includePaths.begin();
+ for (vector<string>::iterator p = _includePaths.begin();
p != _includePaths.end();
++p)
{
- if(orig.compare(0, p -> length(), *p) == 0)
+ if (orig.compare(0, p -> length(), *p) == 0)
{
string s = orig.substr(p -> length());
- if(s.length() < file.length())
+ if (s.length() < file.length())
file = s;
}
}
string::size_type pos = file.rfind('.');
- if(pos != string::npos)
+ if (pos != string::npos)
file.erase(pos);
return file;
@@ -233,7 +233,7 @@ Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllEx
void
Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasOtherConstructedTypes())
+ if (!p -> hasOtherConstructedTypes())
return;
string name = p -> name();
@@ -245,7 +245,7 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasOtherConstructedTypes())
+ if (!p -> hasOtherConstructedTypes())
return;
H << sp;
@@ -258,17 +258,17 @@ Slice::Gen::TypesVisitor::visitVector(const VectorPtr& p)
string name = p -> name();
TypePtr subtype = p -> type();
string s = typeToString(subtype);
- if(s[0] == ':')
+ if (s[0] == ':')
s.insert(0, " ");
H << sp;
H << nl << "typedef ::std::vector<" << s << "> " << name << ';';
BuiltinPtr builtin = BuiltinPtr::dynamicCast(subtype);
- if(!builtin)
+ if (!builtin)
{
string scoped = p -> scoped();
string scope = p -> scope();
- if(scope.length())
+ if (scope.length())
scope.erase(0, 2);
H << sp;
@@ -282,7 +282,7 @@ Slice::Gen::TypesVisitor::visitVector(const VectorPtr& p)
C << sb;
C << nl << "__os -> write(::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.inc();
writeMarshalUnmarshalCode(C, subtype, "*p", true);
C.dec();
@@ -295,7 +295,7 @@ Slice::Gen::TypesVisitor::visitVector(const VectorPtr& p)
C << nl << "__is -> read(sz);";
// 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.zeroIndent();
C << nl << "#ifdef WIN32"; // STLBUG
@@ -323,17 +323,17 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
H << nl << "enum " << name;
H << sb;
StringList::iterator en = enumerators.begin();
- while(en != enumerators.end())
+ while (en != enumerators.end())
{
H << nl << *en;
- if(++en != enumerators.end())
+ if (++en != enumerators.end())
H << ',';
}
H << eb << ';';
string scoped = p -> scoped();
string scope = p -> scope();
- if(scope.length())
+ if (scope.length())
scope.erase(0, 2);
int sz = enumerators.size();
@@ -344,11 +344,11 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
C << sp;
C << nl << "void" << nl << scope << "::__write(::IceInternal::Stream* __os, " << scoped << " v)";
C << sb;
- if(sz <= numeric_limits<Ice::Byte>::max())
+ if (sz <= numeric_limits<Ice::Byte>::max())
C << nl << "__os -> write(static_cast< ::Ice::Byte>(v));";
- else if(sz <= numeric_limits<Ice::Short>::max())
+ else if (sz <= numeric_limits<Ice::Short>::max())
C << nl << "__os -> write(static_cast< ::Ice::Short>(v));";
- else if(sz <= numeric_limits<Ice::Int>::max())
+ else if (sz <= numeric_limits<Ice::Int>::max())
C << nl << "__os -> write(static_cast< ::Ice::Int>(v));";
else
C << nl << "__os -> write(static_cast< ::Ice::Long>(v));";
@@ -356,19 +356,19 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
C << sp;
C << nl << "void" << nl << scope << "::__read(::IceInternal::Stream* __is, " << scoped << "& v)";
C << sb;
- if(sz <= numeric_limits<Ice::Byte>::max())
+ if (sz <= numeric_limits<Ice::Byte>::max())
{
C << nl << "::Ice::Byte val;";
C << nl << "__is -> read(val);";
C << nl << "v = static_cast< " << scoped << ">(val);";
}
- else if(sz <= numeric_limits<Ice::Short>::max())
+ else if (sz <= numeric_limits<Ice::Short>::max())
{
C << nl << "::Ice::Short val;";
C << nl << "__is -> read(val);";
C << nl << "v = static_cast< " << scoped << ">(val);";
}
- else if(sz <= numeric_limits<Ice::Int>::max())
+ else if (sz <= numeric_limits<Ice::Int>::max())
{
C << nl << "::Ice::Int val;";
C << nl << "__is -> read(val);";
@@ -400,7 +400,7 @@ Slice::Gen::ProxyDeclVisitor::ProxyDeclVisitor(Output& h, Output& c, const strin
void
Slice::Gen::ProxyDeclVisitor::visitUnitStart(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -410,7 +410,7 @@ Slice::Gen::ProxyDeclVisitor::visitUnitStart(const UnitPtr& p)
void
Slice::Gen::ProxyDeclVisitor::visitUnitEnd(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -420,7 +420,7 @@ Slice::Gen::ProxyDeclVisitor::visitUnitEnd(const UnitPtr& p)
void
Slice::Gen::ProxyDeclVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
string name = p -> name();
@@ -432,7 +432,7 @@ Slice::Gen::ProxyDeclVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::ProxyDeclVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -442,7 +442,7 @@ Slice::Gen::ProxyDeclVisitor::visitModuleEnd(const ModulePtr& p)
void
Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
string name = p -> name();
@@ -459,7 +459,7 @@ Slice::Gen::ProxyVisitor::ProxyVisitor(Output& h, Output& c, const string& dllEx
void
Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -469,7 +469,7 @@ Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p)
void
Slice::Gen::ProxyVisitor::visitUnitEnd(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -479,7 +479,7 @@ Slice::Gen::ProxyVisitor::visitUnitEnd(const UnitPtr& p)
void
Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
string name = p -> name();
@@ -491,7 +491,7 @@ Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -501,7 +501,7 @@ Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p)
void
Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
string name = p -> name();
@@ -510,16 +510,16 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp;
H << nl << "class" << _dllExport << ' ' << name << " : ";
- if(bases.empty())
+ if (bases.empty())
H << "virtual public ::IceProxy::Ice::Object";
else
{
H.useCurrentPosAsIndent();
ClassList::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;
}
H.restoreIndent();
@@ -541,7 +541,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
void
Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
string scoped = p -> scoped();
@@ -566,7 +566,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
ContainerPtr container = p -> container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- if(cl -> isLocal())
+ if (cl -> isLocal())
return;
string name = p -> name();
@@ -584,9 +584,9 @@ 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)
{
- if(q != inParams.begin())
+ if (q != inParams.begin())
{
params += ", ";
paramsDecl += ", ";
@@ -601,9 +601,9 @@ Slice::Gen::ProxyVisitor::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 += ", ";
@@ -632,7 +632,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << nl << "::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase = __getDelegate();";
C << nl << "::IceDelegate" << scope << "* __del = dynamic_cast< ::IceDelegate" << scope << "*>(__delBase.get());";
C << nl;
- if(ret)
+ if (ret)
C << "return ";
C << "__del -> " << name << args << ";";
C << eb;
@@ -646,7 +646,7 @@ Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string&
void
Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -656,7 +656,7 @@ Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p)
void
Slice::Gen::DelegateVisitor::visitUnitEnd(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -666,7 +666,7 @@ Slice::Gen::DelegateVisitor::visitUnitEnd(const UnitPtr& p)
void
Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
string name = p -> name();
@@ -678,7 +678,7 @@ Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::DelegateVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -688,7 +688,7 @@ Slice::Gen::DelegateVisitor::visitModuleEnd(const ModulePtr& p)
void
Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
string name = p -> name();
@@ -696,16 +696,16 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp;
H << nl << "class" << _dllExport << ' ' << name << " : ";
- if(bases.empty())
+ if (bases.empty())
H << "virtual public ::IceDelegate::Ice::Object";
else
{
H.useCurrentPosAsIndent();
ClassList::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;
}
H.restoreIndent();
@@ -719,7 +719,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
void
Slice::Gen::DelegateVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
H << eb << ';';
@@ -730,7 +730,7 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
{
ContainerPtr container = p -> container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- if(cl -> isLocal())
+ if (cl -> isLocal())
return;
string name = p -> name();
@@ -745,9 +745,9 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
string params = "(";
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 += ", ";
args += ", ";
@@ -758,9 +758,9 @@ Slice::Gen::DelegateVisitor::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 += ", ";
args += ", ";
@@ -788,7 +788,7 @@ Slice::Gen::DelegateMVisitor::DelegateMVisitor(Output& h, Output& c, const strin
void
Slice::Gen::DelegateMVisitor::visitUnitStart(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -798,7 +798,7 @@ Slice::Gen::DelegateMVisitor::visitUnitStart(const UnitPtr& p)
void
Slice::Gen::DelegateMVisitor::visitUnitEnd(const UnitPtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -808,7 +808,7 @@ Slice::Gen::DelegateMVisitor::visitUnitEnd(const UnitPtr& p)
void
Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
string name = p -> name();
@@ -820,7 +820,7 @@ Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::DelegateMVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasProxies())
+ if (!p -> hasProxies())
return;
H << sp;
@@ -830,7 +830,7 @@ Slice::Gen::DelegateMVisitor::visitModuleEnd(const ModulePtr& p)
void
Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
string name = p -> name();
@@ -841,15 +841,15 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
H << 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::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 << ',';
}
}
@@ -863,7 +863,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
void
Slice::Gen::DelegateMVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
H << eb << ';';
@@ -874,7 +874,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
{
ContainerPtr container = p -> container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- if(cl -> isLocal())
+ if (cl -> isLocal())
return;
string name = p -> name();
@@ -892,9 +892,9 @@ Slice::Gen::DelegateMVisitor::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 += ", ";
@@ -909,9 +909,9 @@ Slice::Gen::DelegateMVisitor::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 += ", ";
@@ -938,22 +938,22 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << nl << retS << nl << "IceDelegateM" << scoped << paramsDecl;
C << sb;
C << nl << "::IceInternal::Outgoing __out(__emitter(), __reference());";
- if(ret || !outParams.empty() || !throws.empty())
+ if (ret || !outParams.empty() || !throws.empty())
C << nl << "::IceInternal::Stream* __is = __out.is();";
C << nl << "::IceInternal::Stream* __os = __out.os();";
C << nl << "__os -> write(\"" << name << "\");";
writeMarshalCode(C, inParams, 0);
- C << nl << "if(!__out.invoke())";
- if(!throws.empty())
+ C << nl << "if (!__out.invoke())";
+ if (!throws.empty())
{
C << sb;
C << nl << "::Ice::Int __exnum;";
C << nl << "__is -> read(__exnum);";
- C << nl << "switch(__exnum)";
+ C << nl << "switch (__exnum)";
C << sb;
TypeList::iterator r;
Ice::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;
@@ -961,7 +961,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
li.push_back(make_pair(*r, string("__ex")));
writeAllocateCode(C, li, 0);
writeUnmarshalCode(C, li, 0);
- if(ClassDeclPtr::dynamicCast(*r) || ProxyPtr::dynamicCast(*r))
+ if (ClassDeclPtr::dynamicCast(*r) || ProxyPtr::dynamicCast(*r))
C << nl << "__ex -> _throw();";
else
C << nl << "throw __ex;";
@@ -979,7 +979,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
}
writeAllocateCode(C, TypeStringList(), ret);
writeUnmarshalCode(C, outParams, ret);
- if(ret)
+ if (ret)
C << nl << "return __ret;";
C << eb;
}
@@ -992,7 +992,7 @@ Slice::Gen::ObjectDeclVisitor::ObjectDeclVisitor(Output& h, Output& c, const str
void
Slice::Gen::ObjectDeclVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasClassDecls())
+ if (!p -> hasClassDecls())
return;
string name = p -> name();
@@ -1004,7 +1004,7 @@ Slice::Gen::ObjectDeclVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::ObjectDeclVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasClassDecls())
+ if (!p -> hasClassDecls())
return;
H << sp;
@@ -1028,7 +1028,7 @@ Slice::Gen::ObjectVisitor::ObjectVisitor(Output& h, Output& c, const string& dll
void
Slice::Gen::ObjectVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasClassDefs())
+ if (!p -> hasClassDefs())
return;
string name = p -> name();
@@ -1040,7 +1040,7 @@ Slice::Gen::ObjectVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::ObjectVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasClassDefs())
+ if (!p -> hasClassDefs())
return;
H << sp;
@@ -1057,9 +1057,9 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp;
H << nl << "class" << _dllExport << ' ' << name << "PtrE : ";
H.useCurrentPosAsIndent();
- if(bases.empty())
+ if (bases.empty())
{
- if(p -> isLocal())
+ if (p -> isLocal())
H << "virtual public ::Ice::LocalObjectPtrE";
else
H << "virtual public ::Ice::ObjectPtrE";
@@ -1067,10 +1067,10 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
ClassList::iterator q = bases.begin();
- while(q != bases.end())
+ while (q != bases.end())
{
H << "virtual public " << (*q) -> scoped() << "PtrE";
- if(++q != bases.end())
+ if (++q != bases.end())
H << ',' << nl;
}
}
@@ -1103,20 +1103,20 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "return dynamic_cast< " << scoped << "*>(_ptr.get());";
C << eb;
- if(!p -> isLocal())
+ if (!p -> isLocal())
{
H << sp;
H << nl << "class" << _dllExport << ' ' << name << "PrxE : ";
H.useCurrentPosAsIndent();
- if(bases.empty())
+ if (bases.empty())
H << "virtual public ::Ice::ObjectPrxE";
else
{
ClassList::iterator q = bases.begin();
- while(q != bases.end())
+ while (q != bases.end())
{
H << "virtual public " << (*q) -> scoped() << "PrxE";
- if(++q != bases.end())
+ if (++q != bases.end())
H << ',' << nl;
}
}
@@ -1154,9 +1154,9 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp;
H << nl << "class" << _dllExport << ' ' << name << " : ";
H.useCurrentPosAsIndent();
- if(bases.empty())
+ if (bases.empty())
{
- if(p -> isLocal())
+ if (p -> isLocal())
H << "virtual public ::Ice::LocalObject";
else
H << "virtual public ::Ice::Object";
@@ -1164,14 +1164,14 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
ClassList::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;
}
}
- if(!p -> isLocal())
+ if (!p -> isLocal())
H << ',' << nl << "virtual public ::IceDelegate" << scoped;
H.restoreIndent();
H << sb;
@@ -1186,7 +1186,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "throw " << scoped << "PtrE(this);";
C << eb;
- if(!p -> isLocal())
+ if (!p -> isLocal())
{
ClassList allBases = p -> allBases();
StringList ids;
@@ -1202,15 +1202,15 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassList allBaseClasses;
ClassDefPtr cl;
- if(!bases.empty())
+ if (!bases.empty())
cl = bases.front();
else
cl = 0;
- while(cl && !cl -> isInterface())
+ while (cl && !cl -> isInterface())
{
allBaseClasses.push_back(cl);
ClassList baseBases = cl -> bases();
- if(!baseBases.empty())
+ if (!baseBases.empty())
cl = baseBases.front();
else
cl = 0;
@@ -1219,7 +1219,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
transform(allBaseClasses.begin(), allBaseClasses.end(),
back_inserter(classIds),
::Ice::memFun(&ClassDef::scoped));
- if(!p -> isInterface())
+ if (!p -> isInterface())
classIds.push_front(scoped);
classIds.push_back("::Ice::Object");
@@ -1237,10 +1237,10 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "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 << ',';
}
C << eb << ';';
@@ -1248,10 +1248,10 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "std::string " << scoped.substr(2) << "::__classIds[" << classIds.size() << "] =";
C << sb;
q = classIds.begin();
- while(q != classIds.end())
+ while (q != classIds.end())
{
C << nl << '"' << *q << '"';
- if(++q != classIds.end())
+ if (++q != classIds.end())
C << ',';
}
C << eb << ';';
@@ -1279,13 +1279,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();
- if(!p -> isLocal())
+ if (!p -> isLocal())
{
OperationList allOperations = p -> allOperations();
- if(!p -> allOperations().empty())
+ if (!p -> allOperations().empty())
{
StringList allOpNames;
transform(allOperations.begin(), allOperations.end(), back_inserter(allOpNames),
@@ -1306,10 +1306,10 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "std::string " << scoped.substr(2) << "::__names[" << allOpNames.size() << "] =";
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 << ',';
}
C << eb << ';';
@@ -1320,15 +1320,15 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "std::string* b = __names;";
C << nl << "std::string* e = __names + " << allOpNames.size() << ';';
C << nl << "std::pair<std::string*, std::string*> r = std::equal_range(b, e, s);";
- C << nl << "if(r.first == r.second)";
+ C << nl << "if (r.first == r.second)";
C.inc();
C << nl << "return ::IceInternal::DispatchOperationNotExist;";
C.dec();
C << sp;
- C << nl << "switch(r.first - __names)";
+ C << nl << "switch (r.first - __names)";
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;
@@ -1349,7 +1349,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
TypeStringList memberList;
DataMemberList dataMembers = p -> dataMembers();
DataMemberList::const_iterator q;
- 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()));
C << sp;
C << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::Stream* __os)";
@@ -1357,7 +1357,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "__os -> startWriteEncaps();";
writeMarshalCode(C, memberList, 0);
C << nl << "__os -> endWriteEncaps();";
- if(base)
+ if (base)
{
C.zeroIndent();
C << nl << "#ifdef WIN32"; // COMPILERBUG
@@ -1378,7 +1378,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "__is -> startReadEncaps();";
writeUnmarshalCode(C, memberList, 0);
C << nl << "__is -> endReadEncaps();";
- if(base)
+ if (base)
{
C.zeroIndent();
C << nl << "#ifdef WIN32"; // COMPILERBUG
@@ -1415,9 +1415,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 += ", ";
@@ -1432,9 +1432,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 += ", ";
@@ -1458,40 +1458,40 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
H << sp;
H << nl << "virtual " << retS << ' ' << name << params << " = 0;";
- if(!cl -> isLocal())
+ if (!cl -> isLocal())
{
H << nl << "::IceInternal::DispatchStatus ___" << name << "(::IceInternal::Incoming&);";
C << sp;
C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "::___" << name
<< "(::IceInternal::Incoming& __in)";
C << sb;
- if(!inParams.empty())
+ if (!inParams.empty())
C << nl << "::IceInternal::Stream* __is = __in.is();";
- if(ret || !outParams.empty() || !throws.empty())
+ if (ret || !outParams.empty() || !throws.empty())
C << nl << "::IceInternal::Stream* __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 << ';';
- if(!throws.empty())
+ if (!throws.empty())
{
C << eb;
TypeList::iterator r;
Ice::Int cnt = 0;
- for(r = throws.begin(); r != throws.end(); ++r)
+ for (r = throws.begin(); r != throws.end(); ++r)
{
C << nl << "catch(" << exceptionTypeToString(*r) << " __ex)";
C << sb;
C << nl << "__os -> write(" << cnt++ << ");";
- if(ClassDeclPtr::dynamicCast(*r) || ProxyPtr::dynamicCast(*r))
+ if (ClassDeclPtr::dynamicCast(*r) || ProxyPtr::dynamicCast(*r))
{
string s = "static_cast< ";
s += inputTypeToString(*r);
@@ -1527,7 +1527,7 @@ Slice::Gen::IceVisitor::IceVisitor(Output& h, Output& c, const string& dllExport
void
Slice::Gen::IceVisitor::visitUnitStart(const UnitPtr& p)
{
- if(!p -> hasClassDecls())
+ if (!p -> hasClassDecls())
return;
H << sp;
@@ -1537,7 +1537,7 @@ Slice::Gen::IceVisitor::visitUnitStart(const UnitPtr& p)
void
Slice::Gen::IceVisitor::visitUnitEnd(const UnitPtr& p)
{
- if(!p -> hasClassDecls())
+ if (!p -> hasClassDecls())
return;
H << sp;
@@ -1552,7 +1552,7 @@ Slice::Gen::IceVisitor::visitClassDecl(const ClassDeclPtr& p)
H << sp;
H << nl << "void" << _dllExport << " incRef(" << scoped << "*);";
H << nl << "void" << _dllExport << " decRef(" << scoped << "*);";
- if(!p -> isLocal())
+ if (!p -> isLocal())
{
H << sp;
H << nl << "void" << _dllExport << " incRef(::IceProxy" << scoped << "*);";
@@ -1572,7 +1572,7 @@ Slice::Gen::IceVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "void IceInternal::incRef(" << scoped << "* p) { p -> __incRef(); }";
C << nl << "void IceInternal::decRef(" << scoped << "* p) { p -> __decRef(); }";
- if(!p -> isLocal())
+ if (!p -> isLocal())
{
C << sp;
C << nl << "void IceInternal::incRef(::IceProxy" << scoped << "* p) { p -> __incRef(); }";
@@ -1581,7 +1581,7 @@ Slice::Gen::IceVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "void IceInternal::checkedCast(::IceProxy::Ice::Object* b, ::IceProxy" << scoped << "*& d)";
C << sb;
C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b);";
- C << nl << "if(!d && b -> _isA(\"" << scoped << "\"))";
+ C << nl << "if (!d && b -> _isA(\"" << scoped << "\"))";
C << sb;
C << nl << "d = new ::IceProxy" << scoped << ';';
C << nl << "b -> __copyTo(d);";
@@ -1591,7 +1591,7 @@ Slice::Gen::IceVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "void IceInternal::uncheckedCast(::IceProxy::Ice::Object* b, ::IceProxy" << scoped << "*& d)";
C << sb;
C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b);";
- C << nl << "if(!d)";
+ C << nl << "if (!d)";
C << sb;
C << nl << "d = new ::IceProxy" << scoped << ';';
C << nl << "b -> __copyTo(d);";
@@ -1608,7 +1608,7 @@ Slice::Gen::HandleVisitor::HandleVisitor(Output& h, Output& c, const string& dll
void
Slice::Gen::HandleVisitor::visitModuleStart(const ModulePtr& p)
{
- if(!p -> hasClassDecls())
+ if (!p -> hasClassDecls())
return;
string name = p -> name();
@@ -1620,7 +1620,7 @@ Slice::Gen::HandleVisitor::visitModuleStart(const ModulePtr& p)
void
Slice::Gen::HandleVisitor::visitModuleEnd(const ModulePtr& p)
{
- if(!p -> hasClassDecls())
+ if (!p -> hasClassDecls())
return;
H << sp;
@@ -1635,7 +1635,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;";
H << sp;
@@ -1647,12 +1647,12 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
void
Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p -> isLocal())
+ if (p -> isLocal())
return;
string scoped = p -> scoped();
string scope = p -> scope();
- if(scope.length())
+ if (scope.length())
scope.erase(0, 2);
C << sp;
diff --git a/cpp/src/slice2cpp/GenUtil.cpp b/cpp/src/slice2cpp/GenUtil.cpp
index ea9107d04b1..18b66bb2dc8 100644
--- a/cpp/src/slice2cpp/GenUtil.cpp
+++ b/cpp/src/slice2cpp/GenUtil.cpp
@@ -33,19 +33,19 @@ Slice::typeToString(const TypePtr& type)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin)
+ if (builtin)
return builtinTable[builtin -> kind()];
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
+ if (cl)
return cl -> scoped() + "Ptr";
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if(proxy)
+ if (proxy)
return proxy -> _class() -> scoped() + "Prx";
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
+ if (contained)
return contained -> scoped();
return "???";
@@ -54,7 +54,7 @@ Slice::typeToString(const TypePtr& type)
string
Slice::returnTypeToString(const TypePtr& type)
{
- if(!type)
+ if (!type)
return "void";
return typeToString(type);
@@ -80,27 +80,27 @@ Slice::inputTypeToString(const TypePtr& type)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin)
+ if (builtin)
return inputBuiltinTable[builtin -> kind()];
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
+ if (cl)
return "const " + cl -> scoped() + "Ptr&";
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if(proxy)
+ if (proxy)
return "const " + proxy -> _class() -> scoped() + "Prx&";
EnumPtr en = EnumPtr::dynamicCast(type);
- if(en)
+ if (en)
return en -> scoped();
NativePtr native = NativePtr::dynamicCast(type);
- if(native)
+ if (native)
return native -> scoped();
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
+ if (contained)
return "const " + contained -> scoped() + "&";
return "???";
@@ -126,23 +126,23 @@ Slice::outputTypeToString(const TypePtr& type)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin)
+ if (builtin)
return outputBuiltinTable[builtin -> kind()];
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
+ if (cl)
return cl -> scoped() + "Ptr&";
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if(proxy)
+ if (proxy)
return proxy -> _class() -> scoped() + "Prx&";
NativePtr native = NativePtr::dynamicCast(type);
- if(native)
+ if (native)
return native -> scoped();
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
+ if (contained)
return contained -> scoped() + "&";
return "???";
@@ -168,27 +168,27 @@ Slice::exceptionTypeToString(const TypePtr& type)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin)
+ if (builtin)
return inputBuiltinTable[builtin -> kind()];
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
+ if (cl)
return "const " + cl -> scoped() + "PtrE&";
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if(proxy)
+ if (proxy)
return "const " + proxy -> _class() -> scoped() + "PrxE&";
EnumPtr en = EnumPtr::dynamicCast(type);
- if(en)
+ if (en)
return en -> scoped();
NativePtr native = NativePtr::dynamicCast(type);
- if(native)
+ if (native)
return native -> scoped();
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
+ if (contained)
return "const " + contained -> scoped() + "&";
return "???";
@@ -200,17 +200,17 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
const char* func = marshal ? "write(" : "read(";
const char* stream = marshal ? "__os" : "__is";
- if(BuiltinPtr::dynamicCast(type))
+ if (BuiltinPtr::dynamicCast(type))
{
out << nl << stream << " -> " << func << param << ");";
return;
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
+ if (cl)
{
out << sb;
- if(marshal)
+ if (marshal)
{
out << nl << "::Ice::ObjectPtr __obj = " << param << ';';
out << nl << stream << " -> write(__obj);";
@@ -219,9 +219,9 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
{
out << nl << "::Ice::ObjectPtr __obj;";
out << nl << stream << " -> read(__obj, " << cl -> scoped() << "::__classIds[0]);";
- out << nl << "if(!__obj)";
+ out << nl << "if (!__obj)";
ClassDefPtr def = cl -> definition();
- if(def && !def -> isAbstract())
+ if (def && !def -> isAbstract())
{
out << sb;
out << nl << "__obj = new " << cl -> scoped() << ";";
@@ -235,7 +235,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
out.dec();
}
out << nl << param << " = " << cl -> scoped() << "Ptr::dynamicCast(__obj);";
- out << nl << "if(!" << param << ')';
+ out << nl << "if (!" << param << ')';
out.inc();
out << nl << "throw ::Ice::ValueUnmarshalException(__FILE__, __LINE__);";
out.dec();
@@ -246,9 +246,9 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
VectorPtr vec = VectorPtr::dynamicCast(type);
- if(vec)
+ if (vec)
{
- if(BuiltinPtr::dynamicCast(vec -> type()))
+ if (BuiltinPtr::dynamicCast(vec -> type()))
out << nl << stream << " -> " << func << param << ");";
else
out << nl << vec -> scope() << "::__" << func << stream << ", " << param << ", " << vec -> scope()
@@ -260,7 +260,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
assert(!native); // TODO
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
- if(!constructed)
+ if (!constructed)
{
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
assert(proxy);
@@ -274,9 +274,9 @@ void
Slice::writeMarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
list<pair<TypePtr, string> >::const_iterator p;
- for(p = params.begin(); p != params.end(); ++p)
+ for (p = params.begin(); p != params.end(); ++p)
writeMarshalUnmarshalCode(out, p -> first, p -> second, true);
- if(ret)
+ if (ret)
writeMarshalUnmarshalCode(out, ret, "__ret", true);
}
@@ -284,9 +284,9 @@ void
Slice::writeUnmarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
list<pair<TypePtr, string> >::const_iterator p;
- for(p = params.begin(); p != params.end(); ++p)
+ for (p = params.begin(); p != params.end(); ++p)
writeMarshalUnmarshalCode(out, p -> first, p -> second, false);
- if(ret)
+ if (ret)
writeMarshalUnmarshalCode(out, ret, "__ret", false);
}
@@ -294,10 +294,10 @@ void
Slice::writeAllocateCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
list<pair<TypePtr, string> > ps = params;
- if(ret)
+ if (ret)
ps.push_back(make_pair(ret, string("__ret")));
list<pair<TypePtr, string> >::const_iterator p;
- for(p = ps.begin(); p != ps.end(); ++p)
+ for (p = ps.begin(); p != ps.end(); ++p)
out << nl << typeToString(p -> first) << ' ' << p -> second << ';';
}
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index e30af271d12..a6bc9c48dc3 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -42,54 +42,54 @@ main(int argc, char* argv[])
bool debug = false;
int idx = 1;
- while(idx < argc)
+ while (idx < argc)
{
- if(strncmp(argv[idx], "-I", 2) == 0)
+ if (strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if(path.length())
+ if (path.length())
includePaths.push_back(path);
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(strncmp(argv[idx], "-D", 2) == 0 ||
+ else if (strncmp(argv[idx], "-D", 2) == 0 ||
strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(strcmp(argv[idx], "-h") == 0 ||
+ else if (strcmp(argv[idx], "-h") == 0 ||
strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if(strcmp(argv[idx], "-v") == 0 ||
+ else if (strcmp(argv[idx], "-v") == 0 ||
strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if(strcmp(argv[idx], "-d") == 0 ||
+ else if (strcmp(argv[idx], "-d") == 0 ||
strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(strcmp(argv[idx], "--include-dir") == 0)
+ else if (strcmp(argv[idx], "--include-dir") == 0)
{
- if(idx + 1 >= argc)
+ if (idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`"
<< argv[idx] << "'" << endl;
@@ -98,13 +98,13 @@ main(int argc, char* argv[])
}
include = argv[idx + 1];
- for(int i = idx ; i + 2 < argc ; ++i)
+ for (int i = idx ; i + 2 < argc ; ++i)
argv[i] = argv[i + 2];
argc -= 2;
}
- else if(strcmp(argv[idx], "--dll-export") == 0)
+ else if (strcmp(argv[idx], "--dll-export") == 0)
{
- if(idx + 1 >= argc)
+ if (idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`"
<< argv[idx] << "'" << endl;
@@ -113,11 +113,11 @@ main(int argc, char* argv[])
}
dllExport = argv[idx + 1];
- for(int i = idx ; i + 2 < argc ; ++i)
+ for (int i = idx ; i + 2 < argc ; ++i)
argv[i] = argv[i + 2];
argc -= 2;
}
- else if(argv[idx][0] == '-')
+ else if (argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'"
<< endl;
@@ -128,7 +128,7 @@ main(int argc, char* argv[])
++idx;
}
- if(argc < 2)
+ if (argc < 2)
{
cerr << argv[0] << ": no input file" << endl;
usage(argv[0]);
@@ -137,17 +137,17 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for(idx = 1 ; idx < argc ; ++idx)
+ for (idx = 1 ; idx < argc ; ++idx)
{
string base(argv[idx]);
string suffix;
string::size_type pos = base.rfind('.');
- if(pos != string::npos)
+ if (pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if(suffix != ".ice")
+ if (suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'"
<< endl;
@@ -156,7 +156,7 @@ main(int argc, char* argv[])
base.erase(pos);
ifstream test(argv[idx]);
- if(!test)
+ if (!test)
{
cerr << argv[0] << ": can't open `" << argv[idx]
<< "' for reading: " << strerror(errno) << endl;
@@ -170,7 +170,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if(cppHandle == NULL)
+ if (cppHandle == NULL)
{
cerr << argv[0] << ": can't run C++ preprocessor: "
<< strerror(errno) << endl;
@@ -186,14 +186,14 @@ main(int argc, char* argv[])
pclose(cppHandle);
#endif
- if(parseStatus == EXIT_FAILURE)
+ if (parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
else
{
Gen gen(argv[0], base, include, includePaths, dllExport);
- if(!gen)
+ if (!gen)
{
unit -> destroy();
return EXIT_FAILURE;
diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp
index 8b8bc08734b..c4fceb0a090 100644
--- a/cpp/src/slice2docbook/Gen.cpp
+++ b/cpp/src/slice2docbook/Gen.cpp
@@ -21,7 +21,7 @@ Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool no
_chapter("section") // Could also be "chapter"
{
O.open(file.c_str());
- if(!O)
+ if (!O)
{
cerr << name << ": can't open `" << file << "' for writing: " << strerror(errno) << endl;
return;
@@ -49,7 +49,7 @@ Slice::Gen::generate(const UnitPtr& unit)
void
Slice::Gen::visitUnitStart(const UnitPtr& p)
{
- if(_standAlone)
+ if (_standAlone)
{
O << "<!DOCTYPE book PUBLIC \"-//OASIS//DTD DocBook V3.1//EN\">";
start("article");
@@ -57,7 +57,7 @@ Slice::Gen::visitUnitStart(const UnitPtr& p)
printHeader();
- if(!_noGlobals)
+ if (!_noGlobals)
{
start(_chapter, "Global Module");
start("section", "Overview");
@@ -68,7 +68,7 @@ Slice::Gen::visitUnitStart(const UnitPtr& p)
void
Slice::Gen::visitUnitEnd(const UnitPtr& p)
{
- if(_standAlone)
+ if (_standAlone)
end();
}
@@ -89,12 +89,12 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
{
ModuleList modules = p -> modules();
modules.sort();
- if(!modules.empty())
+ if (!modules.empty())
{
start("section", "Module Index");
start("variablelist");
- for(ModuleList::iterator q = modules.begin();
+ for (ModuleList::iterator q = modules.begin();
q != modules.end();
++q)
{
@@ -119,12 +119,12 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
classes.end());
classes.sort();
- if(!classes.empty())
+ if (!classes.empty())
{
start("section", "Class Index");
start("variablelist");
- for(ClassList::iterator q = classes.begin();
+ for (ClassList::iterator q = classes.begin();
q != classes.end();
++q)
{
@@ -143,12 +143,12 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
}
interfaces.sort();
- if(!interfaces.empty())
+ if (!interfaces.empty())
{
start("section", "Interface Index");
start("variablelist");
- for(ClassList::iterator q = interfaces.begin();
+ for (ClassList::iterator q = interfaces.begin();
q != interfaces.end();
++q)
{
@@ -168,12 +168,12 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
VectorList vectors = p -> vectors();
vectors.sort();
- if(!vectors.empty())
+ if (!vectors.empty())
{
start("section", "Vector Index");
start("variablelist");
- for(VectorList::iterator q = vectors.begin();
+ for (VectorList::iterator q = vectors.begin();
q != vectors.end();
++q)
{
@@ -193,12 +193,12 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
EnumList enums = p -> enums();
enums.sort();
- if(!enums.empty())
+ if (!enums.empty())
{
start("section", "Enum Index");
start("variablelist");
- for(EnumList::iterator q = enums.begin();
+ for (EnumList::iterator q = enums.begin();
q != enums.end();
++q)
{
@@ -218,12 +218,12 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
NativeList natives = p -> natives();
natives.sort();
- if(!natives.empty())
+ if (!natives.empty())
{
start("section", "Native Index");
start("variablelist");
- for(NativeList::iterator q = natives.begin();
+ for (NativeList::iterator q = natives.begin();
q != natives.end();
++q)
{
@@ -243,7 +243,7 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
end();
- for(VectorList::iterator q = vectors.begin();
+ for (VectorList::iterator q = vectors.begin();
q != vectors.end();
++q)
{
@@ -261,7 +261,7 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
end();
}
- for(EnumList::iterator q = enums.begin();
+ for (EnumList::iterator q = enums.begin();
q != enums.end();
++q)
{
@@ -272,10 +272,10 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
O << sb;
StringList enumerators = (*q) -> enumerators();
StringList::iterator r = enumerators.begin();
- while(r != enumerators.end())
+ while (r != enumerators.end())
{
O << nl << "<structfield>" << *r << "</structfield>";
- if(++r != enumerators.end())
+ if (++r != enumerators.end())
O << ',';
}
O << eb << ";</synopsis>";
@@ -286,7 +286,7 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
end();
}
- for(NativeList::iterator q = natives.begin();
+ for (NativeList::iterator q = natives.begin();
q != natives.end();
++q)
{
@@ -312,15 +312,15 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
start("section", "Overview");
O.zeroIndent();
O << nl << "<synopsis>";
- if(p -> isLocal())
+ if (p -> isLocal())
O << "local ";
- if(p -> isInterface())
+ if (p -> isInterface())
O << "interface";
else
O << "class";
O << " <classname>" << p -> name() << "</classname>";
ClassList bases = p -> bases();
- if(!bases.empty() && !bases.front() -> isInterface())
+ if (!bases.empty() && !bases.front() -> isInterface())
{
O.inc();
O << nl << "extends ";
@@ -330,19 +330,19 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
O.dec();
O.dec();
}
- if(!bases.empty())
+ if (!bases.empty())
{
O.inc();
- if(p -> isInterface())
+ if (p -> isInterface())
O << nl << "extends ";
else
O << nl << "implements ";
O.inc();
ClassList::iterator q = bases.begin();
- while(q != bases.end())
+ while (q != bases.end())
{
O << nl << "<classname>" << (*q) -> scoped().substr(2) << "</classname>";
- if(++q != bases.end())
+ if (++q != bases.end())
O << ",";
}
O.dec();
@@ -355,12 +355,12 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
OperationList operations = p -> operations();
operations.sort();
- if(!operations.empty())
+ if (!operations.empty())
{
start("section", "Operation Index");
start("variablelist");
- for(OperationList::iterator q = operations.begin();
+ for (OperationList::iterator q = operations.begin();
q != operations.end();
++q)
{
@@ -380,12 +380,12 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
DataMemberList dataMembers = p -> dataMembers();
dataMembers.sort();
- if(!dataMembers.empty())
+ if (!dataMembers.empty())
{
start("section", "Data Member Index");
start("variablelist");
- for(DataMemberList::iterator q = dataMembers.begin();
+ for (DataMemberList::iterator q = dataMembers.begin();
q != dataMembers.end();
++q)
{
@@ -405,7 +405,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
end();
- for(OperationList::iterator q = operations.begin();
+ for (OperationList::iterator q = operations.begin();
q != operations.end();
++q)
{
@@ -421,35 +421,35 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
<< " <function>" << (*q) -> name() << "</function>(";
O.inc();
TypeStringList::iterator r = inputParams.begin();
- while(r != inputParams.end())
+ while (r != inputParams.end())
{
O << nl << typeToString(r -> first) << " <parameter>" << r -> second << "</parameter>";
- if(++r != inputParams.end())
+ if (++r != inputParams.end())
O << ',';
}
- if(!outputParams.empty())
+ if (!outputParams.empty())
{
O << ';';
r = outputParams.begin();
- while(r != outputParams.end())
+ while (r != outputParams.end())
{
O << nl << typeToString(r -> first) << " <parameter>" << r -> second << "</parameter>";
- if(++r != outputParams.end())
+ if (++r != outputParams.end())
O << ',';
}
}
O << ')';
O.dec();
- if(!throws.empty())
+ if (!throws.empty())
{
O.inc();
O << nl << "throws";
O.inc();
TypeList::iterator r = throws.begin();
- while(r != throws.end())
+ while (r != throws.end())
{
O << nl << typeToString(*r);
- if(++r != throws.end())
+ if (++r != throws.end())
O << ',';
}
O.dec();
@@ -463,7 +463,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
end();
}
- for(DataMemberList::iterator q = dataMembers.begin();
+ for (DataMemberList::iterator q = dataMembers.begin();
q != dataMembers.end();
++q)
{
@@ -511,14 +511,14 @@ Slice::Gen::getTagged(const string& tag, string& comment)
{
StringList result;
string::size_type begin = 0;
- while(begin < comment.size())
+ while (begin < comment.size())
{
begin = comment.find("@" + tag, begin);
- if(begin == string::npos)
+ if (begin == string::npos)
return result;
string::size_type pos1 = comment.find_first_not_of(" \t\r\n", begin + tag.size() + 1);
- if(pos1 == string::npos)
+ if (pos1 == string::npos)
{
comment.erase(begin);
return result;
@@ -529,7 +529,7 @@ Slice::Gen::getTagged(const string& tag, string& comment)
comment.erase(begin, pos2 - 1 - begin);
string::size_type pos3 = line.find_last_not_of(" \t\r\n");
- if(pos3 != string::npos)
+ if (pos3 != string::npos)
line.erase(pos3 + 1);
result.push_back(line);
}
@@ -541,7 +541,7 @@ void
Slice::Gen::printComment(const ContainedPtr& p)
{
ContainerPtr container = ContainerPtr::dynamicCast(p);
- if(!container)
+ if (!container)
container = p -> container();
string comment = p -> comment();
@@ -552,7 +552,7 @@ Slice::Gen::printComment(const ContainedPtr& p)
start("para");
string::size_type pos = comment.find_last_not_of(" \t\r\n");
- if(pos != string::npos)
+ if (pos != string::npos)
{
comment.erase(pos + 1);
O.zeroIndent();
@@ -561,22 +561,22 @@ Slice::Gen::printComment(const ContainedPtr& p)
}
end();
- if(!par.empty())
+ if (!par.empty())
{
start("section", "Parameters");
start("variablelist");
- for(StringList::iterator q = par.begin();
+ for (StringList::iterator q = par.begin();
q != par.end();
++q)
{
string::size_type pos;
string term;
pos = q -> find_first_of(" \t\r\n");
- if(pos != string::npos)
+ if (pos != string::npos)
term = q -> substr(0, pos);
string item;
pos = q -> find_first_not_of(" \t\r\n", pos);
- if(pos != string::npos)
+ if (pos != string::npos)
item = q -> substr(pos);
start("varlistentry");
@@ -597,7 +597,7 @@ Slice::Gen::printComment(const ContainedPtr& p)
end();
}
- if(!ret.empty())
+ if (!ret.empty())
{
start("section", "Return Value");
start("para");
@@ -606,23 +606,23 @@ Slice::Gen::printComment(const ContainedPtr& p)
end();
}
- if(!throws.empty())
+ if (!throws.empty())
{
start("section", "Exceptions");
start("variablelist");
- for(StringList::iterator q = throws.begin();
+ for (StringList::iterator q = throws.begin();
q != throws.end();
++q)
{
string::size_type pos;
string term;
pos = q -> find_first_of(" \t\r\n");
- if(pos != string::npos)
+ if (pos != string::npos)
term = q -> substr(0, pos);
string item;
pos = q -> find_first_not_of(" \t\r\n", pos);
- if(pos != string::npos)
+ if (pos != string::npos)
item = q -> substr(pos);
start("varlistentry");
@@ -641,13 +641,13 @@ Slice::Gen::printComment(const ContainedPtr& p)
end();
}
- if(!see.empty())
+ if (!see.empty())
{
start("section", "See Also");
start("para");
start("simplelist type=\"inline\"");
- for(StringList::iterator q = see.begin();
+ for (StringList::iterator q = see.begin();
q != see.end();
++q)
{
@@ -669,7 +669,7 @@ Slice::Gen::printSummary(const ContainedPtr& p)
start("para");
string::size_type pos = comment.find('.');
- if(pos != string::npos)
+ if (pos != string::npos)
{
comment.erase(pos + 1);
O.zeroIndent();
@@ -686,7 +686,7 @@ Slice::Gen::start(const std::string& element)
O.inc();
string::size_type pos = element.find_first_of(" \t");
- if(pos == string::npos)
+ if (pos == string::npos)
_elementStack.push(element);
else
_elementStack.push(element.substr(0, pos));
diff --git a/cpp/src/slice2docbook/GenUtil.cpp b/cpp/src/slice2docbook/GenUtil.cpp
index 52b9c90a4e2..64be85a894f 100644
--- a/cpp/src/slice2docbook/GenUtil.cpp
+++ b/cpp/src/slice2docbook/GenUtil.cpp
@@ -36,27 +36,27 @@ Slice::typeToString(const TypePtr& type)
string result;
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin)
+ if (builtin)
result = "<type>" + string(builtinTable[builtin -> kind()]) + "</type>";
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if(proxy)
+ if (proxy)
result = "<classname>" + proxy -> _class() -> scoped().substr(2) + "*</classname>";
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
+ if (cl)
result = "<classname>" + cl -> scoped().substr(2) + "</classname>";
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
+ if (contained)
{
- if(result.empty())
+ if (result.empty())
result = "<type>" + contained -> scoped().substr(2) + "</type>";
result = "<link linkend=" + scopedToId(contained -> scoped()) + ">" + result + "</link>";
}
- if(result.empty())
+ if (result.empty())
result = "???";
return result;
@@ -66,32 +66,32 @@ string
Slice::addLink(const string& s, const ContainerPtr& container)
{
TypeList types = container -> lookupType(s, false);
- if(!types.empty())
+ if (!types.empty())
{
string result;
- if(ClassDeclPtr::dynamicCast(types.front()))
+ if (ClassDeclPtr::dynamicCast(types.front()))
result = "<classname>" + s + "</classname>";
else
result = "<type>" + s + "</type>";
ContainedPtr p = ContainedPtr::dynamicCast(types.front());
- if(p)
+ if (p)
result = "<link linkend=" + scopedToId(p -> scoped()) + ">" + result + "</link>";
return result;
}
ContainedList contList = container -> lookupContained(s, false);
- if(!contList.empty())
+ if (!contList.empty())
{
string result = "<link linkend=" + scopedToId(contList.front() -> scoped()) + ">";
- if(ModulePtr::dynamicCast(contList.front()))
+ if (ModulePtr::dynamicCast(contList.front()))
result += "<classname>" + s + "</classname>";
- else if(OperationPtr::dynamicCast(contList.front()))
+ else if (OperationPtr::dynamicCast(contList.front()))
result += "<function>" + s + "</function>";
- else if(DataMemberPtr::dynamicCast(contList.front()))
+ else if (DataMemberPtr::dynamicCast(contList.front()))
result += "<structfield>" + s + "</structfield>";
else
assert(false);
@@ -107,7 +107,7 @@ struct ToFile
{
char operator()(char c)
{
- if(c == ':')
+ if (c == ':')
return '_';
else
return c;
@@ -118,7 +118,7 @@ string
Slice::scopedToFile(const string& scoped)
{
string result;
- if(scoped[0] == ':')
+ if (scoped[0] == ':')
result = scoped.substr(2);
else
result = scoped;
@@ -134,13 +134,13 @@ Slice::scopedToId(const string& scoped)
static int _nextId = 0;
string s;
- if(scoped[0] == ':')
+ if (scoped[0] == ':')
s = scoped.substr(2);
else
s = scoped;
int id = idMap[s];
- if(id == 0)
+ if (id == 0)
{
id = ++_nextId;
idMap[s] = id;
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp
index e6cad9e4c3a..189bcb4d450 100644
--- a/cpp/src/slice2docbook/Main.cpp
+++ b/cpp/src/slice2docbook/Main.cpp
@@ -42,67 +42,67 @@ main(int argc, char* argv[])
bool noGlobals = false;
int idx = 1;
- while(idx < argc)
+ while (idx < argc)
{
- if(strncmp(argv[idx], "-I", 2) == 0)
+ if (strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if(path.length())
+ if (path.length())
includePaths.push_back(path);
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(strncmp(argv[idx], "-D", 2) == 0 ||
+ else if (strncmp(argv[idx], "-D", 2) == 0 ||
strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(strcmp(argv[idx], "-s") == 0 ||
+ else if (strcmp(argv[idx], "-s") == 0 ||
strcmp(argv[idx], "--stand-alone") == 0)
{
standAlone = true;
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(strcmp(argv[idx], "--no-globals") == 0)
+ else if (strcmp(argv[idx], "--no-globals") == 0)
{
noGlobals = true;
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(strcmp(argv[idx], "-h") == 0 ||
+ else if (strcmp(argv[idx], "-h") == 0 ||
strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if(strcmp(argv[idx], "-v") == 0 ||
+ else if (strcmp(argv[idx], "-v") == 0 ||
strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if(strcmp(argv[idx], "-d") == 0 ||
+ else if (strcmp(argv[idx], "-d") == 0 ||
strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for(int i = idx ; i + 1 < argc ; ++i)
+ for (int i = idx ; i + 1 < argc ; ++i)
argv[i] = argv[i + 1];
--argc;
}
- else if(argv[idx][0] == '-')
+ else if (argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'"
<< endl;
@@ -113,7 +113,7 @@ main(int argc, char* argv[])
++idx;
}
- if(argc < 2)
+ if (argc < 2)
{
cerr << argv[0] << ": no docbook file specified" << endl;
usage(argv[0]);
@@ -123,19 +123,19 @@ main(int argc, char* argv[])
string docbook(argv[1]);
string suffix;
string::size_type pos = docbook.rfind('.');
- if(pos != string::npos)
+ if (pos != string::npos)
{
suffix = docbook.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if(suffix != ".sgml")
+ if (suffix != ".sgml")
{
cerr << argv[0] << ": docbook file must end with `.sgml'"
<< endl;
return EXIT_FAILURE;
}
- if(argc < 3)
+ if (argc < 3)
{
cerr << argv[0] << ": no input file" << endl;
usage(argv[0]);
@@ -146,17 +146,17 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for(idx = 2 ; idx < argc ; ++idx)
+ for (idx = 2 ; idx < argc ; ++idx)
{
string base(argv[idx]);
string suffix;
string::size_type pos = base.rfind('.');
- if(pos != string::npos)
+ if (pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if(suffix != ".ice")
+ if (suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'"
<< endl;
@@ -166,7 +166,7 @@ main(int argc, char* argv[])
base.erase(pos);
ifstream test(argv[idx]);
- if(!test)
+ if (!test)
{
cerr << argv[0] << ": can't open `" << argv[idx]
<< "' for reading: " << strerror(errno) << endl;
@@ -181,7 +181,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if(cppHandle == NULL)
+ if (cppHandle == NULL)
{
cerr << argv[0] << ": can't run C++ preprocessor: "
<< strerror(errno) << endl;
@@ -190,7 +190,7 @@ main(int argc, char* argv[])
}
int parseStatus = unit -> parse(cppHandle, debug);
- if(parseStatus == EXIT_FAILURE)
+ if (parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
@@ -203,10 +203,10 @@ main(int argc, char* argv[])
}
- if(status == EXIT_SUCCESS)
+ if (status == EXIT_SUCCESS)
{
Gen gen(argv[0], docbook, standAlone, noGlobals);
- if(!gen)
+ if (!gen)
{
unit -> destroy();
return EXIT_FAILURE;