summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-09 15:22:04 +0200
committerNoel Grandin <noel@peralex.com>2016-02-09 16:14:30 +0200
commit555ee51b77a789253bffdd9ffb16bdc5e51b980a (patch)
tree501abf83f3825ed790bd66f92c15026dd27c2221 /codemaker
parenta6f16879922ee237db268ad19328009242b3ca6d (diff)
convert to range-based for loops in codemaker/
Change-Id: Ifa521f34a8d9565bb61743c4a996bcba37e95ec2
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/codemaker/exceptiontree.cxx4
-rw-r--r--codemaker/source/codemaker/typemanager.cxx11
-rw-r--r--codemaker/source/cppumaker/cppumaker.cxx12
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx490
-rw-r--r--codemaker/source/cppumaker/dependencies.cxx96
-rw-r--r--codemaker/source/cppumaker/includes.cxx24
-rw-r--r--codemaker/source/javamaker/classfile.cxx33
-rw-r--r--codemaker/source/javamaker/javamaker.cxx12
-rw-r--r--codemaker/source/javamaker/javatype.cxx235
9 files changed, 359 insertions, 558 deletions
diff --git a/codemaker/source/codemaker/exceptiontree.cxx b/codemaker/source/codemaker/exceptiontree.cxx
index c3f555c3d8cb..7b5ccd97db60 100644
--- a/codemaker/source/codemaker/exceptiontree.cxx
+++ b/codemaker/source/codemaker/exceptiontree.cxx
@@ -41,8 +41,8 @@ ExceptionTreeNode * ExceptionTreeNode::add(rtl::OString const & theName) {
}
void ExceptionTreeNode::clearChildren() {
- for (Children::iterator i(children.begin()); i != children.end(); ++i) {
- delete *i;
+ for (ExceptionTreeNode* child : children) {
+ delete child;
}
children.clear();
}
diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx
index 65d6640e961d..8e74c5d6acd5 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -44,11 +44,9 @@ bool TypeManager::foundAtPrimaryProvider(OUString const & name) const {
if (name.isEmpty()) {
return !primaryProviders_.empty();
}
- for (std::vector< rtl::Reference< unoidl::Provider > >::const_iterator i(
- primaryProviders_.begin());
- i != primaryProviders_.end(); ++i)
+ for (const rtl::Reference< unoidl::Provider >& xProvider : primaryProviders_)
{
- if ((*i)->findEntity(name).is()) {
+ if (xProvider->findEntity(name).is()) {
return true;
}
}
@@ -239,10 +237,9 @@ codemaker::UnoType::Sort TypeManager::decompose(
}
if (arguments != nullptr) {
arguments->clear();
- for (std::vector< OString >::iterator i(args.begin());
- i != args.end(); ++i)
+ for (const OString& rArg : args)
{
- arguments->push_back(b2u(*i));
+ arguments->push_back(b2u(rArg));
}
}
if (entity != nullptr) {
diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx
index c5ac5d81c553..0ab47d9dafbb 100644
--- a/codemaker/source/cppumaker/cppumaker.cxx
+++ b/codemaker/source/cppumaker/cppumaker.cxx
@@ -44,17 +44,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
}
rtl::Reference< TypeManager > typeMgr(new TypeManager);
- for (std::vector< OString >::const_iterator i(
- options.getExtraInputFiles().begin());
- i != options.getExtraInputFiles().end(); ++i)
+ for (const OString& f :options.getExtraInputFiles())
{
- typeMgr->loadProvider(convertToFileUrl(*i), false);
+ typeMgr->loadProvider(convertToFileUrl(f), false);
}
- for (std::vector< OString >::const_iterator i(
- options.getInputFiles().begin());
- i != options.getInputFiles().end(); ++i)
+ for (const OString& f : options.getInputFiles())
{
- typeMgr->loadProvider(convertToFileUrl(*i), true);
+ typeMgr->loadProvider(convertToFileUrl(f), true);
}
codemaker::GeneratedTypeSet generated;
if (options.isValid("-T")) {
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 743334ae5ddf..98510c367ff9 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -440,11 +440,9 @@ void CppuType::dumpDependedTypes(
if (!options.isValid("-nD")) {
codemaker::cppumaker::Dependencies::Map const & map
= m_dependencies.getMap();
- for (codemaker::cppumaker::Dependencies::Map::const_iterator i(
- map.begin());
- i != map.end(); ++i)
+ for (const std::pair<OUString,codemaker::cppumaker::Dependencies::Kind>& entry : map)
{
- produce(i->first, m_typeMgr, generated, options);
+ produce(entry.first, m_typeMgr, generated, options);
}
}
}
@@ -1017,10 +1015,9 @@ OUString CppuType::indent() const {
}
bool isDeprecated(std::vector< OUString > const & annotations) {
- for (std::vector< OUString >::const_iterator i(annotations.begin());
- i != annotations.end(); ++i)
+ for (const OUString& r : annotations)
{
- if (*i == "deprecated") {
+ if (r == "deprecated") {
return true;
}
}
@@ -1055,16 +1052,14 @@ void BaseOffset::calculateBases(
rtl::Reference< unoidl::InterfaceTypeEntity > const & entity)
{
assert(entity.is());
- for (std::vector< unoidl::AnnotatedReference >::const_iterator i(
- entity->getDirectMandatoryBases().begin());
- i != entity->getDirectMandatoryBases().end(); ++i)
+ for (const unoidl::AnnotatedReference& ar : entity->getDirectMandatoryBases())
{
- if (set_.insert(i->name).second) {
+ if (set_.insert(ar.name).second) {
rtl::Reference< unoidl::Entity > ent;
- codemaker::UnoType::Sort sort = manager_->getSort(i->name, &ent);
+ codemaker::UnoType::Sort sort = manager_->getSort(ar.name, &ent);
if (sort != codemaker::UnoType::SORT_INTERFACE_TYPE) {
throw CannotDumpException(
- "interface type base " + i->name
+ "interface type base " + ar.name
+ " is not an interface type");
}
rtl::Reference< unoidl::InterfaceTypeEntity > ent2(
@@ -1179,26 +1174,24 @@ void InterfaceType::dumpAttributes(FileStream & out) {
if (!entity_->getDirectAttributes().empty()) {
out << "\n" << indent() << "// Attributes\n";
}
- for (std::vector< unoidl::InterfaceTypeEntity::Attribute >::const_iterator
- i(entity_->getDirectAttributes().begin());
- i != entity_->getDirectAttributes().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes())
{
- bool depr = m_isDeprecated || isDeprecated(i->annotations);
+ bool depr = m_isDeprecated || isDeprecated(attr.annotations);
out << indent();
dumpDeprecation(out, depr);
out << "virtual ";
- dumpType(out, i->type);
- out << " SAL_CALL get" << i->name << "()";
- dumpExceptionSpecification(out, i->getExceptions, true);
+ dumpType(out, attr.type);
+ out << " SAL_CALL get" << attr.name << "()";
+ dumpExceptionSpecification(out, attr.getExceptions, true);
out << " = 0;\n";
- if (!i->readOnly) {
- bool byRef = passByReference(i->type);
+ if (!attr.readOnly) {
+ bool byRef = passByReference(attr.type);
out << indent();
dumpDeprecation(out, depr);
- out << "virtual void SAL_CALL set" << i->name << "( ";
- dumpType(out, i->type, byRef, byRef);
- out << " _" << i->name.toAsciiLowerCase() << " )";
- dumpExceptionSpecification(out, i->setExceptions, true);
+ out << "virtual void SAL_CALL set" << attr.name << "( ";
+ dumpType(out, attr.type, byRef, byRef);
+ out << " _" << attr.name.toAsciiLowerCase() << " )";
+ dumpExceptionSpecification(out, attr.setExceptions, true);
out << " = 0;\n";
}
}
@@ -1208,22 +1201,20 @@ void InterfaceType::dumpMethods(FileStream & out) {
if (!entity_->getDirectMethods().empty()) {
out << "\n" << indent() << "// Methods\n";
}
- for (std::vector< unoidl::InterfaceTypeEntity::Method >::const_iterator i(
- entity_->getDirectMethods().begin());
- i != entity_->getDirectMethods().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods())
{
out << indent();
- dumpDeprecation(out, m_isDeprecated || isDeprecated(i->annotations));
+ dumpDeprecation(out, m_isDeprecated || isDeprecated(method.annotations));
out << "virtual ";
- dumpType(out, i->returnType);
- out << " SAL_CALL " << i->name << "(";
- if (i->parameters.empty()) {
+ dumpType(out, method.returnType);
+ out << " SAL_CALL " << method.name << "(";
+ if (method.parameters.empty()) {
out << ")";
} else {
out << " ";
for (std::vector< unoidl::InterfaceTypeEntity::Method::Parameter >::
- const_iterator j(i->parameters.begin());
- j != i->parameters.end();)
+ const_iterator j(method.parameters.begin());
+ j != method.parameters.end();)
{
bool isConst;
bool isRef;
@@ -1240,14 +1231,14 @@ void InterfaceType::dumpMethods(FileStream & out) {
dumpType(out, j->type, isConst, isRef);
out << " " << j->name;
++j;
- if (j != i->parameters.end()) {
+ if (j != method.parameters.end()) {
out << ", ";
}
}
out << " )";
}
dumpExceptionSpecification(
- out, i->exceptions, i->name != "acquire" && i->name != "release");
+ out, method.exceptions, method.name != "acquire" && method.name != "release");
out << " = 0;\n";
}
}
@@ -1270,12 +1261,10 @@ void InterfaceType::dumpNormalGetCppuType(FileStream & out) {
out << indent() << "typelib_TypeDescriptionReference * aSuperTypes["
<< entity_->getDirectMandatoryBases().size() << "];\n";
std::vector< unoidl::AnnotatedReference >::size_type n = 0;
- for (std::vector< unoidl::AnnotatedReference >::const_iterator i(
- entity_->getDirectMandatoryBases().begin());
- i != entity_->getDirectMandatoryBases().end(); ++i)
+ for (const unoidl::AnnotatedReference& ar : entity_->getDirectMandatoryBases())
{
out << indent() << "aSuperTypes[" << n++ << "] = ::cppu::UnoType< ";
- dumpType(out, i->name, true, false, false, true);
+ dumpType(out, ar.name, true, false, false, true);
out << " >::get().getTypeLibType();\n";
}
}
@@ -1305,12 +1294,10 @@ void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) {
out << indent() << "typelib_TypeDescriptionReference * aSuperTypes["
<< entity_->getDirectMandatoryBases().size() << "];\n";
std::vector< unoidl::AnnotatedReference >::size_type n = 0;
- for (std::vector< unoidl::AnnotatedReference >::const_iterator i(
- entity_->getDirectMandatoryBases().begin());
- i != entity_->getDirectMandatoryBases().end(); ++i)
+ for (const unoidl::AnnotatedReference& ar : entity_->getDirectMandatoryBases())
{
out << indent() << "aSuperTypes[" << n++ << "] = ::cppu::UnoType< ";
- dumpType(out, i->name, false, false, false, true);
+ dumpType(out, ar.name, false, false, false, true);
out << " >::get().getTypeLibType();\n";
}
std::size_t count = entity_->getDirectAttributes().size()
@@ -1393,12 +1380,10 @@ void InterfaceType::dumpComprehensiveGetCppuType(FileStream & out) {
void InterfaceType::dumpCppuAttributeRefs(FileStream & out, sal_uInt32 & index)
{
std::vector< unoidl::InterfaceTypeEntity::Attribute >::size_type n = 0;
- for (std::vector< unoidl::InterfaceTypeEntity::Attribute >::const_iterator
- i(entity_->getDirectAttributes().begin());
- i != entity_->getDirectAttributes().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes())
{
out << indent() << "::rtl::OUString sAttributeName" << n << "( \""
- << name_ << "::" << i->name << "\" );\n" << indent()
+ << name_ << "::" << attr.name << "\" );\n" << indent()
<< "typelib_typedescriptionreference_new( &pMembers[" << index++
<< "],\n";
inc(38);
@@ -1412,12 +1397,10 @@ void InterfaceType::dumpCppuAttributeRefs(FileStream & out, sal_uInt32 & index)
void InterfaceType::dumpCppuMethodRefs(FileStream & out, sal_uInt32 & index) {
std::vector< unoidl::InterfaceTypeEntity::Method >::size_type n = 0;
- for (std::vector< unoidl::InterfaceTypeEntity::Method >::const_iterator i(
- entity_->getDirectMethods().begin());
- i != entity_->getDirectMethods().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods())
{
out << indent() << "::rtl::OUString sMethodName" << n << "( \"" << name_
- << "::" << i->name << "\" );\n" << indent()
+ << "::" << method.name << "\" );\n" << indent()
<< "typelib_typedescriptionreference_new( &pMembers[" << index++
<< "],\n";
inc(38);
@@ -1445,21 +1428,19 @@ void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) {
out << "\n" << indent()
<< "typelib_InterfaceAttributeTypeDescription * pAttribute = 0;\n";
std::vector< unoidl::InterfaceTypeEntity::Attribute >::size_type n = 0;
- for (std::vector< unoidl::InterfaceTypeEntity::Attribute >::
- const_iterator i(entity_->getDirectAttributes().begin());
- i != entity_->getDirectAttributes().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes())
{
- OUString type(resolveAllTypedefs(i->type));
+ OUString type(resolveAllTypedefs(attr.type));
out << indent() << "{\n";
inc();
out << indent() << "::rtl::OUString sAttributeType" << n << "( \""
<< type << "\" );\n" << indent()
<< "::rtl::OUString sAttributeName" << n << "( \"" << name_
- << "::" << i->name << "\" );\n";
+ << "::" << attr.name << "\" );\n";
sal_Int32 getExcn = dumpExceptionTypeNames(
- out, "get", i->getExceptions, false);
+ out, "get", attr.getExceptions, false);
sal_Int32 setExcn = dumpExceptionTypeNames(
- out, "set", i->setExceptions, false);
+ out, "set", attr.setExceptions, false);
out << indent()
<< ("typelib_typedescription_newExtendedInterfaceAttribute("
" &pAttribute,\n");
@@ -1467,7 +1448,7 @@ void InterfaceType::dumpCppuAttributes(FileStream & out, sal_uInt32 & index) {
out << indent() << index++ << ", sAttributeName" << n
<< ".pData,\n" << indent() << "(typelib_TypeClass)"
<< getTypeClass(type) << ", sAttributeType" << n << ".pData,\n"
- << indent() << "sal_" << (i->readOnly ? "True" : "False")
+ << indent() << "sal_" << (attr.readOnly ? "True" : "False")
<< ", " << getExcn << ", "
<< (getExcn == 0 ? "0" : "the_getExceptions") << ", " << setExcn
<< ", " << (setExcn == 0 ? "0" : "the_setExceptions")
@@ -1491,26 +1472,22 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) {
out << "\n" << indent()
<< "typelib_InterfaceMethodTypeDescription * pMethod = 0;\n";
std::vector< unoidl::InterfaceTypeEntity::Method >::size_type n = 0;
- for (std::vector< unoidl::InterfaceTypeEntity::Method >::const_iterator
- i(entity_->getDirectMethods().begin());
- i != entity_->getDirectMethods().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods())
{
- OUString returnType(resolveAllTypedefs(i->returnType));
+ OUString returnType(resolveAllTypedefs(method.returnType));
out << indent() << "{\n";
inc();
- if (!i->parameters.empty()) {
+ if (!method.parameters.empty()) {
out << indent() << "typelib_Parameter_Init aParameters["
- << i->parameters.size() << "];\n";
+ << method.parameters.size() << "];\n";
}
std::vector< unoidl::InterfaceTypeEntity::Method::Parameter >::
size_type m = 0;
- for (std::vector< unoidl::InterfaceTypeEntity::Method::Parameter >::
- const_iterator j(i->parameters.begin());
- j != i->parameters.end(); ++j)
+ for (const unoidl::InterfaceTypeEntity::Method::Parameter& param : method.parameters)
{
- OUString type(resolveAllTypedefs(j->type));
+ OUString type(resolveAllTypedefs(param.type));
out << indent() << "::rtl::OUString sParamName" << m << "( \""
- << j->name << "\" );\n" << indent()
+ << param.name << "\" );\n" << indent()
<< "::rtl::OUString sParamType" << m << "( \"" << type
<< "\" );\n" << indent() << "aParameters[" << m
<< "].pParamName = sParamName" << m << ".pData;\n"
@@ -1519,12 +1496,12 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) {
<< getTypeClass(type) << ";\n" << indent() << "aParameters["
<< m << "].pTypeName = sParamType" << m << ".pData;\n"
<< indent() << "aParameters[" << m << "].bIn = "
- << ((j->direction
+ << ((param.direction
== (unoidl::InterfaceTypeEntity::Method::Parameter::
DIRECTION_OUT))
? "sal_False" : "sal_True")
<< ";\n" << indent() << "aParameters[" << m << "].bOut = "
- << ((j->direction
+ << ((param.direction
== (unoidl::InterfaceTypeEntity::Method::Parameter::
DIRECTION_IN))
? "sal_False" : "sal_True")
@@ -1532,20 +1509,20 @@ void InterfaceType::dumpCppuMethods(FileStream & out, sal_uInt32 & index) {
++m;
}
sal_Int32 excn = dumpExceptionTypeNames(
- out, "", i->exceptions,
- i->name != "acquire" && i->name != "release");
+ out, "", method.exceptions,
+ method.name != "acquire" && method.name != "release");
out << indent() << "::rtl::OUString sReturnType" << n << "( \""
<< returnType << "\" );\n" << indent()
<< "::rtl::OUString sMethodName" << n << "( \"" << name_ << "::"
- << i->name << "\" );\n" << indent()
+ << method.name << "\" );\n" << indent()
<< "typelib_typedescription_newInterfaceMethod( &pMethod,\n";
inc();
out << indent() << index++ << ", sal_False,\n" << indent()
<< "sMethodName" << n << ".pData,\n" << indent()
<< "(typelib_TypeClass)" << getTypeClass(returnType)
<< ", sReturnType" << n << ".pData,\n" << indent()
- << i->parameters.size() << ", "
- << (i->parameters.empty() ? "0" : "aParameters") << ",\n"
+ << method.parameters.size() << ", "
+ << (method.parameters.empty() ? "0" : "aParameters") << ",\n"
<< indent() << excn << ", "
<< (excn == 0 ? "0" : "the_Exceptions") << " );\n";
dec();
@@ -1566,27 +1543,21 @@ void InterfaceType::dumpAttributesCppuDecl(
FileStream & out, std::set< OUString > * seen)
{
assert(seen != nullptr);
- for (std::vector< unoidl::InterfaceTypeEntity::Attribute >::const_iterator
- i(entity_->getDirectAttributes().begin());
- i != entity_->getDirectAttributes().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes())
{
- if (seen->insert(i->type).second) {
- dumpCppuGetType(out, i->type);
+ if (seen->insert(attr.type).second) {
+ dumpCppuGetType(out, attr.type);
}
- for (std::vector< OUString >::const_iterator j(
- i->getExceptions.begin());
- j != i->getExceptions.end(); ++j)
+ for (const OUString& exc : attr.getExceptions)
{
- if (seen->insert(*j).second) {
- dumpCppuGetType(out, *j);
+ if (seen->insert(exc).second) {
+ dumpCppuGetType(out, exc);
}
}
- for (std::vector< OUString >::const_iterator j(
- i->setExceptions.begin());
- j != i->setExceptions.end(); ++j)
+ for (const OUString& exc : attr.setExceptions)
{
- if (seen->insert(*j).second) {
- dumpCppuGetType(out, *j);
+ if (seen->insert(exc).second) {
+ dumpCppuGetType(out, exc);
}
}
}
@@ -1596,15 +1567,12 @@ void InterfaceType::dumpMethodsCppuDecl(
FileStream & out, std::set< OUString > * seen)
{
assert(seen != nullptr);
- for (std::vector< unoidl::InterfaceTypeEntity::Method >::const_iterator i(
- entity_->getDirectMethods().begin());
- i != entity_->getDirectMethods().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods())
{
- for (std::vector< OUString >::const_iterator j(i->exceptions.begin());
- j != i->exceptions.end(); ++j)
+ for (const OUString& ex : method.exceptions)
{
- if (seen->insert(*j).second) {
- dumpCppuGetType(out, *j);
+ if (seen->insert(ex).second) {
+ dumpCppuGetType(out, ex);
}
}
}
@@ -1622,14 +1590,13 @@ void InterfaceType::dumpExceptionSpecification(
#endif
out << " throw (";
bool bFirst = true;
- for (std::vector< OUString >::const_iterator i(exceptions.begin());
- i != exceptions.end(); ++i)
+ for (const OUString& ex : exceptions)
{
- if (*i != "com.sun.star.uno.RuntimeException") {
+ if (ex != "com.sun.star.uno.RuntimeException") {
if (!bFirst) {
out << ", ";
}
- out << codemaker::cpp::scopedCppName(u2b(*i));
+ out << codemaker::cpp::scopedCppName(u2b(ex));
bFirst = false;
}
}
@@ -1658,11 +1625,10 @@ sal_Int32 InterfaceType::dumpExceptionTypeNames(
std::vector< OUString > const & exceptions, bool runtimeException)
{
sal_Int32 count = 0;
- for (std::vector< OUString >::const_iterator i(exceptions.begin());
- i != exceptions.end(); ++i)
+ for (const OUString& ex : exceptions)
{
- if (*i != "com.sun.star.uno.RuntimeException") {
- dumpExceptionTypeName(out, prefix, count++, *i);
+ if (ex != "com.sun.star.uno.RuntimeException") {
+ dumpExceptionTypeName(out, prefix, count++, ex);
}
}
if (runtimeException) {
@@ -1732,12 +1698,10 @@ void ConstantGroup::dumpHppFile(
}
void ConstantGroup::dumpDeclaration(FileStream & out) {
- for (std::vector< unoidl::ConstantGroupEntity::Member >::const_iterator i(
- entity_->getMembers().begin());
- i != entity_->getMembers().end(); ++i)
+ for (const unoidl::ConstantGroupEntity::Member& member : entity_->getMembers())
{
out << "static const ";
- switch (i->value.type) {
+ switch (member.value.type) {
case unoidl::ConstantValue::TYPE_BOOLEAN:
out << "::sal_Bool";
break;
@@ -1769,53 +1733,53 @@ void ConstantGroup::dumpDeclaration(FileStream & out) {
out << "double";
break;
}
- out << " " << i->name << " = ";
- switch (i->value.type) {
+ out << " " << member.name << " = ";
+ switch (member.value.type) {
case unoidl::ConstantValue::TYPE_BOOLEAN:
- out << (i->value.booleanValue ? "sal_True" : "sal_False");
+ out << (member.value.booleanValue ? "sal_True" : "sal_False");
break;
case unoidl::ConstantValue::TYPE_BYTE:
- out << "(sal_Int8)" << OUString::number(i->value.byteValue);
+ out << "(sal_Int8)" << OUString::number(member.value.byteValue);
break;
case unoidl::ConstantValue::TYPE_SHORT:
- out << "(sal_Int16)" << OUString::number(i->value.shortValue);
+ out << "(sal_Int16)" << OUString::number(member.value.shortValue);
break;
case unoidl::ConstantValue::TYPE_UNSIGNED_SHORT:
out << "(sal_uInt16)"
- << OUString::number(i->value.unsignedShortValue);
+ << OUString::number(member.value.unsignedShortValue);
break;
case unoidl::ConstantValue::TYPE_LONG:
// Avoid C++ compiler warnings about (un)signedness of literal
// -2^31:
- if (i->value.longValue == SAL_MIN_INT32) {
+ if (member.value.longValue == SAL_MIN_INT32) {
out << "SAL_MIN_INT32";
} else {
- out << "(sal_Int32)" << OUString::number(i->value.longValue);
+ out << "(sal_Int32)" << OUString::number(member.value.longValue);
}
break;
case unoidl::ConstantValue::TYPE_UNSIGNED_LONG:
out << "(sal_uInt32)"
- << OUString::number(i->value.unsignedLongValue) << "U";
+ << OUString::number(member.value.unsignedLongValue) << "U";
break;
case unoidl::ConstantValue::TYPE_HYPER:
// Avoid C++ compiler warnings about (un)signedness of literal
// -2^63:
- if (i->value.hyperValue == SAL_MIN_INT64) {
+ if (member.value.hyperValue == SAL_MIN_INT64) {
out << "SAL_MIN_INT64";
} else {
out << "(sal_Int64) SAL_CONST_INT64("
- << OUString::number(i->value.hyperValue) << ")";
+ << OUString::number(member.value.hyperValue) << ")";
}
break;
case unoidl::ConstantValue::TYPE_UNSIGNED_HYPER:
out << "SAL_CONST_UINT64("
- << OUString::number(i->value.unsignedHyperValue) << ")";
+ << OUString::number(member.value.unsignedHyperValue) << ")";
break;
case unoidl::ConstantValue::TYPE_FLOAT:
- out << "(float)" << OUString::number(i->value.floatValue);
+ out << "(float)" << OUString::number(member.value.floatValue);
break;
case unoidl::ConstantValue::TYPE_DOUBLE:
- out << "(double)" << OUString::number(i->value.doubleValue);
+ out << "(double)" << OUString::number(member.value.doubleValue);
break;
}
out << ";\n";
@@ -1884,15 +1848,13 @@ void PlainStructType::dumpDeclaration(FileStream & out) {
if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) {
out << "\n" << indent() << "inline " << id_ << "(";
bool bFirst = !dumpBaseMembers(out, base, true);
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::
- const_iterator i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers())
{
if (!bFirst) {
out << ", ";
}
- dumpType(out, i->type, true, true);
- out << " " << i->name << "_";
+ dumpType(out, member.type, true, true);
+ out << " " << member.name << "_";
bFirst = false;
}
out << ");\n";
@@ -1939,12 +1901,10 @@ void PlainStructType::dumpHppFile(
<< "()\n";
bFirst = false;
}
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i(
- entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers())
{
- out << indent() << (bFirst ? ":" : ",") << " " << i->name;
- dumpInitializer(out, false, i->type);
+ out << indent() << (bFirst ? ":" : ",") << " " << member.name;
+ dumpInitializer(out, false, member.type);
out << "\n";
bFirst = false;
}
@@ -1954,15 +1914,13 @@ void PlainStructType::dumpHppFile(
out << "inline " << id_;
out << "::" << id_ << "(";
bFirst = !dumpBaseMembers(out, base, true);
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::
- const_iterator i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers())
{
if (!bFirst) {
out << ", ";
}
- dumpType(out, i->type, true, true);
- out << " " << i->name << "_";
+ dumpType(out, member.type, true, true);
+ out << " " << member.name << "_";
bFirst = false;
}
out << ")\n";
@@ -1975,12 +1933,10 @@ void PlainStructType::dumpHppFile(
out << ")\n";
bFirst = false;
}
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::
- const_iterator i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers())
{
- out << indent() << (bFirst ? ":" : ",") << " " << i->name << "("
- << i->name << "_)\n";
+ out << indent() << (bFirst ? ":" : ",") << " " << member.name << "("
+ << member.name << "_)\n";
bFirst = false;
}
dec();
@@ -2066,16 +2022,14 @@ void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) {
out << indent() << "::rtl::OUString the_name( \"" << name_ << "\" );\n";
std::map< OUString, sal_uInt32 > types;
std::vector< unoidl::PlainStructTypeEntity::Member >::size_type n = 0;
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i(
- entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity_->getDirectMembers())
{
if (types.insert(
std::map< OUString, sal_uInt32 >::value_type(
- i->type, static_cast< sal_uInt32 >(types.size()))).
+ member.type, static_cast< sal_uInt32 >(types.size()))).
second)
{
- dumpCppuGetType(out, i->type, &name_);
+ dumpCppuGetType(out, member.type, &name_);
// For typedefs, use the resolved type name, as there will be no
// information available about the typedef itself at runtime (the
// above getCppuType call will make available information about the
@@ -2083,10 +2037,10 @@ void PlainStructType::dumpComprehensiveGetCppuType(FileStream & out) {
// needed, as the header for the typedef includes it already:
out << indent() << "::rtl::OUString the_tname"
<< static_cast< sal_uInt32 >(types.size() - 1) << "( \""
- << resolveAllTypedefs(i->type) << "\" );\n";
+ << resolveAllTypedefs(member.type) << "\" );\n";
}
out << indent() << "::rtl::OUString the_name" << n++ << "( \""
- << i->name << "\" );\n";
+ << member.name << "\" );\n";
}
out << indent() << "::typelib_StructMember_Init the_members[] = {\n";
inc();
@@ -2147,18 +2101,16 @@ bool PlainStructType::dumpBaseMembers(
return false;
}
hasMember = dumpBaseMembers(out, ent2->getDirectBase(), withType);
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::
- const_iterator i(ent2->getDirectMembers().begin());
- i != ent2->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : ent2->getDirectMembers())
{
if (hasMember) {
out << ", ";
}
if (withType) {
- dumpType(out, i->type, true, true);
+ dumpType(out, member.type, true, true);
out << " ";
}
- out << i->name << "_";
+ out << member.name << "_";
hasMember = true;
}
}
@@ -2281,18 +2233,16 @@ void PolyStructType::dumpDeclaration(FileStream & out) {
out << " " << i->name << "_";
}
out << ");\n\n";
- for (std::vector<
- unoidl::PolymorphicStructTypeTemplateEntity::Member >::
- const_iterator i(entity_->getMembers().begin());
- i != entity_->getMembers().end(); ++i)
+ for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member :
+ entity_->getMembers())
{
out << indent();
- if (i->parameterized) {
- dumpTypeParameterName(out, i->type);
+ if (member.parameterized) {
+ dumpTypeParameterName(out, member.type);
} else {
- dumpType(out, i->type);
+ dumpType(out, member.type);
}
- out << " " << i->name << ";\n";
+ out << " " << member.name << ";\n";
}
}
dec();
@@ -2548,21 +2498,19 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) {
std::map< OUString, sal_uInt32 > types;
std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >::
size_type n = 0;
- for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >::
- const_iterator i(entity_->getMembers().begin());
- i != entity_->getMembers().end(); ++i)
+ for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity_->getMembers())
{
- if (i->parameterized) {
+ if (member.parameterized) {
if (parameters.insert(
std::map< OUString, sal_uInt32 >::value_type(
- i->type, static_cast< sal_uInt32 >(parameters.size()))).
+ member.type, static_cast< sal_uInt32 >(parameters.size()))).
second)
{
sal_uInt32 k = static_cast< sal_uInt32 >(parameters.size() - 1);
out << indent()
<< "::css::uno::Type const & the_ptype" << k
<< " = ::cppu::getTypeFavourChar(static_cast< ";
- dumpTypeParameterName(out, i->type);
+ dumpTypeParameterName(out, member.type);
out << " * >(0));\n" << indent()
<< "::typelib_TypeClass the_pclass" << k
<< " = (::typelib_TypeClass) the_ptype" << k
@@ -2572,10 +2520,10 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) {
}
} else if (types.insert(
std::map< OUString, sal_uInt32 >::value_type(
- i->type, static_cast< sal_uInt32 >(types.size()))).
+ member.type, static_cast< sal_uInt32 >(types.size()))).
second)
{
- dumpCppuGetType(out, i->type, &name_);
+ dumpCppuGetType(out, member.type, &name_);
// For typedefs, use the resolved type name, as there will be no
// information available about the typedef itself at runtime (the
// above getCppuType call will make available information about the
@@ -2583,10 +2531,10 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) {
// needed, as the header for the typedef includes it already:
out << indent() << "::rtl::OUString the_tname"
<< static_cast< sal_uInt32 >(types.size() - 1) << "( \""
- << resolveAllTypedefs(i->type) << "\" );\n";
+ << resolveAllTypedefs(member.type) << "\" );\n";
}
out << indent() << "::rtl::OUString the_name" << n++ << "( \""
- << i->name << "\" );\n";
+ << member.name << "\" );\n";
}
out << indent() << "::typelib_StructMember_Init the_members[] = {\n";
inc();
@@ -2777,13 +2725,11 @@ void ExceptionType::dumpHppFile(
<< "()\n";
bFirst = false;
}
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
- entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
out << indent() << (bFirst ? ":" : ",") << " ";
- out << i->name;
- dumpInitializer(out, false, i->type);
+ out << member.name;
+ dumpInitializer(out, false, member.type);
out << "\n";
bFirst = false;
}
@@ -2801,15 +2747,13 @@ void ExceptionType::dumpHppFile(
if (!entity_->getDirectMembers().empty() || getInheritedMemberCount() > 0) {
out << indent() << "inline " << id_ << "::" << id_ << "(";
bFirst = !dumpBaseMembers(out, base, true, false);
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
- i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
if (!bFirst) {
out << ", ";
}
- dumpType(out, i->type, true, true);
- out << " " << i->name << "_";
+ dumpType(out, member.type, true, true);
+ out << " " << member.name << "_";
bFirst = false;
}
out << ")\n";
@@ -2822,12 +2766,10 @@ void ExceptionType::dumpHppFile(
out << ")\n";
bFirst = false;
}
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
- i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
- out << indent() << (bFirst ? ":" : ",") << " " << i->name << "("
- << i->name << "_)\n";
+ out << indent() << (bFirst ? ":" : ",") << " " << member.name << "("
+ << member.name << "_)\n";
bFirst = false;
}
dec();
@@ -2850,11 +2792,9 @@ void ExceptionType::dumpHppFile(
<< "(the_other)";
bFirst = false;
}
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
- entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
- out << (bFirst ? ":" : ",") << " " << i->name << "(the_other." << i->name
+ out << (bFirst ? ":" : ",") << " " << member.name << "(the_other." << member.name
<< ")";
bFirst = false;
}
@@ -2869,11 +2809,9 @@ void ExceptionType::dumpHppFile(
out << indent() << codemaker::cpp::scopedCppName(u2b(base))
<< "::operator =(the_other);\n";
}
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
- entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
- out << indent() << i->name << " = the_other." << i->name << ";\n";
+ out << indent() << member.name << " = the_other." << member.name << ";\n";
}
out << indent() << "return *this;\n";
dec();
@@ -2925,11 +2863,9 @@ void ExceptionType::dumpNormalGetCppuType(FileStream & out) {
<< entity_->getDirectMembers().size() << "];\n";
std::set< OUString > seen;
std::vector< unoidl::ExceptionTypeEntity::Member >::size_type n = 0;
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
- i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
- OUString type(resolveAllTypedefs(i->type));
+ OUString type(resolveAllTypedefs(member.type));
OUString modType(typeToIdentifier(type));
if (seen.insert(type).second) {
out << indent()
@@ -2986,26 +2922,22 @@ void ExceptionType::dumpComprehensiveGetCppuType(FileStream & out) {
out << " >::get();\n";
}
std::set< OUString > seen;
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
- entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
- if (seen.insert(i->type).second) {
- dumpCppuGetType(out, i->type);
+ if (seen.insert(member.type).second) {
+ dumpCppuGetType(out, member.type);
}
}
if (!entity_->getDirectMembers().empty()) {
out << "\n" << indent() << "typelib_CompoundMember_Init aMembers["
<< entity_->getDirectMembers().size() << "];\n";
std::vector< unoidl::ExceptionTypeEntity::Member >::size_type n = 0;
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
- i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
- OUString type(resolveAllTypedefs(i->type));
+ OUString type(resolveAllTypedefs(member.type));
out << indent() << "::rtl::OUString sMemberType" << n << "( \""
<< type << "\" );\n" << indent()
- << "::rtl::OUString sMemberName" << n << "( \"" << i->name
+ << "::rtl::OUString sMemberName" << n << "( \"" << member.name
<< "\" );\n" << indent() << "aMembers[" << n
<< "].eTypeClass = (typelib_TypeClass)" << getTypeClass(type)
<< ";\n" << indent() << "aMembers[" << n
@@ -3056,15 +2988,13 @@ void ExceptionType::dumpDeclaration(FileStream & out) {
out << indent() << "inline CPPU_GCC_DLLPRIVATE " << id_ << "(";
bool eligibleForDefaults = entity_->getDirectMembers().empty();
bool bFirst = !dumpBaseMembers(out, base, true, eligibleForDefaults);
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
- i(entity_->getDirectMembers().begin());
- i != entity_->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : entity_->getDirectMembers())
{
if (!bFirst) {
out << ", ";
}
- dumpType(out, i->type, true, true);
- out << " " << i->name << "_";
+ dumpType(out, member.type, true, true);
+ out << " " << member.name << "_";
bFirst = false;
}
out << ");\n\n";
@@ -3113,29 +3043,28 @@ bool ExceptionType::dumpBaseMembers(
hasMember = dumpBaseMembers( out, ent2->getDirectBase(), withType,
eligibleForDefaults && ent2->getDirectMembers().empty() );
int memberCount = 0;
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator
- i(ent2->getDirectMembers().begin());
- i != ent2->getDirectMembers().end(); ++i, ++memberCount)
+ for (const unoidl::ExceptionTypeEntity::Member& member : ent2->getDirectMembers())
{
if (hasMember) {
out << ", ";
}
if (withType) {
- dumpType(out, i->type, true, true);
+ dumpType(out, member.type, true, true);
out << " ";
}
- out << i->name << "_";
+ out << member.name << "_";
// We want to provide a default parameter value for uno::Exception subtype
// constructors, since most of the time we don't pass a Context object in to the exception
// throw sites.
if (eligibleForDefaults
&& base == "com.sun.star.uno.Exception"
&& memberCount == 1
- && i->name == "Context"
- && i->type == "com.sun.star.uno.XInterface") {
+ && member.name == "Context"
+ && member.type == "com.sun.star.uno.XInterface") {
out << " = ::css::uno::Reference< ::css::uno::XInterface >()";
}
hasMember = true;
+ ++memberCount;
}
}
return hasMember;
@@ -3191,11 +3120,9 @@ void EnumType::dumpDeclaration(FileStream& o)
o << "\nenum SAL_DLLPUBLIC_RTTI " << id_ << "\n{\n";
inc();
- for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
- entity_->getMembers().begin());
- i != entity_->getMembers().end(); ++i)
+ for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers())
{
- o << indent() << id_ << "_" << u2b(i->name) << " = " << i->value
+ o << indent() << id_ << "_" << u2b(member.name) << " = " << member.value
<< ",\n";
}
@@ -3269,12 +3196,10 @@ void EnumType::dumpComprehensiveGetCppuType(FileStream& o)
o << indent() << "rtl_uString* enumValueNames["
<< entity_->getMembers().size() << "];\n";
std::vector< unoidl::EnumTypeEntity::Member >::size_type n = 0;
- for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
- entity_->getMembers().begin());
- i != entity_->getMembers().end(); ++i)
+ for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers())
{
o << indent() << "::rtl::OUString sEnumValue" << n << "( \""
- << u2b(i->name) << "\" );\n";
+ << u2b(member.name) << "\" );\n";
o << indent() << "enumValueNames[" << n << "] = sEnumValue" << n
<< ".pData;\n";
++n;
@@ -3283,11 +3208,9 @@ void EnumType::dumpComprehensiveGetCppuType(FileStream& o)
o << "\n" << indent() << "sal_Int32 enumValues["
<< entity_->getMembers().size() << "];\n";
n = 0;
- for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
- entity_->getMembers().begin());
- i != entity_->getMembers().end(); ++i)
+ for (const unoidl::EnumTypeEntity::Member& member : entity_->getMembers())
{
- o << indent() << "enumValues[" << n++ << "] = " << i->value << ";\n";
+ o << indent() << "enumValues[" << n++ << "] = " << member.value << ";\n";
}
o << "\n" << indent() << "typelib_typedescription_newEnum( &pTD,\n";
@@ -3414,11 +3337,9 @@ void includeExceptions(
if (node->present) {
includes.add(node->name);
} else {
- for (codemaker::ExceptionTreeNode::Children::const_iterator i(
- node->children.begin());
- i != node->children.end(); ++i)
+ for (codemaker::ExceptionTreeNode* pChild : node->children)
{
- includeExceptions(includes, *i);
+ includeExceptions(includes, pChild);
}
}
}
@@ -3462,27 +3383,21 @@ void ServiceType::dumpHppFile(
includes.addRtlUstringHxx();
includes.add("com.sun.star.uno.DeploymentException");
includes.add("com.sun.star.uno.XComponentContext");
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::Constructor >::
- const_iterator i(entity_->getConstructors().begin());
- i != entity_->getConstructors().end(); ++i)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : entity_->getConstructors())
{
- if (i->defaultConstructor) {
+ if (cons.defaultConstructor) {
includes.add("com.sun.star.uno.Exception");
includes.add("com.sun.star.uno.RuntimeException");
} else {
- if (!hasRestParameter(*i)) {
+ if (!hasRestParameter(cons)) {
includes.addAny();
includes.addSequence();
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::
- Constructor::Parameter >::const_iterator j(
- i->parameters.begin());
- j != i->parameters.end(); ++j)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param :
+ cons.parameters)
{
if (m_typeMgr->getSort(
b2u(codemaker::UnoType::decompose(
- u2b(j->type))))
+ u2b(param.type))))
== codemaker::UnoType::SORT_CHAR)
{
includes.addCppuUnotypeHxx();
@@ -3491,11 +3406,9 @@ void ServiceType::dumpHppFile(
}
}
codemaker::ExceptionTree tree;
- for (std::vector< OUString >::const_iterator j(
- i->exceptions.begin());
- j != i->exceptions.end(); ++j)
+ for (const OUString& ex : cons.exceptions)
{
- tree.add(u2b(*j), m_typeMgr);
+ tree.add(u2b(ex), m_typeMgr);
}
if (!tree.getRoot().present) {
includes.add("com.sun.star.uno.Exception");
@@ -3535,12 +3448,10 @@ void ServiceType::dumpHppFile(
OString baseName(u2b(entity_->getBase()));
OString scopedBaseName(codemaker::cpp::scopedCppName(baseName));
o << "public:\n";
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::Constructor >::
- const_iterator i(entity_->getConstructors().begin());
- i != entity_->getConstructors().end(); ++i)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons :
+ entity_->getConstructors())
{
- if (i->defaultConstructor) {
+ if (cons.defaultConstructor) {
o << indent() << "static ::css::uno::Reference< "
<< scopedBaseName << " > "
<< codemaker::cpp::translateUnoToCppIdentifier(
@@ -3602,54 +3513,49 @@ void ServiceType::dumpHppFile(
o << indent() << "static ::css::uno::Reference< "
<< scopedBaseName << " > "
<< codemaker::cpp::translateUnoToCppIdentifier(
- u2b(i->name), "method", codemaker::cpp::ITM_NONGLOBAL,
+ u2b(cons.name), "method", codemaker::cpp::ITM_NONGLOBAL,
&cppName)
<< ("(::css::uno::Reference< ::css::uno::XComponentContext > const &"
" the_context");
- bool rest = hasRestParameter(*i);
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::Constructor::
- Parameter >::const_iterator j(i->parameters.begin());
- j != i->parameters.end(); ++j)
+ bool rest = hasRestParameter(cons);
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param :
+ cons.parameters)
{
o << ", ";
OUStringBuffer buf;
- if (j->rest) {
+ if (param.rest) {
buf.append("[]");
}
- buf.append(j->type);
+ buf.append(param.type);
OUString type(buf.makeStringAndClear());
bool byRef = passByReference(type);
dumpType(o, type, byRef, byRef);
o << " "
<< codemaker::cpp::translateUnoToCppIdentifier(
- u2b(j->name), "param", codemaker::cpp::ITM_NONGLOBAL);
+ u2b(param.name), "param", codemaker::cpp::ITM_NONGLOBAL);
}
o << ") {\n";
inc();
o << indent() << "assert(the_context.is());\n";
- if (!rest && !i->parameters.empty()) {
+ if (!rest && !cons.parameters.empty()) {
o << indent()
<< ("::css::uno::Sequence< ::css::uno::Any > the_arguments(")
- << i->parameters.size() << ");\n";
+ << cons.parameters.size() << ");\n";
std::vector<
unoidl::SingleInterfaceBasedServiceEntity::Constructor::
Parameter >::size_type n = 0;
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::
- Constructor::Parameter >::const_iterator j(
- i->parameters.begin());
- j != i->parameters.end(); ++j)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& j :
+ cons.parameters)
{
o << indent() << "the_arguments[" << n++ << "] ";
OString param(
codemaker::cpp::translateUnoToCppIdentifier(
- u2b(j->name), "param",
+ u2b(j.name), "param",
codemaker::cpp::ITM_NONGLOBAL));
sal_Int32 rank;
if (m_typeMgr->getSort(
b2u(codemaker::UnoType::decompose(
- u2b(j->type), &rank)))
+ u2b(j.type), &rank)))
== codemaker::UnoType::SORT_CHAR)
{
o << "= ::css::uno::Any(&" << param
@@ -3671,11 +3577,9 @@ void ServiceType::dumpHppFile(
o << indent() << "::css::uno::Reference< "
<< scopedBaseName << " > the_instance;\n";
codemaker::ExceptionTree tree;
- for (std::vector< OUString >::const_iterator j(
- i->exceptions.begin());
- j != i->exceptions.end(); ++j)
+ for (const OUString& ex : cons.exceptions)
{
- tree.add(u2b(*j), m_typeMgr);
+ tree.add(u2b(ex), m_typeMgr);
}
if (!tree.getRoot().present) {
o << indent() << "try {\n";
@@ -3696,9 +3600,9 @@ void ServiceType::dumpHppFile(
<< ")(the_context.get(), ";
if (rest) {
o << codemaker::cpp::translateUnoToCppIdentifier(
- u2b(i->parameters.back().name), "param",
+ u2b(cons.parameters.back().name), "param",
codemaker::cpp::ITM_NONGLOBAL);
- } else if (i->parameters.empty()) {
+ } else if (cons.parameters.empty()) {
o << "::css::uno::Sequence< ::css::uno::Any >()";
} else {
o << "the_arguments";
@@ -3708,7 +3612,7 @@ void ServiceType::dumpHppFile(
"init(the_instance, ::css::uno::UNO_QUERY);\n")
<< indent() << "if (init.is()) {\n"
<< indent() << " init->initialize(";
- if (i->parameters.empty()) {
+ if (cons.parameters.empty()) {
o << "::css::uno::Sequence< ::css::uno::Any >()";
} else {
o << "the_arguments";
@@ -3723,9 +3627,9 @@ void ServiceType::dumpHppFile(
<< name_ << "\", ";
if (rest) {
o << codemaker::cpp::translateUnoToCppIdentifier(
- u2b(i->parameters.back().name), "param",
+ u2b(cons.parameters.back().name), "param",
codemaker::cpp::ITM_NONGLOBAL);
- } else if (i->parameters.empty()) {
+ } else if (cons.parameters.empty()) {
o << ("::css::uno::Sequence< ::css::uno::Any >()");
} else {
o << "the_arguments";
@@ -3785,11 +3689,9 @@ void ServiceType::dumpCatchClauses(
out << indent() << "throw;\n";
dec();
} else {
- for (codemaker::ExceptionTreeNode::Children::const_iterator i(
- node->children.begin());
- i != node->children.end(); ++i)
+ for (codemaker::ExceptionTreeNode* pChild : node->children)
{
- dumpCatchClauses(out, *i);
+ dumpCatchClauses(out, pChild);
}
}
}
diff --git a/codemaker/source/cppumaker/dependencies.cxx b/codemaker/source/cppumaker/dependencies.cxx
index ebcd839d579f..a50f65fc470e 100644
--- a/codemaker/source/cppumaker/dependencies.cxx
+++ b/codemaker/source/cppumaker/dependencies.cxx
@@ -61,11 +61,9 @@ Dependencies::Dependencies(
if (!ent2->getDirectBase().isEmpty()) {
insert(ent2->getDirectBase());
}
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::
- const_iterator i(ent2->getDirectMembers().begin());
- i != ent2->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : ent2->getDirectMembers())
{
- insert(i->type);
+ insert(member.type);
}
break;
}
@@ -74,12 +72,10 @@ Dependencies::Dependencies(
rtl::Reference< unoidl::PolymorphicStructTypeTemplateEntity > ent2(
static_cast< unoidl::PolymorphicStructTypeTemplateEntity * >(
ent.get()));
- for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::
- Member >::const_iterator i(ent2->getMembers().begin());
- i != ent2->getMembers().end(); ++i)
+ for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : ent2->getMembers())
{
- if (!i->parameterized) {
- insert(i->type);
+ if (!member.parameterized) {
+ insert(member.type);
}
}
break;
@@ -91,11 +87,9 @@ Dependencies::Dependencies(
if (!ent2->getDirectBase().isEmpty()) {
insert(ent2->getDirectBase());
}
- for (std::vector< unoidl::ExceptionTypeEntity::Member >::
- const_iterator i(ent2->getDirectMembers().begin());
- i != ent2->getDirectMembers().end(); ++i)
+ for (const unoidl::ExceptionTypeEntity::Member& member : ent2->getDirectMembers())
{
- insert(i->type);
+ insert(member.type);
}
break;
}
@@ -103,52 +97,37 @@ Dependencies::Dependencies(
{
rtl::Reference< unoidl::InterfaceTypeEntity > ent2(
static_cast< unoidl::InterfaceTypeEntity * >(ent.get()));
- for (std::vector< unoidl::AnnotatedReference >::const_iterator i(
- ent2->getDirectMandatoryBases().begin());
- i != ent2->getDirectMandatoryBases().end(); ++i)
+ for (const unoidl::AnnotatedReference& ar : ent2->getDirectMandatoryBases())
{
- insert(i->name, true);
+ insert(ar.name, true);
}
if (!(ent2->getDirectAttributes().empty()
&& ent2->getDirectMethods().empty()))
{
insert("com.sun.star.uno.RuntimeException");
}
- for (std::vector< unoidl::InterfaceTypeEntity::Attribute >::
- const_iterator i(ent2->getDirectAttributes().begin());
- i != ent2->getDirectAttributes().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Attribute& attr : ent2->getDirectAttributes())
{
- insert(i->type);
- for (std::vector< OUString >::const_iterator j(
- i->getExceptions.begin());
- j != i->getExceptions.end(); ++j)
+ insert(attr.type);
+ for (const OUString& ex : attr.getExceptions)
{
- insert(*j);
+ insert(ex);
}
- for (std::vector< OUString >::const_iterator j(
- i->setExceptions.begin());
- j != i->setExceptions.end(); ++j)
+ for (const OUString& ex : attr.setExceptions)
{
- insert(*j);
+ insert(ex);
}
}
- for (std::vector< unoidl::InterfaceTypeEntity::Method >::
- const_iterator i(ent2->getDirectMethods().begin());
- i != ent2->getDirectMethods().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Method& method : ent2->getDirectMethods())
{
- insert(i->returnType);
- for (std::vector<
- unoidl::InterfaceTypeEntity::Method::Parameter >::
- const_iterator j(i->parameters.begin());
- j != i->parameters.end(); ++j)
+ insert(method.returnType);
+ for (const unoidl::InterfaceTypeEntity::Method::Parameter& param : method.parameters)
{
- insert(j->type);
+ insert(param.type);
}
- for (std::vector< OUString >::const_iterator j(
- i->exceptions.begin());
- j != i->exceptions.end(); ++j)
+ for (const OUString& ex : method.exceptions)
{
- insert(*j);
+ insert(ex);
}
}
break;
@@ -160,11 +139,9 @@ Dependencies::Dependencies(
{
rtl::Reference< unoidl::ConstantGroupEntity > ent2(
static_cast< unoidl::ConstantGroupEntity * >(ent.get()));
- for (std::vector< unoidl::ConstantGroupEntity::Member >::
- const_iterator i(ent2->getMembers().begin());
- i != ent2->getMembers().end(); ++i)
+ for (const unoidl::ConstantGroupEntity::Member& member : ent2->getMembers())
{
- switch (i->value.type) {
+ switch (member.value.type) {
case unoidl::ConstantValue::TYPE_BOOLEAN:
m_booleanDependency = true;
break;
@@ -207,27 +184,19 @@ Dependencies::Dependencies(
if (!ent2->getConstructors().empty()) {
insert(ent2->getBase());
}
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::Constructor >::
- const_iterator i(ent2->getConstructors().begin());
- i != ent2->getConstructors().end(); ++i)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons : ent2->getConstructors())
{
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::
- Constructor::Parameter >::const_iterator j(
- i->parameters.begin());
- j != i->parameters.end(); ++j)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param
+ : cons.parameters)
{
- insert(j->type);
- if (j->rest) {
+ insert(param.type);
+ if (param.rest) {
m_sequenceDependency = true;
}
}
- for (std::vector< OUString >::const_iterator j(
- i->exceptions.begin());
- j != i->exceptions.end(); ++j)
+ for (const OUString& ex : cons.exceptions)
{
- insert(*j);
+ insert(ex);
}
}
break;
@@ -298,10 +267,9 @@ void Dependencies::insert(OUString const & name, bool base) {
m_anyDependency = true;
break;
case UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
- for (std::vector< OString >::iterator i(args.begin()); i != args.end();
- ++i)
+ for (const OString& arg : args)
{
- insert(b2u(*i));
+ insert(b2u(arg));
}
// fall through
case UnoType::SORT_SEQUENCE_TYPE:
diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx
index 22c783085558..d1a9f2b65318 100644
--- a/codemaker/source/cppumaker/includes.cxx
+++ b/codemaker/source/cppumaker/includes.cxx
@@ -100,10 +100,9 @@ void Includes::add(OString const & entityName) {
m_includeAny = true;
break;
case codemaker::UnoType::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
- for (std::vector< OString >::iterator i(args.begin()); i != args.end();
- ++i)
+ for (const OString& arg : args)
{
- add(*i);
+ add(arg);
}
// fall through
case codemaker::UnoType::SORT_SEQUENCE_TYPE:
@@ -137,10 +136,9 @@ void dumpEmptyLineBeforeFirst(FileStream & out, bool * first) {
void Includes::dump(FileStream & out, OUString const * companionHdl) {
OSL_ASSERT(companionHdl == nullptr || m_hpp);
if (!m_includeReference) {
- for (Dependencies::Map::iterator i(m_map.begin()); i != m_map.end();
- ++i)
+ for (const std::pair<OUString, codemaker::cppumaker::Dependencies::Kind>& pair : m_map)
{
- if (isInterfaceType(u2b(i->first))) {
+ if (isInterfaceType(u2b(pair.first))) {
m_includeReference = true;
break;
}
@@ -161,25 +159,25 @@ void Includes::dump(FileStream & out, OUString const * companionHdl) {
dumpInclude(out, u2b(*companionHdl), false);
}
bool first = true;
- for (Dependencies::Map::iterator i(m_map.begin()); i != m_map.end(); ++i)
+ for (const std::pair<OUString, codemaker::cppumaker::Dependencies::Kind>& pair : m_map)
{
dumpEmptyLineBeforeFirst(out, &first);
- if (m_hpp || i->second == Dependencies::KIND_BASE
- || !isInterfaceType(u2b(i->first)))
+ if (m_hpp || pair.second == Dependencies::KIND_BASE
+ || !isInterfaceType(u2b(pair.first)))
{
- dumpInclude(out, u2b(i->first), m_hpp);
+ dumpInclude(out, u2b(pair.first), m_hpp);
} else {
- bool ns = dumpNamespaceOpen(out, i->first, false);
+ bool ns = dumpNamespaceOpen(out, pair.first, false);
if (ns) {
out << " ";
}
out << "class ";
- dumpTypeIdentifier(out, i->first);
+ dumpTypeIdentifier(out, pair.first);
out << ";";
if (ns) {
out << " ";
}
- dumpNamespaceClose(out, i->first, false);
+ dumpNamespaceClose(out, pair.first, false);
out << "\n";
}
}
diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx
index b33d28153105..6e9b9845f6fd 100644
--- a/codemaker/source/javamaker/classfile.cxx
+++ b/codemaker/source/javamaker/classfile.cxx
@@ -246,21 +246,17 @@ void ClassFile::Code::instrLookupswitch(
appendU4(m_code, static_cast< sal_uInt32 >(pos2 - pos1)); //FIXME: overflow
pos2 += defaultBlock->m_code.size(); //FIXME: overflow
appendU4(m_code, static_cast< sal_uInt32 >(size));
- for (std::list< std::pair< sal_Int32, Code * > >::const_iterator i(
- blocks.begin());
- i != blocks.end(); ++i)
+ for (const std::pair< sal_Int32, Code * >& pair : blocks)
{
- appendU4(m_code, static_cast< sal_uInt32 >(i->first));
+ appendU4(m_code, static_cast< sal_uInt32 >(pair.first));
appendU4(m_code, static_cast< sal_uInt32 >(pos2 - pos1));
//FIXME: overflow
- pos2 += i->second->m_code.size(); //FIXME: overflow
+ pos2 += pair.second->m_code.size(); //FIXME: overflow
}
appendStream(m_code, defaultBlock->m_code);
- for (std::list< std::pair< sal_Int32, Code * > >::const_iterator i(
- blocks.begin());
- i != blocks.end(); ++i)
+ for (const std::pair< sal_Int32, Code * >& pair : blocks)
{
- appendStream(m_code, i->second->m_code);
+ appendStream(m_code, pair.second->m_code);
}
}
@@ -335,23 +331,21 @@ void ClassFile::Code::instrTableswitch(
pos2 += defaultBlock->m_code.size(); //FIXME: overflow
appendU4(m_code, static_cast< sal_uInt32 >(low));
appendU4(m_code, static_cast< sal_uInt32 >(low + (size - 1)));
- for (std::list< Code * >::const_iterator i(blocks.begin());
- i != blocks.end(); ++i)
+ for (Code *pCode : blocks)
{
- if (*i == nullptr) {
+ if (pCode == nullptr) {
appendU4(m_code, defaultOffset);
} else {
appendU4(m_code, static_cast< sal_uInt32 >(pos2 - pos1));
//FIXME: overflow
- pos2 += (*i)->m_code.size(); //FIXME: overflow
+ pos2 += pCode->m_code.size(); //FIXME: overflow
}
}
appendStream(m_code, defaultBlock->m_code);
- for (std::list< Code * >::const_iterator i(blocks.begin());
- i != blocks.end(); ++i)
+ for (Code *pCode : blocks)
{
- if (*i != nullptr) {
- appendStream(m_code, (*i)->m_code);
+ if (pCode != nullptr) {
+ appendStream(m_code, pCode->m_code);
}
}
}
@@ -640,10 +634,9 @@ void ClassFile::addMethod(
m_methods,
static_cast< sal_uInt32 >(2 + 2 * static_cast< sal_uInt32 >(excs)));
appendU2(m_methods, static_cast< sal_uInt16 >(excs));
- for (std::vector< OString >::const_iterator i(exceptions.begin());
- i != exceptions.end(); ++i)
+ for (const OString& ex : exceptions)
{
- appendU2(m_methods, addClassInfo(*i));
+ appendU2(m_methods, addClassInfo(ex));
}
}
appendSignatureAttribute(m_methods, signature);
diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx
index b711806a3b55..282d474c7fc4 100644
--- a/codemaker/source/javamaker/javamaker.cxx
+++ b/codemaker/source/javamaker/javamaker.cxx
@@ -44,17 +44,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
}
rtl::Reference< TypeManager > typeMgr(new TypeManager);
- for (std::vector< rtl::OString >::const_iterator i(
- options.getExtraInputFiles().begin());
- i != options.getExtraInputFiles().end(); ++i)
+ for (const OString& i : options.getExtraInputFiles())
{
- typeMgr->loadProvider(convertToFileUrl(*i), false);
+ typeMgr->loadProvider(convertToFileUrl(i), false);
}
- for (std::vector< rtl::OString >::const_iterator i(
- options.getInputFiles().begin());
- i != options.getInputFiles().end(); ++i)
+ for (const OString& i : options.getInputFiles())
{
- typeMgr->loadProvider(convertToFileUrl(*i), true);
+ typeMgr->loadProvider(convertToFileUrl(i), true);
}
codemaker::GeneratedTypeSet generated;
if (options.isValid("-T")) {
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index ae198763c953..7157b1b51410 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -253,12 +253,10 @@ SpecialType translateUnoTypeToDescriptor(
"L" + codemaker::convertString(nucleus).replace('.', '/'));
if (!arguments.empty()) {
signature->append('<');
- for (std::vector< OUString >::const_iterator i(
- arguments.begin());
- i != arguments.end(); ++i)
+ for (const OUString& arg : arguments)
{
translateUnoTypeToDescriptor(
- manager, *i, false, true, dependencies, nullptr, signature,
+ manager, arg, false, true, dependencies, nullptr, signature,
needsSignature, nullptr);
}
signature->append('>');
@@ -661,12 +659,11 @@ void addTypeInfo(
code->instrAnewarray("com/sun/star/lib/uno/typeinfo/TypeInfo");
sal_Int32 index = 0;
sal_uInt16 stack = 0;
- for (std::vector< TypeInfo >::const_iterator i(typeInfo.begin());
- i != typeInfo.end(); ++i)
+ for (const TypeInfo& ti : typeInfo)
{
code->instrDup();
code->loadIntegerConstant(index++);
- stack = std::max(stack, i->generateCode(*code, dependencies));
+ stack = std::max(stack, ti.generateCode(*code, dependencies));
code->instrAastore();
}
code->instrPutstatic(
@@ -698,11 +695,9 @@ void handleEnumType(
| ClassFile::ACC_SUPER),
className, "com/sun/star/uno/Enum", ""));
OString classDescriptor("L" + className + ";");
- for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
- entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
+ for (const unoidl::EnumTypeEntity::Member& member : entity->getMembers())
{
- OString fieldName(codemaker::convertString(i->name));
+ OString fieldName(codemaker::convertString(member.name));
cf->addField(
static_cast< ClassFile::AccessFlags >(
ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
@@ -713,7 +708,7 @@ void handleEnumType(
ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
| ClassFile::ACC_FINAL),
fieldName + "_value", "I",
- cf->addIntegerInfo(i->value), "");
+ cf->addIntegerInfo(member.value), "");
}
std::unique_ptr< ClassFile::Code > code(cf->newCode());
code->loadLocalReference(0);
@@ -742,15 +737,13 @@ void handleEnumType(
std::map< sal_Int32, OString > map;
sal_Int32 min = SAL_MAX_INT32;
sal_Int32 max = SAL_MIN_INT32;
- for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
- entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
+ for (const unoidl::EnumTypeEntity::Member& member : entity->getMembers())
{
- min = std::min(min, i->value);
- max = std::max(max, i->value);
+ min = std::min(min, member.value);
+ max = std::max(max, member.value);
map.insert(
std::map< sal_Int32, OString >::value_type(
- i->value, codemaker::convertString(i->name)));
+ member.value, codemaker::convertString(member.name)));
}
sal_uInt64 size = static_cast< sal_uInt64 >(map.size());
if ((static_cast< sal_uInt64 >(max) - static_cast< sal_uInt64 >(min)
@@ -763,10 +756,9 @@ void handleEnumType(
std::list< ClassFile::Code * > blocks;
//FIXME: pointers contained in blocks may leak
sal_Int32 last = SAL_MAX_INT32;
- for (std::map< sal_Int32, OString >::iterator i(map.begin());
- i != map.end(); ++i)
+ for (const std::pair< sal_Int32, OString >& pair : map)
{
- sal_Int32 value = i->first;
+ sal_Int32 value = pair.first;
if (last != SAL_MAX_INT32) {
for (sal_Int32 j = last + 1; j < value; ++j) {
blocks.push_back(nullptr);
@@ -774,16 +766,15 @@ void handleEnumType(
}
last = value;
std::unique_ptr< ClassFile::Code > blockCode(cf->newCode());
- blockCode->instrGetstatic(className, i->second, classDescriptor);
+ blockCode->instrGetstatic(className, pair.second, classDescriptor);
blockCode->instrAreturn();
blocks.push_back(blockCode.get());
blockCode.release();
}
code->instrTableswitch(defCode.get(), min, blocks);
- for (std::list< ClassFile::Code * >::iterator i(blocks.begin());
- i != blocks.end(); ++i)
+ for (ClassFile::Code *p : blocks)
{
- delete *i;
+ delete p;
}
} else{
std::unique_ptr< ClassFile::Code > defCode(cf->newCode());
@@ -791,21 +782,18 @@ void handleEnumType(
defCode->instrAreturn();
std::list< std::pair< sal_Int32, ClassFile::Code * > > blocks;
//FIXME: pointers contained in blocks may leak
- for (std::map< sal_Int32, OString >::iterator i(map.begin());
- i != map.end(); ++i)
+ for (const std::pair< sal_Int32, OString >& pair : map )
{
std::unique_ptr< ClassFile::Code > blockCode(cf->newCode());
- blockCode->instrGetstatic(className, i->second, classDescriptor);
+ blockCode->instrGetstatic(className, pair.second, classDescriptor);
blockCode->instrAreturn();
- blocks.push_back(std::make_pair(i->first, blockCode.get()));
+ blocks.push_back(std::make_pair(pair.first, blockCode.get()));
blockCode.release();
}
code->instrLookupswitch(defCode.get(), blocks);
- for (std::list< std::pair< sal_Int32, ClassFile::Code * > >::iterator
- i(blocks.begin());
- i != blocks.end(); ++i)
+ for (const std::pair< sal_Int32, ClassFile::Code * >& pair : blocks)
{
- delete i->second;
+ delete pair.second;
}
}
code->setMaxStackAndLocals(1, 1);
@@ -815,16 +803,14 @@ void handleEnumType(
"fromInt", "(I)" + classDescriptor, code.get(),
std::vector< OString >(), "");
code.reset(cf->newCode());
- for (std::vector< unoidl::EnumTypeEntity::Member >::const_iterator i(
- entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
+ for (const unoidl::EnumTypeEntity::Member& member : entity->getMembers())
{
code->instrNew(className);
code->instrDup();
- code->loadIntegerConstant(i->value);
+ code->loadIntegerConstant(member.value);
code->instrInvokespecial(className, "<init>", "(I)V");
code->instrPutstatic(
- className, codemaker::convertString(i->name), classDescriptor);
+ className, codemaker::convertString(member.name), classDescriptor);
}
code->instrReturn();
code->setMaxStackAndLocals(3, 0);
@@ -1378,12 +1364,10 @@ void addPlainStructBaseArguments(
manager, dependencies, methodDescriptor, code,
ent2.getDirectBase(), index);
}
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i(
- ent2.getDirectMembers().begin());
- i != ent2.getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : ent2.getDirectMembers())
{
- methodDescriptor->addParameter(i->type, false, true, nullptr);
- addLoadLocal(manager, code, index, false, i->type, false, dependencies);
+ methodDescriptor->addParameter(member.type, false, true, nullptr);
+ addLoadLocal(manager, code, index, false, member.type, false, dependencies);
}
}
@@ -1411,26 +1395,22 @@ void handlePlainStructType(
className, superClass, ""));
std::vector< TypeInfo > typeInfo;
sal_Int32 index = 0;
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i(
- entity->getDirectMembers().begin());
- i != entity->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity->getDirectMembers())
{
addField(
- manager, dependencies, cf.get(), &typeInfo, -1, i->type, i->name,
+ manager, dependencies, cf.get(), &typeInfo, -1, member.type, member.name,
index++);
}
std::unique_ptr< ClassFile::Code > code(cf->newCode());
code->loadLocalReference(0);
code->instrInvokespecial(superClass, "<init>", "()V");
sal_uInt16 stack = 0;
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i(
- entity->getDirectMembers().begin());
- i != entity->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity->getDirectMembers())
{
stack = std::max(
stack,
addFieldInit(
- manager, className, i->name, false, i->type, dependencies,
+ manager, className, member.name, false, member.type, dependencies,
code.get()));
}
code->instrReturn();
@@ -1449,15 +1429,13 @@ void handlePlainStructType(
}
code->instrInvokespecial(superClass, "<init>", desc.getDescriptor());
sal_uInt16 maxSize = index2;
- for (std::vector< unoidl::PlainStructTypeEntity::Member >::const_iterator i(
- entity->getDirectMembers().begin());
- i != entity->getDirectMembers().end(); ++i)
+ for (const unoidl::PlainStructTypeEntity::Member& member : entity->getDirectMembers())
{
maxSize = std::max(
maxSize,
addDirectArgument(
manager, dependencies, &desc, code.get(), &index2, className,
- codemaker::convertString(i->name), false, i->type));
+ codemaker::convertString(member.name), false, member.type));
}
code->instrReturn();
code->setMaxStackAndLocals(maxSize, index2);
@@ -1480,14 +1458,11 @@ void handlePolyStructType(
std::map< OUString, sal_Int32 > typeParameters;
OStringBuffer sig("<");
sal_Int32 index = 0;
- for (std::vector< OUString >::const_iterator i(
- entity->getTypeParameters().begin());
- i != entity->getTypeParameters().end(); ++i)
+ for (const OUString& param : entity->getTypeParameters())
{
- sig.append(codemaker::convertString(*i) + ":Ljava/lang/Object;");
+ sig.append(codemaker::convertString(param) + ":Ljava/lang/Object;");
if (!typeParameters.insert(
- std::map< OUString, sal_Int32 >::value_type(*i, index++)).
- second)
+ std::map< OUString, sal_Int32 >::value_type(param, index++)).second)
{
throw CannotDumpException("Bad type information"); //TODO
}
@@ -1500,14 +1475,12 @@ void handlePolyStructType(
className, "java/lang/Object", sig.makeStringAndClear()));
std::vector< TypeInfo > typeInfo;
index = 0;
- for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >::
- const_iterator i(entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
+ for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity->getMembers())
{
sal_Int32 typeParameterIndex;
- if (i->parameterized) {
+ if (member.parameterized) {
std::map< OUString, sal_Int32 >::iterator it(
- typeParameters.find(i->type));
+ typeParameters.find(member.type));
if (it == typeParameters.end()) {
throw CannotDumpException("Bad type information"); //TODO
}
@@ -1517,20 +1490,18 @@ void handlePolyStructType(
}
addField(
manager, dependencies, cf.get(), &typeInfo, typeParameterIndex,
- i->type, i->name, index++);
+ member.type, member.name, index++);
}
std::unique_ptr< ClassFile::Code > code(cf->newCode());
code->loadLocalReference(0);
code->instrInvokespecial("java/lang/Object", "<init>", "()V");
sal_uInt16 stack = 0;
- for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >::
- const_iterator i(entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
+ for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity->getMembers())
{
stack = std::max(
stack,
addFieldInit(
- manager, className, i->name, i->parameterized, i->type,
+ manager, className, member.name, member.parameterized, member.type,
dependencies, code.get()));
}
code->instrReturn();
@@ -1545,15 +1516,13 @@ void handlePolyStructType(
code->instrInvokespecial(
"java/lang/Object", "<init>", desc.getDescriptor());
sal_uInt16 maxSize = index2;
- for (std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >::
- const_iterator i(entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
+ for (const unoidl::PolymorphicStructTypeTemplateEntity::Member& member : entity->getMembers())
{
maxSize = std::max(
maxSize,
addDirectArgument(
manager, dependencies, &desc, code.get(), &index2, className,
- codemaker::convertString(i->name), i->parameterized, i->type));
+ codemaker::convertString(member.name), member.parameterized, member.type));
}
code->instrReturn();
code->setMaxStackAndLocals(maxSize, index2);
@@ -1878,11 +1847,10 @@ void createExceptionsAttribute(
{
assert(dependencies != nullptr);
assert(exceptions != nullptr);
- for (std::vector< OUString >::const_iterator i(exceptionTypes.begin());
- i != exceptionTypes.end(); ++i)
+ for (const OUString& ex : exceptionTypes)
{
- dependencies->insert(*i);
- OString type(codemaker::convertString(*i).replace('.', '/'));
+ dependencies->insert(ex);
+ OString type(codemaker::convertString(ex).replace('.', '/'));
exceptions->push_back(type);
if (tree != nullptr) {
tree->add(type.replace('/', '.'), manager);
@@ -1904,12 +1872,10 @@ void handleInterfaceType(
ClassFile::ACC_PUBLIC | ClassFile::ACC_INTERFACE
| ClassFile::ACC_ABSTRACT),
className, "java/lang/Object", ""));
- for (std::vector< unoidl::AnnotatedReference >::const_iterator i(
- entity->getDirectMandatoryBases().begin());
- i != entity->getDirectMandatoryBases().end(); ++i)
+ for (const unoidl::AnnotatedReference& ar : entity->getDirectMandatoryBases())
{
- dependencies->insert(i->name);
- cf->addInterface(codemaker::convertString(i->name).replace('.', '/'));
+ dependencies->insert(ar.name);
+ cf->addInterface(codemaker::convertString(ar.name).replace('.', '/'));
}
// As a special case, let com.sun.star.lang.XEventListener extend
// java.util.EventListener ("A tagging interface that all event listener
@@ -1920,30 +1886,28 @@ void handleInterfaceType(
std::vector< TypeInfo > typeInfo;
if (className != "com/sun/star/uno/XInterface") {
sal_Int32 index = 0;
- for (std::vector< unoidl::InterfaceTypeEntity::Attribute >::
- const_iterator i(entity->getDirectAttributes().begin());
- i != entity->getDirectAttributes().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity->getDirectAttributes())
{
SpecialType specialType;
PolymorphicUnoType polymorphicUnoType;
MethodDescriptor gdesc(
- manager, dependencies, i->type, &specialType,
+ manager, dependencies, attr.type, &specialType,
&polymorphicUnoType);
std::vector< OString > exc;
createExceptionsAttribute(
- manager, i->getExceptions, dependencies, &exc, nullptr);
- OString attrName(codemaker::convertString(i->name));
+ manager, attr.getExceptions, dependencies, &exc, nullptr);
+ OString attrName(codemaker::convertString(attr.name));
cf->addMethod(
static_cast< ClassFile::AccessFlags >(
ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT),
"get" + attrName, gdesc.getDescriptor(), nullptr, exc,
gdesc.getSignature());
- if (!i->readOnly) {
+ if (!attr.readOnly) {
MethodDescriptor sdesc(manager, dependencies, "void", nullptr, nullptr);
- sdesc.addParameter(i->type, false, true, nullptr);
+ sdesc.addParameter(attr.type, false, true, nullptr);
std::vector< OString > exc2;
createExceptionsAttribute(
- manager, i->setExceptions, dependencies, &exc2, nullptr);
+ manager, attr.setExceptions, dependencies, &exc2, nullptr);
cf->addMethod(
static_cast< ClassFile::AccessFlags >(
ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT),
@@ -1954,20 +1918,18 @@ void handleInterfaceType(
TypeInfo(
TypeInfo::KIND_ATTRIBUTE, attrName, specialType,
static_cast< TypeInfo::Flags >(
- (i->readOnly ? TypeInfo::FLAG_READONLY : 0)
- | (i->bound ? TypeInfo::FLAG_BOUND : 0)),
+ (attr.readOnly ? TypeInfo::FLAG_READONLY : 0)
+ | (attr.bound ? TypeInfo::FLAG_BOUND : 0)),
index, polymorphicUnoType));
- index += (i->readOnly ? 1 : 2);
+ index += (attr.readOnly ? 1 : 2);
}
- for (std::vector< unoidl::InterfaceTypeEntity::Method >::const_iterator
- i(entity->getDirectMethods().begin());
- i != entity->getDirectMethods().end(); ++i)
+ for (const unoidl::InterfaceTypeEntity::Method& method : entity->getDirectMethods())
{
- OString methodName(codemaker::convertString(i->name));
+ OString methodName(codemaker::convertString(method.name));
SpecialType specialReturnType;
PolymorphicUnoType polymorphicUnoReturnType;
MethodDescriptor desc(
- manager, dependencies, i->returnType, &specialReturnType,
+ manager, dependencies, method.returnType, &specialReturnType,
&polymorphicUnoReturnType);
typeInfo.push_back(
TypeInfo(
@@ -1975,32 +1937,30 @@ void handleInterfaceType(
static_cast< TypeInfo::Flags >(0), index++,
polymorphicUnoReturnType));
sal_Int32 paramIndex = 0;
- for (std::vector< unoidl::InterfaceTypeEntity::Method::Parameter >::
- const_iterator j(i->parameters.begin());
- j != i->parameters.end(); ++j)
+ for (const unoidl::InterfaceTypeEntity::Method::Parameter& param : method.parameters)
{
- bool in = j->direction
+ bool in = param.direction
!= (unoidl::InterfaceTypeEntity::Method::Parameter::
DIRECTION_OUT);
- bool out = j->direction
+ bool out = param.direction
!= (unoidl::InterfaceTypeEntity::Method::Parameter::
DIRECTION_IN);
PolymorphicUnoType polymorphicUnoType;
SpecialType specialType = desc.addParameter(
- j->type, out, true, &polymorphicUnoType);
+ param.type, out, true, &polymorphicUnoType);
if (out || isSpecialType(specialType)
|| polymorphicUnoType.kind != PolymorphicUnoType::KIND_NONE)
{
typeInfo.push_back(
TypeInfo(
- codemaker::convertString(j->name), specialType, in,
+ codemaker::convertString(param.name), specialType, in,
out, methodName, paramIndex, polymorphicUnoType));
}
++paramIndex;
}
std::vector< OString > exc2;
createExceptionsAttribute(
- manager, i->exceptions, dependencies, &exc2, nullptr);
+ manager, method.exceptions, dependencies, &exc2, nullptr);
cf->addMethod(
static_cast< ClassFile::AccessFlags >(
ClassFile::ACC_PUBLIC | ClassFile::ACC_ABSTRACT),
@@ -2060,54 +2020,52 @@ void handleConstantGroup(
ClassFile::ACC_PUBLIC | ClassFile::ACC_INTERFACE
| ClassFile::ACC_ABSTRACT),
className, "java/lang/Object", ""));
- for (std::vector< unoidl::ConstantGroupEntity::Member >::const_iterator i(
- entity->getMembers().begin());
- i != entity->getMembers().end(); ++i)
+ for (const unoidl::ConstantGroupEntity::Member& member : entity->getMembers())
{
OUString type;
sal_uInt16 valueIndex = sal_uInt16(); // avoid false warnings
- switch (i->value.type) {
+ switch (member.value.type) {
case unoidl::ConstantValue::TYPE_BOOLEAN:
type = "boolean";
- valueIndex = cf->addIntegerInfo(sal_Int32(i->value.booleanValue));
+ valueIndex = cf->addIntegerInfo(sal_Int32(member.value.booleanValue));
break;
case unoidl::ConstantValue::TYPE_BYTE:
type = "byte";
- valueIndex = cf->addIntegerInfo(i->value.byteValue);
+ valueIndex = cf->addIntegerInfo(member.value.byteValue);
break;
case unoidl::ConstantValue::TYPE_SHORT:
type = "short";
- valueIndex = cf->addIntegerInfo(i->value.shortValue);
+ valueIndex = cf->addIntegerInfo(member.value.shortValue);
break;
case unoidl::ConstantValue::TYPE_UNSIGNED_SHORT:
type = "unsigned short";
- valueIndex = cf->addIntegerInfo(i->value.unsignedShortValue);
+ valueIndex = cf->addIntegerInfo(member.value.unsignedShortValue);
break;
case unoidl::ConstantValue::TYPE_LONG:
type = "long";
- valueIndex = cf->addIntegerInfo(i->value.longValue);
+ valueIndex = cf->addIntegerInfo(member.value.longValue);
break;
case unoidl::ConstantValue::TYPE_UNSIGNED_LONG:
type = "unsigned long";
valueIndex = cf->addIntegerInfo(
- static_cast< sal_Int32 >(i->value.unsignedLongValue));
+ static_cast< sal_Int32 >(member.value.unsignedLongValue));
break;
case unoidl::ConstantValue::TYPE_HYPER:
type = "hyper";
- valueIndex = cf->addLongInfo(i->value.hyperValue);
+ valueIndex = cf->addLongInfo(member.value.hyperValue);
break;
case unoidl::ConstantValue::TYPE_UNSIGNED_HYPER:
type = "unsigned hyper";
valueIndex = cf->addLongInfo(
- static_cast< sal_Int64 >(i->value.unsignedHyperValue));
+ static_cast< sal_Int64 >(member.value.unsignedHyperValue));
break;
case unoidl::ConstantValue::TYPE_FLOAT:
type = "float";
- valueIndex = cf->addFloatInfo(i->value.floatValue);
+ valueIndex = cf->addFloatInfo(member.value.floatValue);
break;
case unoidl::ConstantValue::TYPE_DOUBLE:
type = "double";
- valueIndex = cf->addDoubleInfo(i->value.doubleValue);
+ valueIndex = cf->addDoubleInfo(member.value.doubleValue);
break;
}
OString desc;
@@ -2117,7 +2075,7 @@ void handleConstantGroup(
static_cast< ClassFile::AccessFlags >(
ClassFile::ACC_PUBLIC | ClassFile::ACC_STATIC
| ClassFile::ACC_FINAL),
- codemaker::convertString(i->name), desc, valueIndex, sig);
+ codemaker::convertString(member.name), desc, valueIndex, sig);
}
writeClassFile(options, className, *cf.get());
}
@@ -2132,11 +2090,9 @@ void addExceptionHandlers(
if (node->present) {
code->addException(start, end, handler, node->name.replace('.', '/'));
} else {
- for (codemaker::ExceptionTreeNode::Children::const_iterator i(
- node->children.begin());
- i != node->children.end(); ++i)
+ for (codemaker::ExceptionTreeNode* p : node->children)
{
- addExceptionHandlers(*i, start, end, handler, code);
+ addExceptionHandlers(p, start, end, handler, code);
}
}
}
@@ -2200,13 +2156,10 @@ void addConstructor(
// stack: factory serviceName args
stack = 0;
sal_Int32 n = 0;
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::Constructor::
- Parameter >::const_iterator i(
- constructor.parameters.begin());
- i != constructor.parameters.end(); ++i)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param :
+ constructor.parameters)
{
- desc.addParameter(i->type, false, true, nullptr);
+ desc.addParameter(param.type, false, true, nullptr);
code->instrDup();
// stack: factory serviceName args args
code->loadIntegerConstant(n++);
@@ -2214,7 +2167,7 @@ void addConstructor(
stack = std::max(
stack,
addLoadLocal(
- manager, code.get(), &localIndex, false, i->type, true,
+ manager, code.get(), &localIndex, false, param.type, true,
dependencies));
// stack: factory serviceName args args i any
code->instrAastore();
@@ -2320,13 +2273,11 @@ void handleService(
dependencies->insert("com.sun.star.uno.DeploymentException");
dependencies->insert("com.sun.star.uno.TypeClass");
dependencies->insert("com.sun.star.uno.XComponentContext");
- for (std::vector<
- unoidl::SingleInterfaceBasedServiceEntity::Constructor >::
- const_iterator i(entity->getConstructors().begin());
- i != entity->getConstructors().end(); ++i)
+ for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor& cons :
+ entity->getConstructors())
{
addConstructor(
- manager, realJavaBaseName, unoName, className, *i,
+ manager, realJavaBaseName, unoName, className, cons,
entity->getBase(), dependencies, cf.get());
}
// Synthetic castInstance method:
@@ -2594,8 +2545,8 @@ void produce(
"unexpected entity \"" + name + "\" in call to produce");
}
if (!options.isValid("-nD")) {
- for (Dependencies::iterator i(deps.begin()); i != deps.end(); ++i) {
- produce(*i, manager, generated, options);
+ for (const OUString& d : deps) {
+ produce(d, manager, generated, options);
}
}
}