diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-01-08 10:01:11 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-01-08 10:01:11 +0100 |
commit | 54101206ec3a4a5d8e2948d411dc8b51992add0e (patch) | |
tree | 15a1d0202d6822c9dca74ea16d0d5333bfe42288 /unoidl | |
parent | 382b013275f0dd81d6bbf299782f59d2735c5beb (diff) |
OK to add optional bases to published old-style services
Change-Id: Ie6f5f2a634171d9618f3229bcc18ad48fff80d35
Diffstat (limited to 'unoidl')
-rw-r--r-- | unoidl/source/unoidl-check.cxx | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/unoidl/source/unoidl-check.cxx b/unoidl/source/unoidl-check.cxx index f1264d23bbb1..33487f5ea14f 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); } } |