summaryrefslogtreecommitdiff
path: root/unoidl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-08 10:01:11 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-08 10:02:36 +0100
commit8308f6e5f50bcdd5cd4e5511a8a3bd5c64c93e2b (patch)
treeccb4ae826b86bd91b1370d5953d4cfb844444a8f /unoidl
parentc2850eabb4cf9f6a661ccbc3eb7012999eec0faa (diff)
OK to add optional bases to published old-style services
Change-Id: Ie6f5f2a634171d9618f3229bcc18ad48fff80d35 (cherry picked from commit 54101206ec3a4a5d8e2948d411dc8b51992add0e)
Diffstat (limited to 'unoidl')
-rw-r--r--unoidl/source/unoidl-check.cxx63
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);
}
}