Kaydet (Commit) 87bd462e authored tarafından Arkadiy Illarionov's avatar Arkadiy Illarionov Kaydeden (comit) Noel Grandin

Simplify containers iterations in unodevtools, unoidl

Use range-based loop or replace with STL functions.

Change-Id: I3089a4d4a94eea849cad442b04906908908e4c27
Reviewed-on: https://gerrit.libreoffice.org/61854
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ccb2a1f6
...@@ -57,13 +57,11 @@ static void generateIncludes(std::ostream & o, ...@@ -57,13 +57,11 @@ static void generateIncludes(std::ostream & o,
o << "#include \"cppuhelper/propertysetmixin.hxx\"\n"; o << "#include \"cppuhelper/propertysetmixin.hxx\"\n";
} }
std::set< OUString >::const_iterator iter = interfaces.begin(); for (const auto& rIface : interfaces)
while (iter != interfaces.end())
{ {
o << "#include \"" o << "#include \""
<< (*iter).replace('.', '/') << rIface.replace('.', '/')
<< ".hpp\"\n"; << ".hpp\"\n";
++iter;
} }
} }
...@@ -153,13 +151,11 @@ static void generateCompHelperDefinition(std::ostream & o, ...@@ -153,13 +151,11 @@ static void generateCompHelperDefinition(std::ostream & o,
"_getSupportedServiceNames()\n{\n css::uno::Sequence< " "_getSupportedServiceNames()\n{\n css::uno::Sequence< "
"::rtl::OUString > s(" << services.size() << ");\n"; "::rtl::OUString > s(" << services.size() << ");\n";
std::set< OUString >::const_iterator iter = services.begin();
short i=0; short i=0;
while (iter != services.end()) for (const auto& rService : services)
{ {
o << " s[" << i++ << "] = ::rtl::OUString(\"" o << " s[" << i++ << "] = ::rtl::OUString(\""
<< *iter << "\");\n"; << rService << "\");\n";
++iter;
} }
o << " return s;\n}\n\n"; o << " return s;\n}\n\n";
...@@ -424,20 +420,17 @@ void generateXDispatch(std::ostream& o, ...@@ -424,20 +420,17 @@ void generateXDispatch(std::ostream& o,
"css::uno::Sequence< css::beans::PropertyValue >& aArguments ) throw" "css::uno::Sequence< css::beans::PropertyValue >& aArguments ) throw"
"(css::uno::RuntimeException)\n{\n"; "(css::uno::RuntimeException)\n{\n";
ProtocolCmdMap::const_iterator iter = protocolCmdMap.begin(); for (const auto& rEntry : protocolCmdMap) {
while (iter != protocolCmdMap.end()) { o << " if ( aURL.Protocol.equalsAscii(\"" << rEntry.first
o << " if ( aURL.Protocol.equalsAscii(\"" << (*iter).first
<< "\") == 0 )\n {\n"; << "\") == 0 )\n {\n";
for (std::vector< OString >::const_iterator i = (*iter).second.begin(); for (const auto& rCmd : rEntry.second) {
i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.equalsAscii(\"" << rCmd << "\") )\n"
o << " if ( aURL.Path.equalsAscii(\"" << (*i) << "\") )\n"
" {\n // add your own code here\n" " {\n // add your own code here\n"
" return;\n }\n"; " return;\n }\n";
} }
o << " }\n"; o << " }\n";
++iter;
} }
o << "}\n\n"; o << "}\n\n";
...@@ -469,19 +462,16 @@ void generateXDispatchProvider(std::ostream& o, ...@@ -469,19 +462,16 @@ void generateXDispatchProvider(std::ostream& o,
"css::frame::XDispatch > xRet;\n" "css::frame::XDispatch > xRet;\n"
" if ( !m_xFrame.is() )\n return 0;\n\n"; " if ( !m_xFrame.is() )\n return 0;\n\n";
ProtocolCmdMap::const_iterator iter = protocolCmdMap.begin(); for (const auto& rEntry : protocolCmdMap) {
while (iter != protocolCmdMap.end()) { o << " if ( aURL.Protocol.equalsAscii(\"" << rEntry.first
o << " if ( aURL.Protocol.equalsAscii(\"" << (*iter).first
<< "\") == 0 )\n {\n"; << "\") == 0 )\n {\n";
for (std::vector< OString >::const_iterator i = (*iter).second.begin(); for (const auto& rCmd : rEntry.second) {
i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.equalsAscii(\"" << rCmd << "\") == 0 )\n"
o << " if ( aURL.Path.equalsAscii(\"" << (*i) << "\") == 0 )\n"
" xRet = this;\n"; " xRet = this;\n";
} }
o << " }\n"; o << " }\n";
++iter;
} }
o << " return xRet;\n}\n\n"; o << " return xRet;\n}\n\n";
...@@ -580,16 +570,15 @@ static void generateMemberInitialization(std::ostream& o, ...@@ -580,16 +570,15 @@ static void generateMemberInitialization(std::ostream& o,
AttributeInfo const & members) AttributeInfo const & members)
{ {
if (!members.empty()) { if (!members.empty()) {
for (AttributeInfo::const_iterator i(members.begin()); for (const auto& rMember : members)
i != members.end(); ++i)
{ {
sal_Int32 rank; sal_Int32 rank;
if ((manager->decompose(i->type, true, nullptr, &rank, nullptr, nullptr) if ((manager->decompose(rMember.type, true, nullptr, &rank, nullptr, nullptr)
<= codemaker::UnoType::Sort::Char) <= codemaker::UnoType::Sort::Char)
&& rank == 0) && rank == 0)
{ {
o << ",\n m_" << i->name << "("; o << ",\n m_" << rMember.name << "(";
printType(o, options, manager, i->type, 16, true); printType(o, options, manager, rMember.type, 16, true);
o << ")"; o << ")";
} }
} }
...@@ -601,12 +590,11 @@ static void generateMemberDeclaration(std::ostream& o, ...@@ -601,12 +590,11 @@ static void generateMemberDeclaration(std::ostream& o,
rtl::Reference< TypeManager > const & manager, rtl::Reference< TypeManager > const & manager,
AttributeInfo const & members) AttributeInfo const & members)
{ {
for (AttributeInfo::const_iterator i(members.begin()); for (const auto& rMember : members)
i != members.end(); ++i)
{ {
o << " "; o << " ";
printType(o, options, manager, i->type, 1); printType(o, options, manager, rMember.type, 1);
o << " m_" << i->name << ";\n"; o << " m_" << rMember.name << ";\n";
} }
} }
...@@ -693,13 +681,11 @@ static OString generateClassDefinition(std::ostream& o, ...@@ -693,13 +681,11 @@ static OString generateClassDefinition(std::ostream& o,
<< parent << "::release(); }\n\n"; << parent << "::release(); }\n\n";
} }
std::set< OUString >::const_iterator it = interfaces.begin();
codemaker::GeneratedTypeSet generated; codemaker::GeneratedTypeSet generated;
while (it != interfaces.end()) for (const auto& rIface : interfaces)
{ {
printMethods(o, options, manager, *it, generated, "", "", " ", printMethods(o, options, manager, rIface, generated, "", "", " ",
true, propertyhelper); true, propertyhelper);
++it;
} }
o << "private:\n " << classname << "(const " << classname << " &); // not defined\n" o << "private:\n " << classname << "(const " << classname << " &); // not defined\n"
...@@ -877,17 +863,15 @@ static void generateMethodBodies(std::ostream& o, ...@@ -877,17 +863,15 @@ static void generateMethodBodies(std::ostream& o,
OUString const & propertyhelper) OUString const & propertyhelper)
{ {
OString name(classname.concat("::")); OString name(classname.concat("::"));
std::set< OUString >::const_iterator iter = interfaces.begin();
codemaker::GeneratedTypeSet generated; codemaker::GeneratedTypeSet generated;
while (iter != interfaces.end()) { for (const auto& rIface : interfaces) {
if ( *iter == "com.sun.star.lang.XServiceInfo" ) { if ( rIface == "com.sun.star.lang.XServiceInfo" ) {
generateXServiceInfoBodies(o, name, comphelpernamespace); generateXServiceInfoBodies(o, name, comphelpernamespace);
generated.add(u2b(*iter)); generated.add(u2b(rIface));
} else { } else {
printMethods(o, options, manager, *iter, generated, "_", printMethods(o, options, manager, rIface, generated, "_",
name, "", true, propertyhelper); name, "", true, propertyhelper);
} }
++iter;
} }
} }
...@@ -957,10 +941,8 @@ void generateSkeleton(ProgramOptions const & options, ...@@ -957,10 +941,8 @@ void generateSkeleton(ProgramOptions const & options,
bool serviceobject = false; bool serviceobject = false;
bool supportxcomponent = false; bool supportxcomponent = false;
std::vector< OString >::const_iterator iter = types.begin(); for (const auto& rType : types) {
while (iter != types.end()) { checkType(manager, b2u(rType), interfaces, services, properties);
checkType(manager, b2u(*iter), interfaces, services, properties);
++iter;
} }
if (options.componenttype == 3) { if (options.componenttype == 3) {
...@@ -1090,10 +1072,8 @@ void generateCalcAddin(ProgramOptions const & options, ...@@ -1090,10 +1072,8 @@ void generateCalcAddin(ProgramOptions const & options,
bool supportxcomponent = false; bool supportxcomponent = false;
std::vector< OString >::const_iterator iter = types.begin(); for (const auto& rType : types) {
while (iter != types.end()) { checkType(manager, b2u(rType), interfaces, services, properties);
checkType(manager, b2u(*iter), interfaces, services, properties);
++iter;
} }
OUString sAddinService; OUString sAddinService;
......
...@@ -256,18 +256,17 @@ static void registerProperties(std::ostream& o, ...@@ -256,18 +256,17 @@ static void registerProperties(std::ostream& o,
if (!properties.empty()) { if (!properties.empty()) {
bool cast = false; bool cast = false;
OStringBuffer attributeValue; OStringBuffer attributeValue;
for (AttributeInfo::const_iterator i(properties.begin()); for (const auto& rProp : properties)
i != properties.end(); ++i)
{ {
if (i->attributes != 0) { if (rProp.attributes != 0) {
cast = checkAttribute(attributeValue, i->attributes); cast = checkAttribute(attributeValue, rProp.attributes);
} else { } else {
cast = true; cast = true;
attributeValue.append('0'); attributeValue.append('0');
} }
o << indentation << "registerProperty(\"" << i->name o << indentation << "registerProperty(\"" << rProp.name
<< "\", \"m_" << i->name << "\",\n" << "\", \"m_" << rProp.name << "\",\n"
<< indentation << " "; << indentation << " ";
if (cast) if (cast)
o << "(short)"; o << "(short)";
...@@ -425,20 +424,17 @@ static void generateXDispatchBodies(std::ostream& o, ProgramOptions const & opti ...@@ -425,20 +424,17 @@ static void generateXDispatchBodies(std::ostream& o, ProgramOptions const & opti
" public void dispatch( com.sun.star.util.URL aURL,\n" " public void dispatch( com.sun.star.util.URL aURL,\n"
" com.sun.star.beans.PropertyValue[] aArguments )\n {\n"; " com.sun.star.beans.PropertyValue[] aArguments )\n {\n";
ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin(); for (const auto& rEntry : options.protocolCmdMap) {
while (iter != options.protocolCmdMap.end()) { o << " if ( aURL.Protocol.equals(\"" << rEntry.first
o << " if ( aURL.Protocol.equals(\"" << (*iter).first
<< "\") )\n {\n"; << "\") )\n {\n";
for (std::vector< OString >::const_iterator i = (*iter).second.begin(); for (const auto& rCmd : rEntry.second) {
i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.equals(\"" << rCmd << "\") )\n"
o << " if ( aURL.Path.equals(\"" << (*i) << "\") )\n"
" {\n // add your own code here\n" " {\n // add your own code here\n"
" return;\n }\n"; " return;\n }\n";
} }
o << " }\n"; o << " }\n";
++iter;
} }
o << " }\n\n"; o << " }\n\n";
...@@ -462,19 +458,16 @@ static void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions cons ...@@ -462,19 +458,16 @@ static void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions cons
" String sTargetFrameName,\n" " String sTargetFrameName,\n"
" int iSearchFlags )\n {\n"; " int iSearchFlags )\n {\n";
ProtocolCmdMap::const_iterator iter = options.protocolCmdMap.begin(); for (const auto& rEntry : options.protocolCmdMap) {
while (iter != options.protocolCmdMap.end()) { o << " if ( aURL.Protocol.equals(\"" << rEntry.first
o << " if ( aURL.Protocol.equals(\"" << (*iter).first
<< "\") )\n {\n"; << "\") )\n {\n";
for (std::vector< OString >::const_iterator i = (*iter).second.begin(); for (const auto& rCmd : rEntry.second) {
i != (*iter).second.end(); ++i) { o << " if ( aURL.Path.equals(\"" << rCmd << "\") )\n"
o << " if ( aURL.Path.equals(\"" << (*i) << "\") )\n"
" return this;\n"; " return this;\n";
} }
o << " }\n"; o << " }\n";
++iter;
} }
o << " return null;\n }\n\n"; o << " return null;\n }\n\n";
...@@ -498,11 +491,9 @@ static void generateMethodBodies(std::ostream& o, ...@@ -498,11 +491,9 @@ static void generateMethodBodies(std::ostream& o,
const std::set< OUString >& interfaces, const std::set< OUString >& interfaces,
const OString& indentation, bool usepropertymixin) const OString& indentation, bool usepropertymixin)
{ {
std::set< OUString >::const_iterator iter = interfaces.begin();
codemaker::GeneratedTypeSet generated; codemaker::GeneratedTypeSet generated;
while (iter != interfaces.end()) { for (const auto& rIface : interfaces) {
OUString type(*iter); OUString type(rIface);
++iter;
if (type == "com.sun.star.lang.XServiceInfo") { if (type == "com.sun.star.lang.XServiceInfo") {
generateXServiceInfoBodies(o); generateXServiceInfoBodies(o);
generated.add(u2b(type)); generated.add(u2b(type));
...@@ -760,26 +751,20 @@ static void generateClassDefinition(std::ostream& o, ...@@ -760,26 +751,20 @@ static void generateClassDefinition(std::ostream& o,
// attribute/property members // attribute/property members
if (!properties.empty()) { if (!properties.empty()) {
AttributeInfo::const_iterator iter =
properties.begin();
o << " // properties\n"; o << " // properties\n";
while (iter != properties.end()) { for (const auto& rProp : properties) {
o << " protected "; o << " protected ";
printType(o, options, manager, iter->type, false); printType(o, options, manager, rProp.type, false);
o << " m_" << iter->name << ";\n"; o << " m_" << rProp.name << ";\n";
++iter;
} }
} else if (!attributes.empty()) { } else if (!attributes.empty()) {
AttributeInfo::const_iterator iter =
attributes.begin();
o << " // attributes\n"; o << " // attributes\n";
while (iter != attributes.end()) { for (const auto& rAttr : attributes) {
o << " private "; o << " private ";
printType(o, options, manager, iter->type, false); printType(o, options, manager, rAttr.type, false);
o << " m_" << iter->name << " = "; o << " m_" << rAttr.name << " = ";
printType(o, options, manager, iter->type, false, true); printType(o, options, manager, rAttr.type, false, true);
o <<";\n"; o <<";\n";
++iter;
} }
} }
...@@ -827,10 +812,8 @@ void generateSkeleton(ProgramOptions const & options, ...@@ -827,10 +812,8 @@ void generateSkeleton(ProgramOptions const & options,
bool serviceobject = false; bool serviceobject = false;
bool supportxcomponent = false; bool supportxcomponent = false;
std::vector< OString >::const_iterator iter = types.begin(); for (const auto& rType : types) {
while (iter != types.end()) { checkType(manager, b2u(rType), interfaces, services, properties);
checkType(manager, b2u(*iter), interfaces, services, properties);
++iter;
} }
if (options.componenttype == 3) { if (options.componenttype == 3) {
......
...@@ -260,32 +260,29 @@ SAL_IMPLEMENT_MAIN() ...@@ -260,32 +260,29 @@ SAL_IMPLEMENT_MAIN()
} }
rtl::Reference< TypeManager > manager(new TypeManager); rtl::Reference< TypeManager > manager(new TypeManager);
for (std::vector< OString >::const_iterator i(registries.begin()); for (const auto& rRegistry : registries)
i != registries.end(); ++i)
{ {
manager->loadProvider(convertToFileUrl(*i), true); manager->loadProvider(convertToFileUrl(rRegistry), true);
} }
if ( options.dump ) { if ( options.dump ) {
std::vector< OString >::const_iterator iter = types.begin(); for (const auto& rType : types) {
while (iter != types.end()) {
std::cout << "\n/***************************************************" std::cout << "\n/***************************************************"
"*****************************/\n"; "*****************************/\n";
switch (options.language ) switch (options.language )
{ {
case 1: //Java case 1: //Java
java::generateDocumentation(std::cout, options, manager, java::generateDocumentation(std::cout, options, manager,
*iter, delegate); rType, delegate);
break; break;
case 2: //C++ case 2: //C++
cpp::generateDocumentation(std::cout, options, manager, cpp::generateDocumentation(std::cout, options, manager,
*iter, delegate); rType, delegate);
break; break;
default: default:
OSL_ASSERT(false); OSL_ASSERT(false);
break; break;
} }
++iter;
} }
} else { } else {
switch ( options.language ) switch ( options.language )
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <sal/config.h> #include <sal/config.h>
#include <algorithm>
#include <cassert> #include <cassert>
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
...@@ -445,6 +446,12 @@ void mapCursor( ...@@ -445,6 +446,12 @@ void mapCursor(
} }
} }
template<typename T>
bool hasNotEmptyAnnotations(const std::vector<T>& v)
{
return std::any_of(v.begin(), v.end(), [](const T& rItem) { return !rItem.annotations.empty(); });
}
sal_uInt64 writeMap( sal_uInt64 writeMap(
osl::File & file, std::map< OUString, Item > & map, std::size_t * rootSize) osl::File & file, std::map< OUString, Item > & map, std::size_t * rootSize)
{ {
...@@ -458,12 +465,8 @@ sal_uInt64 writeMap( ...@@ -458,12 +465,8 @@ sal_uInt64 writeMap(
rtl::Reference< unoidl::EnumTypeEntity > ent2( rtl::Reference< unoidl::EnumTypeEntity > ent2(
static_cast< unoidl::EnumTypeEntity * >( static_cast< unoidl::EnumTypeEntity * >(
i.second.entity.get())); i.second.entity.get()));
bool ann = !ent2->getAnnotations().empty(); bool ann = !ent2->getAnnotations().empty() ||
for (auto j(ent2->getMembers().begin()); hasNotEmptyAnnotations(ent2->getMembers());
!ann && j != ent2->getMembers().end(); ++j)
{
ann = !j->annotations.empty();
}
i.second.dataOffset = getOffset(file); i.second.dataOffset = getOffset(file);
writeKind(file, ent2.get(), ann); writeKind(file, ent2.get(), ann);
write32(file, ent2->getMembers().size()); write32(file, ent2->getMembers().size());
...@@ -480,12 +483,8 @@ sal_uInt64 writeMap( ...@@ -480,12 +483,8 @@ sal_uInt64 writeMap(
rtl::Reference< unoidl::PlainStructTypeEntity > ent2( rtl::Reference< unoidl::PlainStructTypeEntity > ent2(
static_cast< unoidl::PlainStructTypeEntity * >( static_cast< unoidl::PlainStructTypeEntity * >(
i.second.entity.get())); i.second.entity.get()));
bool ann = !ent2->getAnnotations().empty(); bool ann = !ent2->getAnnotations().empty() ||
for (auto j(ent2->getDirectMembers().begin()); hasNotEmptyAnnotations(ent2->getDirectMembers());
!ann && j != ent2->getDirectMembers().end(); ++j)
{
ann = !j->annotations.empty();
}
i.second.dataOffset = getOffset(file); i.second.dataOffset = getOffset(file);
writeKind( writeKind(
file, ent2.get(), ann, !ent2->getDirectBase().isEmpty()); file, ent2.get(), ann, !ent2->getDirectBase().isEmpty());
...@@ -508,12 +507,8 @@ sal_uInt64 writeMap( ...@@ -508,12 +507,8 @@ sal_uInt64 writeMap(
static_cast< static_cast<
unoidl::PolymorphicStructTypeTemplateEntity * >( unoidl::PolymorphicStructTypeTemplateEntity * >(
i.second.entity.get())); i.second.entity.get()));
bool ann = !ent2->getAnnotations().empty(); bool ann = !ent2->getAnnotations().empty() ||
for (auto j(ent2->getMembers().begin()); hasNotEmptyAnnotations(ent2->getMembers());
!ann && j != ent2->getMembers().end(); ++j)
{
ann = !j->annotations.empty();
}
i.second.dataOffset = getOffset(file); i.second.dataOffset = getOffset(file);
writeKind(file, ent2.get(), ann); writeKind(file, ent2.get(), ann);
write32(file, ent2->getTypeParameters().size()); write32(file, ent2->getTypeParameters().size());
...@@ -539,12 +534,8 @@ sal_uInt64 writeMap( ...@@ -539,12 +534,8 @@ sal_uInt64 writeMap(
rtl::Reference< unoidl::ExceptionTypeEntity > ent2( rtl::Reference< unoidl::ExceptionTypeEntity > ent2(
static_cast< unoidl::ExceptionTypeEntity * >( static_cast< unoidl::ExceptionTypeEntity * >(
i.second.entity.get())); i.second.entity.get()));
bool ann = !ent2->getAnnotations().empty(); bool ann = !ent2->getAnnotations().empty() ||
for (auto j(ent2->getDirectMembers().begin()); hasNotEmptyAnnotations(ent2->getDirectMembers());
!ann && j != ent2->getDirectMembers().end(); ++j)
{
ann = !j->annotations.empty();
}
i.second.dataOffset = getOffset(file); i.second.dataOffset = getOffset(file);
writeKind( writeKind(
file, ent2.get(), ann, !ent2->getDirectBase().isEmpty()); file, ent2.get(), ann, !ent2->getDirectBase().isEmpty());
...@@ -565,27 +556,11 @@ sal_uInt64 writeMap( ...@@ -565,27 +556,11 @@ sal_uInt64 writeMap(
rtl::Reference< unoidl::InterfaceTypeEntity > ent2( rtl::Reference< unoidl::InterfaceTypeEntity > ent2(
static_cast< unoidl::InterfaceTypeEntity * >( static_cast< unoidl::InterfaceTypeEntity * >(
i.second.entity.get())); i.second.entity.get()));
bool ann = !ent2->getAnnotations().empty(); bool ann = !ent2->getAnnotations().empty() ||
for (auto j(ent2->getDirectMandatoryBases().begin()); hasNotEmptyAnnotations(ent2->getDirectMandatoryBases()) ||
!ann && j != ent2->getDirectMandatoryBases().end(); ++j) hasNotEmptyAnnotations(ent2->getDirectOptionalBases()) ||
{ hasNotEmptyAnnotations(ent2->getDirectAttributes()) ||
ann = !j->annotations.empty(); hasNotEmptyAnnotations(ent2->getDirectMethods());
}
for (auto j(ent2->getDirectOptionalBases().begin());
!ann && j != ent2->getDirectOptionalBases().end(); ++j)
{
ann = !j->annotations.empty();
}
for (auto j(ent2->getDirectAttributes().begin());
!ann && j != ent2->getDirectAttributes().end(); ++j)
{
ann = !j->annotations.empty();
}
for (auto j(ent2->getDirectMethods().begin());
!ann && j != ent2->getDirectMethods().end(); ++j)
{
ann = !j->annotations.empty();
}
i.second.dataOffset = getOffset(file); i.second.dataOffset = getOffset(file);
writeKind(file, ent2.get(), ann); writeKind(file, ent2.get(), ann);
write32(file, ent2->getDirectMandatoryBases().size()); write32(file, ent2->getDirectMandatoryBases().size());
...@@ -757,11 +732,8 @@ sal_uInt64 writeMap( ...@@ -757,11 +732,8 @@ sal_uInt64 writeMap(
&& ent2->getConstructors()[0].defaultConstructor; && ent2->getConstructors()[0].defaultConstructor;
bool ann = !ent2->getAnnotations().empty(); bool ann = !ent2->getAnnotations().empty();
if (!dfltCtor) { if (!dfltCtor) {
for (auto j(ent2->getConstructors().begin()); if (!ann)
!ann && j != ent2->getConstructors().end(); ++j) ann = hasNotEmptyAnnotations(ent2->getConstructors());
{
ann = !j->annotations.empty();
}
} }
i.second.dataOffset = getOffset(file); i.second.dataOffset = getOffset(file);
writeKind(file, ent2.get(), ann, dfltCtor); writeKind(file, ent2.get(), ann, dfltCtor);
...@@ -801,37 +773,12 @@ sal_uInt64 writeMap( ...@@ -801,37 +773,12 @@ sal_uInt64 writeMap(
rtl::Reference< unoidl::AccumulationBasedServiceEntity > ent2( rtl::Reference< unoidl::AccumulationBasedServiceEntity > ent2(
static_cast< unoidl::AccumulationBasedServiceEntity * >( static_cast< unoidl::AccumulationBasedServiceEntity * >(
i.second.entity.get())); i.second.entity.get()));
bool ann = !ent2->getAnnotations().empty(); bool ann = !ent2->getAnnotations().empty() ||
for (auto j(ent2->getDirectMandatoryBaseServices().begin()); hasNotEmptyAnnotations(ent2->getDirectMandatoryBaseServices()) ||
!ann && j != ent2->getDirectMandatoryBaseServices().end(); hasNotEmptyAnnotations(ent2->getDirectOptionalBaseServices()) ||
++j) hasNotEmptyAnnotations(ent2->getDirectMandatoryBaseInterfaces()) ||
{ hasNotEmptyAnnotations(ent2->getDirectOptionalBaseInterfaces()) ||
ann = !j->annotations.empty(); hasNotEmptyAnnotations(ent2->getDirectProperties());
}
for (auto j(ent2->getDirectOptionalBaseServices().begin());
!ann && j != ent2->getDirectOptionalBaseServices().end();
++j)
{
ann = !j->annotations.empty();
}
for (auto j(ent2->getDirectMandatoryBaseInterfaces().begin());
(!ann
&& j != ent2->getDirectMandatoryBaseInterfaces().end());
++j)
{
ann = !j->annotations.empty();
}
for (auto j(ent2->getDirectOptionalBaseInterfaces().begin());
!ann && j != ent2->getDirectOptionalBaseInterfaces().end();
++j)
{
ann = !j->annotations.empty();
}
for (auto j(ent2->getDirectProperties().begin());
!ann && j != ent2->getDirectProperties().end(); ++j)
{
ann = !j->annotations.empty();
}
i.second.dataOffset = getOffset(file); i.second.dataOffset = getOffset(file);
writeKind(file, ent2.get(), ann); writeKind(file, ent2.get(), ann);
write32(file, ent2->getDirectMandatoryBaseServices().size()); write32(file, ent2->getDirectMandatoryBaseServices().size());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment