LCOV - code coverage report
Current view: top level - unoidl/source - unoidl-check.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 337 743 45.4 %
Date: 2014-11-03 Functions: 15 17 88.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include "sal/config.h"
      11             : 
      12             : #include <algorithm>
      13             : #include <cassert>
      14             : #include <cstdlib>
      15             : #include <iostream>
      16             : #include <vector>
      17             : 
      18             : #include "osl/file.hxx"
      19             : #include "osl/process.h"
      20             : #include "rtl/character.hxx"
      21             : #include "rtl/process.h"
      22             : #include "rtl/ref.hxx"
      23             : #include "rtl/ustring.hxx"
      24             : #include "sal/main.h"
      25             : #include "sal/types.h"
      26             : #include "unoidl/unoidl.hxx"
      27             : 
      28             : namespace unoidl {
      29             : 
      30        1882 : bool operator ==(ConstantValue const & lhs, ConstantValue const & rhs)
      31             : {
      32        1882 :     if (lhs.type == rhs.type)
      33             :     {
      34        1882 :         switch (lhs.type)
      35             :         {
      36             :         case ConstantValue::TYPE_BOOLEAN:
      37           0 :             return lhs.booleanValue == rhs.booleanValue;
      38             :         case ConstantValue::TYPE_BYTE:
      39          12 :             return lhs.byteValue == rhs.byteValue;
      40             :         case ConstantValue::TYPE_SHORT:
      41        1168 :             return lhs.shortValue == rhs.shortValue;
      42             :         case ConstantValue::TYPE_UNSIGNED_SHORT:
      43           0 :             return lhs.unsignedShortValue == rhs.unsignedShortValue;
      44             :         case ConstantValue::TYPE_LONG:
      45         653 :             return lhs.longValue == rhs.longValue;
      46             :         case ConstantValue::TYPE_UNSIGNED_LONG:
      47           0 :             return lhs.unsignedLongValue == rhs.unsignedLongValue;
      48             :         case ConstantValue::TYPE_HYPER:
      49          29 :             return lhs.hyperValue == rhs.hyperValue;
      50             :         case ConstantValue::TYPE_UNSIGNED_HYPER:
      51           0 :             return lhs.unsignedHyperValue == rhs.unsignedHyperValue;
      52             :         case ConstantValue::TYPE_FLOAT:
      53          20 :             return lhs.floatValue == rhs.floatValue;
      54             :         case ConstantValue::TYPE_DOUBLE:
      55           0 :             return lhs.doubleValue == rhs.doubleValue;
      56             :         }
      57             :     }
      58           0 :     return false;
      59             : }
      60             : 
      61        1882 : bool operator !=(ConstantValue const & lhs, ConstantValue const & rhs)
      62             : {
      63        1882 :     return !(lhs == rhs);
      64             : }
      65             : 
      66          31 : bool operator ==( SingleInterfaceBasedServiceEntity::Constructor::Parameter const & lhs,
      67             :                   SingleInterfaceBasedServiceEntity::Constructor::Parameter const & rhs)
      68             : {
      69          31 :     return lhs.name == rhs.name && lhs.type == rhs.type && lhs.rest == rhs.rest;
      70             : }
      71             : 
      72             : }
      73             : 
      74             : namespace {
      75             : 
      76           0 : void badUsage()
      77             : {
      78             :     std::cerr
      79           0 :         << "Usage:"
      80           0 :         << std::endl
      81           0 :         << std::endl
      82             :         << ("  unoidl-check [<extra registries A>] <registry A> -- [<extra"
      83           0 :             " registries B>]")
      84           0 :         << std::endl
      85           0 :         << "    <registry B>"
      86           0 :         << std::endl
      87           0 :         << std::endl
      88             :         << ("where each <registry> is either a new- or legacy-format .rdb file,"
      89           0 :             " a single .idl")
      90           0 :         << std::endl
      91             :         << ("file, or a root directory of an .idl file tree.  Check that each"
      92           0 :             " entity from")
      93           0 :         << std::endl
      94           0 :         << "<registry A> is also present in <registry B> in a compatible form."
      95           0 :         << std::endl;
      96           0 :     std::exit(EXIT_FAILURE);
      97             : }
      98             : 
      99           8 : OUString getArgumentUri(sal_uInt32 argument, bool * delimiter)
     100             : {
     101           8 :     OUString arg;
     102           8 :     rtl_getAppCommandArg(argument, &arg.pData);
     103           8 :     if (arg == "--")
     104             :     {
     105           2 :         if (delimiter == 0)
     106             :         {
     107           0 :             badUsage();
     108             :         }
     109           2 :         *delimiter = true;
     110           2 :         return OUString();
     111             :     }
     112          12 :     OUString url;
     113           6 :     osl::FileBase::RC e1 = osl::FileBase::getFileURLFromSystemPath(arg, url);
     114           6 :     if (e1 != osl::FileBase::E_None)
     115             :     {
     116             :         std::cerr
     117           0 :             << "Cannot convert \"" << arg << "\" to file URL, error code "
     118           0 :             << +e1
     119           0 :             << std::endl;
     120           0 :         std::exit(EXIT_FAILURE);
     121             :     }
     122          12 :     OUString cwd;
     123           6 :     oslProcessError e2 = osl_getProcessWorkingDir(&cwd.pData);
     124           6 :     if (e2 != osl_Process_E_None)
     125             :     {
     126             :         std::cerr
     127           0 :             << "Cannot obtain working directory, error code " << +e2
     128           0 :             << std::endl;
     129           0 :         std::exit(EXIT_FAILURE);
     130             :     }
     131          12 :     OUString abs;
     132           6 :     e1 = osl::FileBase::getAbsoluteFileURL(cwd, url, abs);
     133           6 :     if (e1 != osl::FileBase::E_None)
     134             :     {
     135             :         std::cerr
     136           0 :             << "Cannot make \"" << url
     137           0 :             << "\" into an absolute file URL, error code " << +e1
     138           0 :             << std::endl;
     139           0 :         std::exit(EXIT_FAILURE);
     140             :     }
     141          14 :     return abs;
     142             : }
     143             : 
     144           0 : OUString showDirection( unoidl::InterfaceTypeEntity::Method::Parameter::Direction direction)
     145             : {
     146           0 :     switch (direction)
     147             :     {
     148             :     case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN:
     149           0 :         return OUString("[in]");
     150             :     case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_OUT:
     151           0 :         return OUString("[out]");
     152             :     case unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN_OUT:
     153           0 :         return OUString("[inout]");
     154             :     default:
     155           0 :         assert(false && "this cannot happen"); for (;;) { std::abort(); }
     156             :     }
     157             : }
     158             : 
     159        2736 : struct EqualsAnnotation
     160             : {
     161         304 :     EqualsAnnotation(OUString const & name): name_(name) {}
     162             : 
     163         674 :     bool operator ()(unoidl::AnnotatedReference const & ref)
     164         674 :         { return ref.name == name_; }
     165             : 
     166             : private:
     167             :     OUString name_;
     168             : };
     169             : 
     170        2856 : void checkMap( rtl::Reference<unoidl::Provider> const & providerB, OUString const & prefix,
     171             :                rtl::Reference<unoidl::MapCursor> const & cursor)
     172             : {
     173             :     assert(providerB.is());
     174             :     assert(cursor.is());
     175             :     for (;;)
     176             :     {
     177        2856 :         OUString id;
     178        5633 :         rtl::Reference<unoidl::Entity> entA(cursor->getNext(&id));
     179        2856 :         if (!entA.is())
     180             :         {
     181          79 :             break;
     182             :         }
     183        5554 :         OUString name(prefix + id);
     184        2777 :         if (entA->getSort() == unoidl::Entity::SORT_MODULE)
     185             :         {
     186         154 :             checkMap( providerB, name + ".",
     187         231 :                       (static_cast<unoidl::ModuleEntity *>(entA.get())->createCursor()));
     188             :         }
     189             :         else
     190             :         {
     191        2700 :             rtl::Reference<unoidl::Entity> entB(providerB->findEntity(name));
     192        2700 :             if (!entB.is())
     193             :             {
     194             :                 std::cerr
     195           0 :                     << "A entity " << name << " is not present in B"
     196           0 :                     << std::endl;
     197           0 :                 std::exit(EXIT_FAILURE);
     198             :             }
     199        2700 :             if (entA->getSort() != entB->getSort())
     200             :             {
     201             :                 std::cerr
     202           0 :                     << "A entity " << name << " is of different sort in B"
     203           0 :                     << std::endl;
     204           0 :                 std::exit(EXIT_FAILURE);
     205             :             }
     206        5387 :             if ((dynamic_cast<unoidl::PublishableEntity *>(entA.get())->isPublished()) &&
     207        2687 :                 (!dynamic_cast<unoidl::PublishableEntity *>(entB.get())->isPublished()))
     208             :             {
     209             :                 std::cerr
     210           0 :                     << "A published entity " << name << " is not published in B"
     211           0 :                     << std::endl;
     212           0 :                 std::exit(EXIT_FAILURE);
     213             :             }
     214        2700 :             switch (entA->getSort())
     215             :             {
     216             :             case unoidl::Entity::SORT_MODULE:
     217             :                 assert(false && "this cannot happen");
     218             :                 //deliberate fall-through anyway
     219             :             case unoidl::Entity::SORT_ENUM_TYPE:
     220             :             {
     221             :                 rtl::Reference<unoidl::EnumTypeEntity> ent2A(
     222         157 :                         static_cast<unoidl::EnumTypeEntity *>(entA.get()));
     223             :                 rtl::Reference<unoidl::EnumTypeEntity> ent2B(
     224         314 :                         static_cast<unoidl::EnumTypeEntity *>(entB.get()));
     225             : 
     226         157 :                 if (ent2A->getMembers().size() != ent2B->getMembers().size())
     227             :                 {
     228             :                     std::cerr
     229           0 :                         << "enum type " << name
     230           0 :                         << " number of members changed from "
     231           0 :                         << ent2A->getMembers().size() << " to "
     232           0 :                         << ent2B->getMembers().size()
     233           0 :                         << std::endl;
     234           0 :                     std::exit(EXIT_FAILURE);
     235             :                 }
     236        3747 :                 for (std::vector<unoidl::EnumTypeEntity::Member>::const_iterator
     237         157 :                          i(ent2A->getMembers().begin()),
     238         157 :                          j(ent2B->getMembers().begin());
     239        2498 :                      i != ent2A->getMembers().end(); ++i, ++j)
     240             :                 {
     241        2184 :                     if (i->name != j->name ||
     242        1092 :                         i->value != j->value)
     243             :                     {
     244             :                         std::cerr
     245           0 :                             << "enum type " << name << " member #"
     246           0 :                             << i - ent2A->getMembers().begin() + 1
     247           0 :                             << " changed from " << i->name << " = "
     248           0 :                             << i->value << " to " << j->name << " = "
     249           0 :                             << j->value
     250           0 :                             << std::endl;
     251           0 :                         std::exit(EXIT_FAILURE);
     252             :                     }
     253             :                 }
     254         314 :                 break;
     255             :             }
     256             :             case unoidl::Entity::SORT_PLAIN_STRUCT_TYPE:
     257             :             {
     258             :                 rtl::Reference<unoidl::PlainStructTypeEntity> ent2A(
     259         236 :                         static_cast<unoidl::PlainStructTypeEntity *>(entA.get()));
     260             :                 rtl::Reference<unoidl::PlainStructTypeEntity> ent2B(
     261         472 :                         static_cast<unoidl::PlainStructTypeEntity *>(entB.get()));
     262             : 
     263         236 :                 if (ent2A->getDirectBase() != ent2B->getDirectBase())
     264             :                 {
     265             :                     std::cerr
     266           0 :                         << "plain struct type " << name
     267           0 :                         << " direct base changed from "
     268           0 :                         << (ent2A->getDirectBase().isEmpty() ? OUString("none") : ent2A->getDirectBase())
     269           0 :                         << " to "
     270           0 :                         << (ent2B->getDirectBase().isEmpty() ? OUString("none") : ent2B->getDirectBase())
     271           0 :                         << std::endl;
     272           0 :                     std::exit(EXIT_FAILURE);
     273             :                 }
     274         472 :                 if (ent2A->getDirectMembers().size()
     275         236 :                     != ent2B->getDirectMembers().size())
     276             :                 {
     277             :                     std::cerr
     278           0 :                         << "plain struct type " << name
     279           0 :                         << " number of direct members changed from "
     280           0 :                         << ent2A->getDirectMembers().size() << " to "
     281           0 :                         << ent2B->getDirectMembers().size() << std::endl;
     282           0 :                     std::exit(EXIT_FAILURE);
     283             :                 }
     284        3216 :                 for (std::vector<unoidl::PlainStructTypeEntity::Member>::const_iterator
     285         236 :                          i(ent2A->getDirectMembers().begin()),
     286         236 :                          j(ent2B->getDirectMembers().begin());
     287        2144 :                      i != ent2A->getDirectMembers().end(); ++i, ++j)
     288             :                 {
     289        1672 :                     if (i->name != j->name ||
     290         836 :                         i->type != j->type)
     291             :                     {
     292             :                         std::cerr
     293           0 :                             << "plain struct type " << name
     294           0 :                             << " direct member #"
     295           0 :                             << i - ent2A->getDirectMembers().begin() + 1
     296           0 :                             << " changed from " << i->type << " " << i->name
     297           0 :                             << " to " << j->type << " " << j->name
     298           0 :                             << std::endl;
     299           0 :                         std::exit(EXIT_FAILURE);
     300             :                     }
     301             :                 }
     302         472 :                 break;
     303             :             }
     304             :             case unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
     305             :             {
     306             :                 rtl::Reference<unoidl::PolymorphicStructTypeTemplateEntity>
     307           0 :                     ent2A(static_cast<unoidl::PolymorphicStructTypeTemplateEntity *>(entA.get()));
     308             :                 rtl::Reference<unoidl::PolymorphicStructTypeTemplateEntity>
     309           0 :                     ent2B(static_cast<unoidl::PolymorphicStructTypeTemplateEntity *>(entB.get()));
     310             : 
     311           0 :                 if (ent2A->getTypeParameters().size() != ent2B->getTypeParameters().size())
     312             :                 {
     313             :                     std::cerr
     314           0 :                         << "polymorphic struct type template " << name
     315           0 :                         << " number of type parameters changed from "
     316           0 :                         << ent2A->getTypeParameters().size() << " to "
     317           0 :                         << ent2B->getTypeParameters().size()
     318           0 :                         << std::endl;
     319           0 :                     std::exit(EXIT_FAILURE);
     320             :                 }
     321           0 :                 for (std::vector<OUString>::const_iterator
     322           0 :                          i(ent2A->getTypeParameters().begin()),
     323           0 :                          j(ent2B->getTypeParameters().begin());
     324           0 :                      i != ent2A->getTypeParameters().end(); ++i, ++j)
     325             :                 {
     326           0 :                     if (*i != *j)
     327             :                     {
     328             :                         std::cerr
     329           0 :                             << "polymorphic struct type template " << name
     330           0 :                             << " type parameter #"
     331           0 :                             << i - ent2A->getTypeParameters().begin() + 1
     332           0 :                             << " changed from " << *i << " to " << *j
     333           0 :                             << std::endl;
     334           0 :                         std::exit(EXIT_FAILURE);
     335             :                     }
     336             :                 }
     337           0 :                 if (ent2A->getMembers().size() != ent2B->getMembers().size())
     338             :                 {
     339             :                     std::cerr
     340           0 :                         << "polymorphic struct type template " << name
     341           0 :                         << " number of members changed from "
     342           0 :                         << ent2A->getMembers().size() << " to "
     343           0 :                         << ent2B->getMembers().size() << std::endl;
     344           0 :                     std::exit(EXIT_FAILURE);
     345             :                 }
     346           0 :                 for (std::vector<unoidl::PolymorphicStructTypeTemplateEntity::Member>::const_iterator
     347           0 :                          i(ent2A->getMembers().begin()),
     348           0 :                          j(ent2B->getMembers().begin());
     349           0 :                      i != ent2A->getMembers().end(); ++i, ++j)
     350             :                 {
     351           0 :                     if (i->name != j->name ||
     352           0 :                         i->type != j->type ||
     353           0 :                         i->parameterized != j->parameterized)
     354             :                     {
     355             :                         std::cerr
     356           0 :                             << "polymorphic struct type template " << name
     357           0 :                             << " member #"
     358           0 :                             << i - ent2A->getMembers().begin() + 1
     359           0 :                             << " changed from "
     360           0 :                             << (i->parameterized ? OUString("parameterized ") : OUString())
     361           0 :                             << i->type << " " << i->name
     362           0 :                             << " to "
     363           0 :                             << (j->parameterized ? OUString("parameterized ") : OUString())
     364           0 :                             << j->type << " " << j->name
     365           0 :                             << std::endl;
     366           0 :                             std::exit(EXIT_FAILURE);
     367             :                     }
     368             :                 }
     369           0 :                 break;
     370             :             }
     371             :             case unoidl::Entity::SORT_EXCEPTION_TYPE:
     372             :             {
     373             :                 rtl::Reference<unoidl::ExceptionTypeEntity> ent2A(
     374         172 :                         static_cast<unoidl::ExceptionTypeEntity *>(entA.get()));
     375             :                 rtl::Reference<unoidl::ExceptionTypeEntity> ent2B(
     376         344 :                         static_cast<unoidl::ExceptionTypeEntity *>(entB.get()));
     377         172 :                 if (ent2A->getDirectBase() != ent2B->getDirectBase())
     378             :                 {
     379             :                     std::cerr
     380           0 :                         << "exception type " << name
     381           0 :                         << " direct base changed from "
     382           0 :                         << (ent2A->getDirectBase().isEmpty() ? OUString("none") : ent2A->getDirectBase())
     383           0 :                         << " to "
     384           0 :                         << (ent2B->getDirectBase().isEmpty() ? OUString("none") : ent2B->getDirectBase())
     385           0 :                         << std::endl;
     386           0 :                     std::exit(EXIT_FAILURE);
     387             :                 }
     388         172 :                 if (ent2A->getDirectMembers().size() != ent2B->getDirectMembers().size())
     389             :                 {
     390             :                     std::cerr
     391           0 :                         << "exception type " << name
     392           0 :                         << " number of direct members changed from "
     393           0 :                         << ent2A->getDirectMembers().size() << " to "
     394           0 :                         << ent2B->getDirectMembers().size() << std::endl;
     395           0 :                     std::exit(EXIT_FAILURE);
     396             :                 }
     397         822 :                 for (std::vector<unoidl::ExceptionTypeEntity::Member>::const_iterator
     398         172 :                          i(ent2A->getDirectMembers().begin()),
     399         172 :                          j(ent2B->getDirectMembers().begin());
     400         548 :                      i != ent2A->getDirectMembers().end(); ++i, ++j)
     401             :                 {
     402         102 :                     if (i->name != j->name || i->type != j->type)
     403             :                     {
     404             :                         std::cerr
     405           0 :                             << "exception type " << name
     406           0 :                             << " direct member #"
     407           0 :                             << i - ent2A->getDirectMembers().begin() + 1
     408           0 :                             << " changed from " << i->type << " " << i->name
     409           0 :                             << " to " << j->type << " " << j->name
     410           0 :                             << std::endl;
     411           0 :                         std::exit(EXIT_FAILURE);
     412             :                     }
     413             :                 }
     414         344 :                 break;
     415             :             }
     416             :             case unoidl::Entity::SORT_INTERFACE_TYPE:
     417             :             {
     418             :                 rtl::Reference<unoidl::InterfaceTypeEntity> ent2A(
     419        1047 :                         static_cast<unoidl::InterfaceTypeEntity *>(entA.get()));
     420             :                 rtl::Reference<unoidl::InterfaceTypeEntity> ent2B(
     421        2094 :                         static_cast<unoidl::InterfaceTypeEntity *>(entB.get()));
     422        1047 :                 if (ent2A->getDirectMandatoryBases().size() != ent2B->getDirectMandatoryBases().size())
     423             :                 {
     424             :                     std::cerr
     425           0 :                         << "interface type " << name
     426           0 :                         << " number of direct mandatory bases changed from "
     427           0 :                         << ent2A->getDirectMandatoryBases().size() << " to "
     428           0 :                         << ent2B->getDirectMandatoryBases().size()
     429           0 :                         << std::endl;
     430           0 :                     std::exit(EXIT_FAILURE);
     431             :                 }
     432        6552 :                 for (std::vector<unoidl::AnnotatedReference>::const_iterator
     433        1047 :                          i(ent2A->getDirectMandatoryBases().begin()),
     434        1047 :                          j(ent2B->getDirectMandatoryBases().begin());
     435        4368 :                      i != ent2A->getDirectMandatoryBases().end(); ++i, ++j)
     436             :                 {
     437        1137 :                     if (i->name != j->name)
     438             :                     {
     439             :                         std::cerr
     440           0 :                             << "interface type " << name
     441           0 :                             << " direct mandatory base #"
     442           0 :                             << (i - ent2A->getDirectMandatoryBases().begin()
     443           0 :                                 + 1)
     444           0 :                             << " changed from " << i->name << " to "
     445           0 :                             << j->name
     446           0 :                             << std::endl;
     447           0 :                         std::exit(EXIT_FAILURE);
     448             :                     }
     449             :                 }
     450        1047 :                 if (ent2A->getDirectOptionalBases().size() != ent2B->getDirectOptionalBases().size())
     451             :                 {
     452             :                     std::cerr
     453           0 :                         << "interface type " << name
     454           0 :                         << " number of direct optional bases changed from "
     455           0 :                         << ent2A->getDirectOptionalBases().size() << " to "
     456           0 :                         << ent2B->getDirectOptionalBases().size()
     457           0 :                         << std::endl;
     458           0 :                     std::exit(EXIT_FAILURE);
     459             :                 }
     460        3162 :                 for (std::vector<unoidl::AnnotatedReference>::const_iterator
     461        1047 :                          i(ent2A->getDirectOptionalBases().begin()),
     462        1047 :                          j(ent2B->getDirectOptionalBases().begin());
     463        2108 :                      i != ent2A->getDirectOptionalBases().end(); ++i, ++j)
     464             :                 {
     465           7 :                     if (i->name != j->name)
     466             :                     {
     467             :                         std::cerr
     468           0 :                             << "interface type " << name
     469           0 :                             << " direct optional base #"
     470           0 :                             << (i - ent2A->getDirectOptionalBases().begin() + 1)
     471           0 :                             << " changed from " << i->name << " to "
     472           0 :                             << j->name
     473           0 :                             << std::endl;
     474           0 :                         std::exit(EXIT_FAILURE);
     475             :                     }
     476             :                 }
     477        2094 :                 if (ent2A->getDirectAttributes().size()
     478        1047 :                     != ent2B->getDirectAttributes().size())
     479             :                 {
     480             :                     std::cerr
     481           0 :                         << "interface type " << name
     482           0 :                         << " number of direct attributes changed from "
     483           0 :                         << ent2A->getDirectAttributes().size() << " to "
     484           0 :                         << ent2B->getDirectAttributes().size() << std::endl;
     485           0 :                     std::exit(EXIT_FAILURE);
     486             :                 }
     487        3483 :                 for (std::vector<unoidl::InterfaceTypeEntity::Attribute>::const_iterator
     488        1047 :                          i(ent2A->getDirectAttributes().begin()),
     489        1047 :                          j(ent2B->getDirectAttributes().begin());
     490        2322 :                      i != ent2A->getDirectAttributes().end(); ++i, ++j)
     491             :                 {
     492         342 :                     if (i->name != j->name ||
     493         228 :                         i->type != j->type ||
     494         228 :                         i->bound != j->bound ||
     495         228 :                         i->readOnly != j->readOnly ||
     496         342 :                         i->getExceptions != j->getExceptions ||
     497         114 :                         i->setExceptions != j->setExceptions)
     498             :                     {
     499             :                         std::cerr
     500           0 :                             << "interface type " << name
     501           0 :                             << " direct attribute #"
     502           0 :                             << i - ent2A->getDirectAttributes().begin() + 1
     503           0 :                             << " changed from "
     504           0 :                             << (i->bound ? OUString("bound ") : OUString())
     505           0 :                             << (i->readOnly ? OUString("read-only ") : OUString())
     506           0 :                             << i->type << " " << i->name //TODO: exceptions
     507           0 :                             << " to "
     508           0 :                             << (j->bound ? OUString("bound ") : OUString())
     509           0 :                             << (j->readOnly ? OUString("read-only ") : OUString())
     510           0 :                             << j->type << " " << j->name //TODO: exceptions
     511           0 :                             << std::endl;
     512           0 :                         std::exit(EXIT_FAILURE);
     513             :                     }
     514             :                 }
     515        2094 :                 if (ent2A->getDirectMethods().size()
     516        1047 :                     != ent2B->getDirectMethods().size())
     517             :                 {
     518             :                     std::cerr
     519           0 :                         << "interface type " << name
     520           0 :                         << " number of direct methods changed from "
     521           0 :                         << ent2A->getDirectMethods().size() << " to "
     522           0 :                         << ent2B->getDirectMethods().size() << std::endl;
     523           0 :                     std::exit(EXIT_FAILURE);
     524             :                 }
     525       13428 :                 for (std::vector<unoidl::InterfaceTypeEntity::Method>::const_iterator
     526        1047 :                          i(ent2A->getDirectMethods().begin()),
     527        1047 :                          j(ent2B->getDirectMethods().begin());
     528        8952 :                      i != ent2A->getDirectMethods().end(); ++i, ++j)
     529             :                 {
     530       10287 :                     if (i->name != j->name ||
     531        6858 :                         i->returnType != j->returnType ||
     532        3429 :                         i->exceptions != j->exceptions)
     533             :                     {
     534             :                         std::cerr
     535           0 :                             << "interface type " << name
     536           0 :                             << " direct method #"
     537           0 :                             << i - ent2A->getDirectMethods().begin() + 1
     538           0 :                             << " changed from "
     539           0 :                             << i->returnType << " " << i->name //TODO: exceptions
     540           0 :                             << " to " << j->returnType << " " << j->name //TODO: exceptions
     541           0 :                             << std::endl;
     542           0 :                         std::exit(EXIT_FAILURE);
     543             :                     }
     544        3429 :                     if (i->parameters.size() != j->parameters.size())
     545             :                     {
     546             :                         std::cerr
     547           0 :                             << "interface type " << name
     548           0 :                             << " direct method " << i->name
     549           0 :                             << " number of parameters changed from "
     550           0 :                             << i->parameters.size() << " to "
     551           0 :                             << j->parameters.size()
     552           0 :                             << std::endl;
     553           0 :                         std::exit(EXIT_FAILURE);
     554             :                     }
     555       20544 :                     for (std::vector<unoidl::InterfaceTypeEntity::Method::Parameter>::const_iterator
     556        3429 :                              k(i->parameters.begin()),
     557        3429 :                              l(j->parameters.begin());
     558       13696 :                          k != i->parameters.end(); ++k, ++l)
     559             :                     {
     560        3419 :                         if (k->type != l->type || k->direction != l->direction)
     561             :                         {
     562             :                             std::cerr
     563           0 :                                 << "interface type " << name
     564           0 :                                 << " direct method " << i->name
     565           0 :                                 << " parameter #"
     566           0 :                                 << k - i->parameters.begin() + 1
     567           0 :                                 << " changed from "
     568           0 :                                 << showDirection(k->direction) << " "
     569           0 :                                 << k->type << " to "
     570           0 :                                 << showDirection(l->direction) << " "
     571           0 :                                 << l->type
     572           0 :                                 << std::endl;
     573           0 :                             std::exit(EXIT_FAILURE);
     574             :                         }
     575        3419 :                         if (k->name != l->name)
     576             :                         {
     577             :                             std::cerr
     578           0 :                                 << "interface type " << name
     579           0 :                                 << " direct method " << i->name
     580           0 :                                 << " parameter #"
     581           0 :                                 << k - i->parameters.begin() + 1
     582           0 :                                 << " changed name from " << k->name
     583           0 :                                 << " to " << l->name
     584           0 :                                 << std::endl;
     585           0 :                             std::exit(EXIT_FAILURE);
     586             :                         }
     587             :                     }
     588             :                 }
     589        2094 :                 break;
     590             :             }
     591             :             case unoidl::Entity::SORT_TYPEDEF:
     592             :             {
     593             :                 rtl::Reference<unoidl::TypedefEntity> ent2A(
     594          14 :                         static_cast<unoidl::TypedefEntity *>(entA.get()));
     595             :                 rtl::Reference<unoidl::TypedefEntity> ent2B(
     596          28 :                         static_cast<unoidl::TypedefEntity *>(entB.get()));
     597          14 :                 if (ent2A->getType() != ent2B->getType())
     598             :                 {
     599             :                     std::cerr
     600           0 :                         << "typedef " << name << " type changed from "
     601           0 :                         << ent2A->getType() << " to " << ent2B->getType()
     602           0 :                         << std::endl;
     603           0 :                     std::exit(EXIT_FAILURE);
     604             :                 }
     605          28 :                 break;
     606             :             }
     607             :             case unoidl::Entity::SORT_CONSTANT_GROUP:
     608             :             {
     609             :                 rtl::Reference<unoidl::ConstantGroupEntity> ent2A(
     610         206 :                         static_cast<unoidl::ConstantGroupEntity *>(entA.get()));
     611             :                 rtl::Reference<unoidl::ConstantGroupEntity> ent2B(
     612         412 :                         static_cast<unoidl::ConstantGroupEntity *>(entB.get()));
     613        6264 :                 for (std::vector<unoidl::ConstantGroupEntity::Member>::const_iterator
     614         206 :                          i(ent2A->getMembers().begin());
     615        4176 :                      i != ent2A->getMembers().end(); ++i)
     616             :                 {
     617        1882 :                     bool found = false;
     618       95640 :                     for (std::vector<unoidl::ConstantGroupEntity::Member>::const_iterator
     619        1882 :                              j(ent2B->getMembers().begin());
     620       63760 :                          j != ent2B->getMembers().end(); ++j)
     621             :                     {
     622       31880 :                         if (i->name == j->name)
     623             :                         {
     624        1882 :                             if (i->value != j->value)
     625             :                             {
     626             :                                 std::cerr
     627           0 :                                     << "constant group " << name
     628           0 :                                     << " member " << i->name
     629           0 :                                     << " changed value"
     630           0 :                                     << std::endl;
     631           0 :                                 std::exit(EXIT_FAILURE);
     632             :                             }
     633        1882 :                             found = true;
     634        1882 :                             break;
     635             :                         }
     636             :                     }
     637        1882 :                     if (!found)
     638             :                     {
     639             :                         std::cerr
     640           0 :                             << "A constant group " << name << " member "
     641           0 :                             << i->name << " is not present in B"
     642           0 :                             << std::endl;
     643           0 :                         std::exit(EXIT_FAILURE);
     644             :                     }
     645             :                 }
     646         412 :                 break;
     647             :             }
     648             :             case unoidl::Entity::SORT_SINGLE_INTERFACE_BASED_SERVICE:
     649             :             {
     650             :                 rtl::Reference<unoidl::SingleInterfaceBasedServiceEntity>
     651         127 :                     ent2A( static_cast<unoidl::SingleInterfaceBasedServiceEntity *>( entA.get()));
     652             :                 rtl::Reference<unoidl::SingleInterfaceBasedServiceEntity>
     653         254 :                     ent2B( static_cast<unoidl::SingleInterfaceBasedServiceEntity *>( entB.get()));
     654         127 :                 if (ent2A->getBase() != ent2B->getBase())
     655             :                 {
     656             :                     std::cerr
     657           0 :                         << "single-interface--based servcie " << name
     658           0 :                         << " base changed from " << ent2A->getBase()
     659           0 :                         << " to " << ent2B->getBase()
     660           0 :                         << std::endl;
     661           0 :                     std::exit(EXIT_FAILURE);
     662             :                 }
     663         127 :                 if (ent2A->getConstructors().size() != ent2B->getConstructors().size())
     664             :                 {
     665             :                     std::cerr
     666           0 :                         << "single-interface--based service " << name
     667           0 :                         << " number of constructors changed from "
     668           0 :                         << ent2A->getConstructors().size() << " to "
     669           0 :                         << ent2B->getConstructors().size() << std::endl;
     670           0 :                     std::exit(EXIT_FAILURE);
     671             :                 }
     672         771 :                 for (std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor>::const_iterator
     673         127 :                          i(ent2A->getConstructors().begin()),
     674         127 :                          j(ent2B->getConstructors().begin());
     675         514 :                      i != ent2A->getConstructors().end(); ++i, ++j)
     676             :                 {
     677         390 :                     if (i->name != j->name ||
     678         260 :                         i->parameters != j->parameters ||
     679         390 :                         i->exceptions != j->exceptions ||
     680         130 :                         i->defaultConstructor != j->defaultConstructor)
     681             :                     {
     682             :                         std::cerr
     683           0 :                             << "single-interface--based service " << name
     684           0 :                             << " constructor #"
     685           0 :                             << i - ent2A->getConstructors().begin() + 1
     686           0 :                             << " changed from "
     687           0 :                             << (i->defaultConstructor ? OUString("default ") : i->name) //TODO: parameters, exceptions
     688           0 :                             << " to "
     689           0 :                             << (j->defaultConstructor ? OUString("default ") : j->name) //TODO: parameters, exceptions
     690           0 :                             << std::endl;
     691           0 :                         std::exit(EXIT_FAILURE);
     692             :                     }
     693             :                 }
     694         254 :                 break;
     695             :             }
     696             :             case unoidl::Entity::SORT_ACCUMULATION_BASED_SERVICE:
     697             :             {
     698             :                 rtl::Reference<unoidl::AccumulationBasedServiceEntity>
     699         738 :                     ent2A( static_cast<unoidl::AccumulationBasedServiceEntity *>( entA.get()));
     700             :                 rtl::Reference<unoidl::AccumulationBasedServiceEntity>
     701        1476 :                     ent2B( static_cast<unoidl::AccumulationBasedServiceEntity *>( entB.get()));
     702             : 
     703         738 :                 if (ent2A->getDirectMandatoryBaseServices().size() != ent2B->getDirectMandatoryBaseServices().size())
     704             :                 {
     705             :                     std::cerr
     706           0 :                         << "accumulation-based service " << name
     707           0 :                         << " number of direct mandatory base services changed from "
     708           0 :                         << ent2A->getDirectMandatoryBaseServices().size()
     709           0 :                         << " to "
     710           0 :                         << ent2B->getDirectMandatoryBaseServices().size()
     711           0 :                         << std::endl;
     712           0 :                     std::exit(EXIT_FAILURE);
     713             :                 }
     714        3933 :                 for (std::vector<unoidl::AnnotatedReference>::const_iterator
     715         738 :                          i(ent2A->getDirectMandatoryBaseServices().begin()),
     716         738 :                          j(ent2B->getDirectMandatoryBaseServices().begin());
     717        2622 :                      i != ent2A->getDirectMandatoryBaseServices().end();
     718             :                      ++i, ++j)
     719             :                 {
     720         573 :                     if (i->name != j->name)
     721             :                     {
     722             :                         std::cerr
     723           0 :                             << "accumulation-based service " << name
     724           0 :                             << " direct mandatory base service #"
     725           0 :                             << (i - (ent2A->getDirectMandatoryBaseServices().begin()) + 1)
     726           0 :                             << " changed from " << i->name << " to "
     727           0 :                             << j->name << std::endl;
     728           0 :                         std::exit(EXIT_FAILURE);
     729             :                     }
     730             :                 }
     731         738 :                 if (ent2A->getDirectOptionalBaseServices().size() > ent2B->getDirectOptionalBaseServices().size())
     732             :                 {
     733             :                     std::cerr
     734           0 :                         << "accumulation-based service " << name
     735           0 :                         << " number of direct optional base services  shrank from "
     736           0 :                         << ent2A->getDirectOptionalBaseServices().size()
     737           0 :                         << " to "
     738           0 :                         << ent2B->getDirectOptionalBaseServices().size()
     739           0 :                         << std::endl;
     740           0 :                     std::exit(EXIT_FAILURE);
     741             :                 }
     742        2388 :                 for (std::vector<unoidl::AnnotatedReference>::const_iterator
     743         738 :                          i(ent2A->getDirectOptionalBaseServices().begin());
     744        1592 :                      i != ent2A->getDirectOptionalBaseServices().end();
     745             :                      ++i)
     746             :                 {
     747         116 :                     if (std::find_if(
     748          58 :                                 ent2B->getDirectOptionalBaseServices().begin(),
     749          58 :                                 ent2B->getDirectOptionalBaseServices().end(),
     750         232 :                                 EqualsAnnotation(i->name))
     751         232 :                         == ent2B->getDirectOptionalBaseServices().end())
     752             :                     {
     753             :                         std::cerr
     754           0 :                             << "accumulation-based service " << name
     755           0 :                             << " direct optional base service " << i->name
     756           0 :                             << " was removed" << std::endl;
     757           0 :                         std::exit(EXIT_FAILURE);
     758             :                     }
     759             :                 }
     760        1476 :                 if (ent2A->getDirectMandatoryBaseInterfaces().size()
     761         738 :                     != ent2B->getDirectMandatoryBaseInterfaces().size())
     762             :                 {
     763             :                     std::cerr
     764           0 :                         << "accumulation-based service " << name
     765             :                         << (" number of direct mandatory base interfaces"
     766           0 :                             " changed from ")
     767           0 :                         << ent2A->getDirectMandatoryBaseInterfaces().size()
     768           0 :                         << " to "
     769           0 :                         << ent2B->getDirectMandatoryBaseInterfaces().size()
     770           0 :                         << std::endl;
     771           0 :                     std::exit(EXIT_FAILURE);
     772             :                 }
     773        5175 :                 for (std::vector<unoidl::AnnotatedReference>::const_iterator
     774         738 :                          i(ent2A->getDirectMandatoryBaseInterfaces().begin()),
     775         738 :                          j(ent2B->getDirectMandatoryBaseInterfaces().begin());
     776        3450 :                      i != ent2A->getDirectMandatoryBaseInterfaces().end();
     777             :                      ++i, ++j)
     778             :                 {
     779         987 :                     if (i->name != j->name)
     780             :                     {
     781             :                         std::cerr
     782           0 :                             << "accumulation-based service " << name
     783           0 :                             << " direct mandatory base interface #"
     784           0 :                             << (i - (ent2A->getDirectMandatoryBaseInterfaces().begin()) + 1)
     785           0 :                             << " changed from " << i->name << " to "
     786           0 :                             << j->name << std::endl;
     787           0 :                         std::exit(EXIT_FAILURE);
     788             :                     }
     789             :                 }
     790         738 :                 if (ent2A->getDirectOptionalBaseInterfaces().size() > ent2B->getDirectOptionalBaseInterfaces().size())
     791             :                 {
     792             :                     std::cerr
     793           0 :                         << "accumulation-based service " << name
     794             :                         << (" number of direct optional base interfaces"
     795           0 :                             " shrank from ")
     796           0 :                         << ent2A->getDirectOptionalBaseInterfaces().size()
     797           0 :                         << " to "
     798           0 :                         << ent2B->getDirectOptionalBaseInterfaces().size()
     799           0 :                         << std::endl;
     800           0 :                     std::exit(EXIT_FAILURE);
     801             :                 }
     802        2952 :                 for (std::vector<unoidl::AnnotatedReference>::const_iterator
     803         738 :                          i(ent2A->getDirectOptionalBaseInterfaces().begin());
     804        1968 :                      i != ent2A->getDirectOptionalBaseInterfaces().end();
     805             :                      ++i)
     806             :                 {
     807         492 :                     if (std::find_if(
     808         246 :                                 (ent2B->getDirectOptionalBaseInterfaces().begin()),
     809         246 :                                 ent2B->getDirectOptionalBaseInterfaces().end(),
     810         984 :                                 EqualsAnnotation(i->name))
     811         984 :                         == ent2B->getDirectOptionalBaseInterfaces().end())
     812             :                     {
     813             :                         std::cerr
     814           0 :                             << "accumulation-based service " << name
     815           0 :                             << " direct optional base interface " << i->name
     816           0 :                             << " was removed" << std::endl;
     817           0 :                         std::exit(EXIT_FAILURE);
     818             :                     }
     819             :                 }
     820         738 :                 if (ent2A->getDirectProperties().size() > ent2B->getDirectProperties().size())
     821             :                 {
     822             :                     std::cerr
     823           0 :                         << "accumulation-based service " << name
     824           0 :                         << " number of direct properties changed from "
     825           0 :                         << ent2A->getDirectProperties().size() << " to "
     826           0 :                         << ent2B->getDirectProperties().size() << std::endl;
     827           0 :                     std::exit(EXIT_FAILURE);
     828             :                 }
     829       10212 :                 for (std::vector<unoidl::AccumulationBasedServiceEntity::Property>::const_iterator
     830         738 :                          i(ent2A->getDirectProperties().begin()),
     831         738 :                          j(ent2B->getDirectProperties().begin());
     832        6808 :                      i != ent2A->getDirectProperties().end(); ++i, ++j)
     833             :                 {
     834        7998 :                     if (i->name != j->name ||
     835        5332 :                         i->type != j->type ||
     836        2666 :                         i->attributes != j->attributes)
     837             :                     {
     838             :                         std::cerr
     839           0 :                             << "accumulation-based service " << name
     840           0 :                             << " direct property #"
     841           0 :                             << i - ent2A->getDirectProperties().begin() + 1
     842           0 :                             << " changed from "
     843           0 :                             << i->type << " " << i->name //TODO: attributes
     844           0 :                             << " to "
     845           0 :                             << j->type << " " << j->name //TODO: attributes
     846           0 :                             << std::endl;
     847           0 :                         std::exit(EXIT_FAILURE);
     848             :                     }
     849             :                 }
     850        2250 :                 for (std::vector<unoidl::AccumulationBasedServiceEntity::Property>::const_iterator
     851         738 :                          i(ent2B->getDirectProperties().begin()
     852        1476 :                            + ent2A->getDirectProperties().size());
     853        1500 :                      i != ent2B->getDirectProperties().end(); ++i)
     854             :                 {
     855          12 :                     if ((i->attributes & unoidl::AccumulationBasedServiceEntity::Property::ATTRIBUTE_OPTIONAL) == 0)
     856             :                     {
     857             :                         std::cerr
     858           0 :                             << "B accumulation-based service " << name
     859           0 :                             << " additional direct property " << i->name
     860           0 :                             << " is not optional" << std::endl;
     861           0 :                         std::exit(EXIT_FAILURE);
     862             :                     }
     863             :                 }
     864        1476 :                 break;
     865             :             }
     866             :             case unoidl::Entity::SORT_INTERFACE_BASED_SINGLETON:
     867             :             {
     868             :                 rtl::Reference<unoidl::InterfaceBasedSingletonEntity> ent2A(
     869           3 :                         static_cast<unoidl::InterfaceBasedSingletonEntity *>(entA.get()));
     870             :                 rtl::Reference<unoidl::InterfaceBasedSingletonEntity> ent2B(
     871           6 :                         static_cast<unoidl::InterfaceBasedSingletonEntity *>(entB.get()));
     872             : 
     873           3 :                 if (ent2A->getBase() != ent2B->getBase())
     874             :                 {
     875             :                     std::cerr
     876           0 :                         << "interface-based singleton " << name
     877           0 :                         << " base changed from " << ent2A->getBase()
     878           0 :                         << " to " << ent2B->getBase() << std::endl;
     879           0 :                     std::exit(EXIT_FAILURE);
     880             :                 }
     881           6 :                 break;
     882             :             }
     883             :             case unoidl::Entity::SORT_SERVICE_BASED_SINGLETON:
     884             :             {
     885             :                 rtl::Reference<unoidl::ServiceBasedSingletonEntity> ent2A(
     886           0 :                         static_cast<unoidl::ServiceBasedSingletonEntity *>(entA.get()));
     887             :                 rtl::Reference<unoidl::ServiceBasedSingletonEntity> ent2B(
     888           0 :                         static_cast<unoidl::ServiceBasedSingletonEntity *>(entB.get()));
     889             : 
     890           0 :                 if (ent2A->getBase() != ent2B->getBase())
     891             :                 {
     892             :                     std::cerr
     893           0 :                         << "service-based singleton " << name
     894           0 :                         << " base changed from " << ent2A->getBase()
     895           0 :                         << " to " << ent2B->getBase()
     896           0 :                         << std::endl;
     897           0 :                     std::exit(EXIT_FAILURE);
     898             :                 }
     899           0 :                 break;
     900             :             }
     901        2700 :             }
     902             :         }
     903        2777 :     }
     904          79 : }
     905             : 
     906        9585 : bool valid(OUString const & identifier)
     907             : {
     908       10581 :     for (sal_Int32 i = 0;; ++i)
     909             :     {
     910       10581 :         i = identifier.indexOf('_', i);
     911       10581 :         if (i == -1)
     912             :         {
     913        9585 :             return true;
     914             :         }
     915         996 :         if (!rtl::isAsciiUpperCase(identifier[0]) || identifier[i - 1] == '_')
     916             :         {
     917           0 :             return false;
     918             :         }
     919         996 :     }
     920             : }
     921             : 
     922        4533 : void checkIds( rtl::Reference<unoidl::Provider> const & providerA, OUString const & prefix,
     923             :                rtl::Reference<unoidl::MapCursor> const & cursor)
     924             : {
     925             :     assert(cursor.is());
     926             :     for (;;)
     927             :     {
     928        4533 :         OUString id;
     929        8933 :         rtl::Reference<unoidl::Entity> entB(cursor->getNext(&id));
     930        4533 :         if (!entB.is())
     931             :         {
     932         133 :             break;
     933             :         }
     934        8800 :         OUString name(prefix + id);
     935        8800 :         rtl::Reference<unoidl::Entity> entA(providerA->findEntity(name));
     936        4400 :         if (!(entA.is() || valid(id)))
     937             :         {
     938             :             std::cerr
     939           0 :                 << "entity name " << name << " uses an invalid identifier"
     940           0 :                 << std::endl;
     941           0 :             std::exit(EXIT_FAILURE);
     942             :         }
     943        4400 :         switch (entB->getSort())
     944             :         {
     945             :         case unoidl::Entity::SORT_MODULE:
     946         262 :             checkIds( providerA, name + ".",
     947         393 :                       (static_cast<unoidl::ModuleEntity *>(entB.get())->createCursor()));
     948         131 :             break;
     949             :         case unoidl::Entity::SORT_ENUM_TYPE:
     950         192 :             if (!entA.is())
     951             :             {
     952          35 :                 rtl::Reference<unoidl::EnumTypeEntity> ent2B(static_cast<unoidl::EnumTypeEntity *>(entB.get()));
     953             : 
     954         795 :                 for (std::vector<unoidl::EnumTypeEntity::Member>::const_iterator
     955          35 :                          i(ent2B->getMembers().begin());
     956         530 :                      i != ent2B->getMembers().end(); ++i)
     957             :                 {
     958         230 :                     if (!valid(i->name))
     959             :                     {
     960             :                         std::cerr
     961           0 :                             << "enum type " << name << " member " << i->name
     962           0 :                             << " uses an invalid identifier"
     963           0 :                             << std::endl;
     964           0 :                         std::exit(EXIT_FAILURE);
     965             :                     }
     966          35 :                 }
     967             :             }
     968         192 :             break;
     969             :         case unoidl::Entity::SORT_PLAIN_STRUCT_TYPE:
     970         387 :             if (!entA.is())
     971             :             {
     972             :                 rtl::Reference<unoidl::PlainStructTypeEntity> ent2B(
     973         151 :                         static_cast<unoidl::PlainStructTypeEntity *>(entB.get()));
     974             : 
     975        2031 :                 for (std::vector<unoidl::PlainStructTypeEntity::Member>::const_iterator
     976         151 :                          i(ent2B->getDirectMembers().begin());
     977        1354 :                      i != ent2B->getDirectMembers().end(); ++i)
     978             :                 {
     979         526 :                     if (!valid(i->name))
     980             :                     {
     981             :                         std::cerr
     982           0 :                             << "plain struct type " << name << " direct member "
     983           0 :                             << i->name << " uses an invalid identifier"
     984           0 :                             << std::endl;
     985           0 :                         std::exit(EXIT_FAILURE);
     986             :                     }
     987         151 :                 }
     988             :             }
     989         387 :             break;
     990             :         case unoidl::Entity::SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE:
     991           4 :             if (!entA.is())
     992             :             {
     993             :                 rtl::Reference<unoidl::PolymorphicStructTypeTemplateEntity>
     994           4 :                     ent2B( static_cast< unoidl::PolymorphicStructTypeTemplateEntity *>(entB.get()));
     995             : 
     996          27 :                 for (std::vector<OUString>::const_iterator i(ent2B->getTypeParameters().begin());
     997          18 :                      i != ent2B->getTypeParameters().end(); ++i)
     998             :                 {
     999           5 :                     if (!valid(*i))
    1000             :                     {
    1001             :                         std::cerr
    1002           0 :                             << "polymorphic struct type template " << name
    1003           0 :                             << " type parameter " << *i
    1004           0 :                             << " uses an invalid identifier"
    1005           0 :                             << std::endl;
    1006           0 :                         std::exit(EXIT_FAILURE);
    1007             :                     }
    1008             :                 }
    1009          36 :                 for (std::vector<unoidl::PolymorphicStructTypeTemplateEntity::Member>::const_iterator
    1010           4 :                          i(ent2B->getMembers().begin());
    1011          24 :                      i != ent2B->getMembers().end(); ++i)
    1012             :                 {
    1013           8 :                     if (!valid(i->name))
    1014             :                     {
    1015             :                         std::cerr
    1016           0 :                             << "polymorphic struct type template " << name
    1017           0 :                             << " member " << i->name
    1018           0 :                             << " uses an invalid identifier" << std::endl;
    1019           0 :                         std::exit(EXIT_FAILURE);
    1020             :                     }
    1021           4 :                 }
    1022             :             }
    1023           4 :             break;
    1024             :         case unoidl::Entity::SORT_EXCEPTION_TYPE:
    1025         242 :             if (!entA.is())
    1026             :             {
    1027             :                 rtl::Reference<unoidl::ExceptionTypeEntity> ent2B(
    1028          70 :                         static_cast<unoidl::ExceptionTypeEntity *>(entB.get()));
    1029             : 
    1030         354 :                 for (std::vector<unoidl::ExceptionTypeEntity::Member>::const_iterator
    1031          70 :                          i(ent2B->getDirectMembers().begin());
    1032         236 :                      i != ent2B->getDirectMembers().end(); ++i)
    1033             :                 {
    1034          48 :                     if (!valid(i->name))
    1035             :                     {
    1036             :                         std::cerr
    1037           0 :                             << "exception type " << name << " direct member "
    1038           0 :                             << i->name << " uses an invalid identifier"
    1039           0 :                             << std::endl;
    1040           0 :                         std::exit(EXIT_FAILURE);
    1041             :                     }
    1042          70 :                 }
    1043             :             }
    1044         242 :             break;
    1045             :         case unoidl::Entity::SORT_INTERFACE_TYPE:
    1046        1691 :             if (!entA.is())
    1047             :             {
    1048             :                 rtl::Reference<unoidl::InterfaceTypeEntity> ent2B(
    1049         644 :                         static_cast<unoidl::InterfaceTypeEntity *>(entB.get()));
    1050        3366 :                 for (std::vector<unoidl::InterfaceTypeEntity::Attribute>::const_iterator
    1051         644 :                          i(ent2B->getDirectAttributes().begin());
    1052        2244 :                      i != ent2B->getDirectAttributes().end(); ++i)
    1053             :                 {
    1054         478 :                     if (!valid(i->name))
    1055             :                     {
    1056             :                         std::cerr
    1057           0 :                             << "interface type " << name << " direct attribute "
    1058           0 :                             << i->name << " uses an invalid identifier"
    1059           0 :                             << std::endl;
    1060           0 :                         std::exit(EXIT_FAILURE);
    1061             :                     }
    1062             :                 }
    1063        8313 :                 for (std::vector<unoidl::InterfaceTypeEntity::Method>::const_iterator
    1064         644 :                          i(ent2B->getDirectMethods().begin());
    1065        5542 :                      i != ent2B->getDirectMethods().end(); ++i)
    1066             :                 {
    1067        2127 :                     if (!valid(i->name))
    1068             :                     {
    1069             :                         std::cerr
    1070           0 :                             << "interface type " << name << " direct method "
    1071           0 :                             << i->name << " uses an invalid identifier"
    1072           0 :                             << std::endl;
    1073           0 :                         std::exit(EXIT_FAILURE);
    1074             :                     }
    1075       13032 :                     for (std::vector<unoidl::InterfaceTypeEntity::Method::Parameter>::const_iterator
    1076        2127 :                              j(i->parameters.begin());
    1077        8688 :                          j != i->parameters.end(); ++j)
    1078             :                     {
    1079        2217 :                         if (!valid(j->name))
    1080             :                         {
    1081             :                             std::cerr
    1082           0 :                                 << "interface type " << name
    1083           0 :                                 << " direct method " << i->name << " parameter "
    1084           0 :                                 << j->name << " uses an invalid identifier"
    1085           0 :                                 << std::endl;
    1086           0 :                             std::exit(EXIT_FAILURE);
    1087             :                         }
    1088             :                     }
    1089         644 :                 }
    1090             :             }
    1091        1691 :             break;
    1092             :         case unoidl::Entity::SORT_TYPEDEF:
    1093             :         case unoidl::Entity::SORT_INTERFACE_BASED_SINGLETON:
    1094             :         case unoidl::Entity::SORT_SERVICE_BASED_SINGLETON:
    1095          49 :             break;
    1096             :         case unoidl::Entity::SORT_CONSTANT_GROUP:
    1097             :         {
    1098             :             rtl::Reference<unoidl::ConstantGroupEntity> ent2B(
    1099         348 :                     static_cast<unoidl::ConstantGroupEntity *>(entB.get()));
    1100       11091 :             for (std::vector<unoidl::ConstantGroupEntity::Member>::const_iterator
    1101         348 :                      i(ent2B->getMembers().begin());
    1102        7394 :                  i != ent2B->getMembers().end(); ++i)
    1103             :             {
    1104        3349 :                 bool found = false;
    1105        3349 :                 if (entA.is())
    1106             :                 {
    1107             :                     rtl::Reference<unoidl::ConstantGroupEntity> ent2A(
    1108             :                             static_cast<unoidl::ConstantGroupEntity *>(
    1109        1884 :                                     entA.get()));
    1110       95967 :                     for (std::vector<unoidl::ConstantGroupEntity::Member>::const_iterator
    1111        1884 :                              j(ent2A->getMembers().begin());
    1112       63978 :                          j != ent2A->getMembers().end(); ++j)
    1113             :                     {
    1114       31987 :                         if (i->name == j->name)
    1115             :                         {
    1116        1882 :                             found = true;
    1117        1882 :                             break;
    1118             :                         }
    1119        1884 :                     }
    1120             :                 }
    1121        3349 :                 if (!(found || valid(i->name)))
    1122             :                 {
    1123             :                     std::cerr
    1124           0 :                         << "Constant group " << name << " member "
    1125           0 :                         << i->name << " uses an invalid identifier"
    1126           0 :                         << std::endl;
    1127           0 :                     std::exit(EXIT_FAILURE);
    1128             :                 }
    1129             :             }
    1130         348 :             break;
    1131             :         }
    1132             :         case unoidl::Entity::SORT_SINGLE_INTERFACE_BASED_SERVICE:
    1133         337 :             if (!entA.is())
    1134             :             {
    1135             :                 rtl::Reference<unoidl::SingleInterfaceBasedServiceEntity>
    1136             :                     ent2B( static_cast<unoidl::SingleInterfaceBasedServiceEntity *>(
    1137         210 :                                    entB.get()));
    1138             : 
    1139        1329 :                 for (std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor>::const_iterator
    1140         210 :                          i(ent2B->getConstructors().begin());
    1141         886 :                      i != ent2B->getConstructors().end(); ++i)
    1142             :                 {
    1143         233 :                     if (!valid(i->name))
    1144             :                     {
    1145             :                         std::cerr
    1146           0 :                             << "single-interface--based service " << name
    1147           0 :                             << " constructor " << i->name
    1148           0 :                             << " uses an invalid identifier"
    1149           0 :                             << std::endl;
    1150           0 :                         std::exit(EXIT_FAILURE);
    1151             :                     }
    1152        1155 :                     for (std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter>::const_iterator
    1153         233 :                              j(i->parameters.begin());
    1154         770 :                          j != i->parameters.end(); ++j)
    1155             :                     {
    1156         152 :                         if (!valid(j->name))
    1157             :                         {
    1158             :                             std::cerr
    1159           0 :                                 << "single-interface--based service " << name
    1160           0 :                                 << " constructor " << i->name << " parameter "
    1161           0 :                                 << j->name << " uses an invalid identifier"
    1162           0 :                                 << std::endl;
    1163           0 :                             std::exit(EXIT_FAILURE);
    1164             :                         }
    1165             :                     }
    1166         210 :                 }
    1167             :             }
    1168         337 :             break;
    1169             :         case unoidl::Entity::SORT_ACCUMULATION_BASED_SERVICE:
    1170             :         {
    1171             :             rtl::Reference<unoidl::AccumulationBasedServiceEntity> ent2B(
    1172             :                     static_cast<unoidl::AccumulationBasedServiceEntity *>(
    1173        1019 :                             entB.get()));
    1174             :             std::vector<unoidl::AccumulationBasedServiceEntity::Property>::size_type
    1175        1019 :                 n(entA.is() ?
    1176        1019 :                   (static_cast<unoidl::AccumulationBasedServiceEntity *>(entA.get())->getDirectProperties().size()) : 0);
    1177             :             assert(n <= ent2B->getDirectProperties().size());
    1178             : 
    1179        4470 :             for (std::vector<unoidl::AccumulationBasedServiceEntity::Property>::const_iterator
    1180        1019 :                      i(ent2B->getDirectProperties().begin() + n);
    1181        2980 :                  i != ent2B->getDirectProperties().end(); ++i)
    1182             :             {
    1183         471 :                 if (!valid(i->name))
    1184             :                 {
    1185             :                     std::cerr
    1186           0 :                         << "accumulation-based service " << name
    1187           0 :                         << " direct property " << i->name
    1188           0 :                         << " uses an invalid identifier"
    1189           0 :                         << std::endl;
    1190           0 :                     std::exit(EXIT_FAILURE);
    1191             :                 }
    1192             :             }
    1193        1019 :             break;
    1194             :         }
    1195             :         }
    1196        4400 :     }
    1197         133 : }
    1198             : 
    1199             : }
    1200             : 
    1201           4 : SAL_IMPLEMENT_MAIN()
    1202             : {
    1203             :     try
    1204             :     {
    1205           2 :         sal_uInt32 args = rtl_getAppCommandArgCount();
    1206           6 :         rtl::Reference<unoidl::Manager> mgr[2];
    1207           2 :         mgr[0] = new unoidl::Manager;
    1208           2 :         mgr[1] = new unoidl::Manager;
    1209             : 
    1210           4 :         rtl::Reference<unoidl::Provider> prov[2];
    1211           2 :         int side = 0;
    1212          10 :         for (sal_uInt32 i = 0; i != args; ++i)
    1213             :         {
    1214           8 :             bool delimiter = false;
    1215           8 :             OUString uri(getArgumentUri(i, side == 0 ? &delimiter : 0));
    1216           8 :             if (delimiter)
    1217             :             {
    1218           2 :                 side = 1;
    1219             :             }
    1220             :             else
    1221             :             {
    1222             :                 try
    1223             :                 {
    1224           6 :                     prov[side] = mgr[side]->addProvider(uri);
    1225             :                 }
    1226           0 :                 catch (unoidl::NoSuchFileException &)
    1227             :                 {
    1228             :                     std::cerr
    1229           0 :                         << "Input <" << uri << "> does not exist"
    1230           0 :                         << std::endl;
    1231           0 :                     std::exit(EXIT_FAILURE);
    1232             :                 }
    1233             :             }
    1234           8 :         }
    1235           2 :         if (side == 0 || !(prov[0].is() && prov[1].is()))
    1236             :         {
    1237           0 :             badUsage();
    1238             :         }
    1239           2 :         checkMap(prov[1], "", prov[0]->createRootCursor());
    1240           2 :         checkIds(prov[0], "", prov[1]->createRootCursor());
    1241           8 :         return EXIT_SUCCESS;
    1242             :     }
    1243           0 :     catch (unoidl::FileFormatException & e1)
    1244             :     {
    1245             :         std::cerr
    1246           0 :             << "Bad input <" << e1.getUri() << ">: " << e1.getDetail()
    1247           0 :             << std::endl;
    1248           0 :         std::exit(EXIT_FAILURE);
    1249             :     }
    1250           6 : }
    1251             : 
    1252             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10