diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-09-18 13:35:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-09-18 13:39:11 +0200 |
commit | e3172bbaa08e6a097b0503860b2f4c60e5cc23be (patch) | |
tree | bb68e6af51d99eaa103ed6fcb0bcdfc28ba18cad /unoidl/source/unoidl-read.cxx | |
parent | 01a17e01d2f262a01cc87bb26fa2cd4a58e7cb07 (diff) |
Some fixes of the generated .idl output
Change-Id: I2d71e148f302ebfbf8d0fbfc74a7fb523b7bfcd4
Diffstat (limited to 'unoidl/source/unoidl-read.cxx')
-rw-r--r-- | unoidl/source/unoidl-read.cxx | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/unoidl/source/unoidl-read.cxx b/unoidl/source/unoidl-read.cxx index f9c538b3d3cb..2d3d00ffe3e0 100644 --- a/unoidl/source/unoidl-read.cxx +++ b/unoidl/source/unoidl-read.cxx @@ -432,11 +432,14 @@ void indent(std::vector<OUString> const & modules, unsigned int extra = 0) { } } -void closeModule(std::vector<OUString> & modules) { - assert(!modules.empty()); - modules.pop_back(); - indent(modules); - std::cout << "};\n"; +void closeModules( + std::vector<OUString> & modules, std::vector<OUString>::size_type n) { + for (std::vector<OUString>::size_type i = 0; i != n; ++i) { + assert(!modules.empty()); + modules.pop_back(); + indent(modules); + std::cout << "};\n"; + } } OUString openModulesFor(std::vector<OUString> & modules, OUString const & name) @@ -445,6 +448,10 @@ OUString openModulesFor(std::vector<OUString> & modules, OUString const & name) for (sal_Int32 j = 0;;) { OUString id(name.getToken(0, '.', j)); if (j == -1) { + closeModules( + modules, + static_cast< std::vector<OUString>::size_type >( + modules.end() - i)); indent(modules); return id; } @@ -453,11 +460,10 @@ OUString openModulesFor(std::vector<OUString> & modules, OUString const & name) ++i; continue; } - std::vector<OUString>::difference_type n = modules.end() - i; - assert(n > 0); - for (std::vector<OUString>::difference_type k = 0; k != n; ++k) { - closeModule(modules); - } + closeModules( + modules, + static_cast< std::vector<OUString>::size_type >( + modules.end() - i)); i = modules.end(); } indent(modules); @@ -785,7 +791,7 @@ void writeEntity( writeAnnotationsPublished(ent); std::cout << "typedef "; writeType(ent2->getType()); - std::cout << id << ";\n"; + std::cout << ' ' << id << ";\n"; break; } case unoidl::Entity::SORT_CONSTANT_GROUP: @@ -839,7 +845,7 @@ void writeEntity( std::cout << (j->value.booleanValue ? "TRUE" : "FALSE"); break; case unoidl::ConstantValue::TYPE_BYTE: - std::cout << j->value.byteValue; + std::cout << int(j->value.byteValue); break; case unoidl::ConstantValue::TYPE_SHORT: std::cout << j->value.shortValue; @@ -1093,9 +1099,7 @@ SAL_IMPLEMENT_MAIN() { { writeEntity(ents, mods, *i); } - while (!mods.empty()) { - closeModule(mods); - } + closeModules(mods, mods.size()); return EXIT_SUCCESS; } catch (unoidl::FileFormatException & e1) { std::cerr |