unoidl/source/unoidl-check.cxx | 63 +++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 27 deletions(-)
New commits: commit 8308f6e5f50bcdd5cd4e5511a8a3bd5c64c93e2b Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Jan 8 10:01:11 2014 +0100 OK to add optional bases to published old-style services Change-Id: Ie6f5f2a634171d9618f3229bcc18ad48fff80d35 (cherry picked from commit 54101206ec3a4a5d8e2948d411dc8b51992add0e) diff --git a/unoidl/source/unoidl-check.cxx b/unoidl/source/unoidl-check.cxx index f1264d2..33487f5 100644 --- a/unoidl/source/unoidl-check.cxx +++ b/unoidl/source/unoidl-check.cxx @@ -9,6 +9,7 @@ #include "sal/config.h" +#include <algorithm> #include <cassert> #include <cstdlib> #include <iostream> @@ -137,6 +138,16 @@ OUString showDirection( } } +struct EqualsAnnotation { + EqualsAnnotation(OUString const & name): name_(name) {} + + bool operator ()(unoidl::AnnotatedReference const & ref) + { return ref.name == name_; } + +private: + OUString name_; +}; + void checkMap( rtl::Reference<unoidl::Provider> const & providerB, OUString const & prefix, rtl::Reference<unoidl::MapCursor> const & cursor) @@ -697,12 +708,12 @@ void checkMap( } } if (ent2A->getDirectOptionalBaseServices().size() - != ent2B->getDirectOptionalBaseServices().size()) + > ent2B->getDirectOptionalBaseServices().size()) { std::cerr << "accumulation-based service " << name << (" number of direct optional base services" - " changed from ") + " shrank from ") << ent2A->getDirectOptionalBaseServices().size() << " to " << ent2B->getDirectOptionalBaseServices().size() @@ -710,21 +721,20 @@ void checkMap( std::exit(EXIT_FAILURE); } for (std::vector<unoidl::AnnotatedReference>::const_iterator - i(ent2A->getDirectOptionalBaseServices().begin()), - j(ent2B->getDirectOptionalBaseServices().begin()); + i(ent2A->getDirectOptionalBaseServices().begin()); i != ent2A->getDirectOptionalBaseServices().end(); - ++i, ++j) + ++i) { - if (i->name != j->name) { + if (std::find_if( + ent2B->getDirectOptionalBaseServices().begin(), + ent2B->getDirectOptionalBaseServices().end(), + EqualsAnnotation(i->name)) + == ent2B->getDirectOptionalBaseServices().end()) + { std::cerr << "accumulation-based service " << name - << " direct optional base service #" - << (i - - (ent2A->getDirectOptionalBaseServices() - .begin()) - + 1) - << " changed from " << i->name << " to " - << j->name << std::endl; + << " direct optional base service " << i->name + << " was removed" << std::endl; std::exit(EXIT_FAILURE); } } @@ -763,12 +773,12 @@ void checkMap( } } if (ent2A->getDirectOptionalBaseInterfaces().size() - != ent2B->getDirectOptionalBaseInterfaces().size()) + > ent2B->getDirectOptionalBaseInterfaces().size()) { std::cerr << "accumulation-based service " << name << (" number of direct optional base interfaces" - " changed from ") + " shrank from ") << ent2A->getDirectOptionalBaseInterfaces().size() << " to " << ent2B->getDirectOptionalBaseInterfaces().size() @@ -777,22 +787,21 @@ void checkMap( } for (std::vector<unoidl::AnnotatedReference>::const_iterator i(ent2A->getDirectOptionalBaseInterfaces() - .begin()), - j(ent2B->getDirectOptionalBaseInterfaces() .begin()); i != ent2A->getDirectOptionalBaseInterfaces().end(); - ++i, ++j) - { - if (i->name != j->name) { + ++i) + { + if (std::find_if( + (ent2B->getDirectOptionalBaseInterfaces() + .begin()), + ent2B->getDirectOptionalBaseInterfaces().end(), + EqualsAnnotation(i->name)) + == ent2B->getDirectOptionalBaseInterfaces().end()) + { std::cerr << "accumulation-based service " << name - << " direct optional base interface #" - << (i - - (ent2A->getDirectOptionalBaseInterfaces() - .begin()) - + 1) - << " changed from " << i->name << " to " - << j->name << std::endl; + << " direct optional base interface " << i->name + << " was removed" << std::endl; std::exit(EXIT_FAILURE); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits