diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-09 15:22:04 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-09 16:14:30 +0200 |
commit | 555ee51b77a789253bffdd9ffb16bdc5e51b980a (patch) | |
tree | 501abf83f3825ed790bd66f92c15026dd27c2221 /codemaker/source/javamaker | |
parent | a6f16879922ee237db268ad19328009242b3ca6d (diff) |
convert to range-based for loops in codemaker/
Change-Id: Ifa521f34a8d9565bb61743c4a996bcba37e95ec2
Diffstat (limited to 'codemaker/source/javamaker')
-rw-r--r-- | codemaker/source/javamaker/classfile.cxx | 33 | ||||
-rw-r--r-- | codemaker/source/javamaker/javamaker.cxx | 12 | ||||
-rw-r--r-- | codemaker/source/javamaker/javatype.cxx | 235 |
3 files changed, 110 insertions, 170 deletions
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); } } } |