diff options
author | Michi Henning <michi@zeroc.com> | 2005-09-08 03:36:43 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-09-08 03:36:43 +0000 |
commit | 10c2e04dbe255db6de2de65fbb80d332abdc0d54 (patch) | |
tree | 94c638b7666674dc050d693297710a7791982c87 /cpp/src/slice2cpp/Gen.cpp | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=353 (diff) | |
download | ice-10c2e04dbe255db6de2de65fbb80d332abdc0d54.tar.bz2 ice-10c2e04dbe255db6de2de65fbb80d332abdc0d54.tar.xz ice-10c2e04dbe255db6de2de65fbb80d332abdc0d54.zip |
More changes for bug 355.
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 953714d572f..0691a80505c 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -169,40 +169,8 @@ Slice::Gen::generate(const UnitPtr& p) { validateMetaData(p); - // - // Output additional header includes first. - // - vector<string>::const_iterator i; - for(i = _extraHeaders.begin(); i != _extraHeaders.end(); ++i) - { - string hdr = *i; - string guard; - string::size_type pos = hdr.rfind(','); - if(pos != string::npos) - { - hdr = i->substr(0, pos); - guard = i->substr(pos + 1); - } - if(!guard.empty()) - { - C << "\n#ifndef " << guard; - C << "\n#define " << guard; - } - C << "\n#include <"; - if(!_include.empty()) - { - C << _include << '/'; - } - C << hdr << '>'; - if(!guard.empty()) - { - C << "\n#endif"; - } - } + writeExtraHeaders(C); - // - // Output remaining includes. - // C << "\n#include <"; if(_include.size()) { @@ -338,7 +306,9 @@ Slice::Gen::generate(const UnitPtr& p) } implH << _base << ".h>"; - implC << "#include <"; + writeExtraHeaders(implC); + + implC << "\n#include <"; if(_include.size()) { implC << _include << '/'; @@ -375,6 +345,37 @@ Slice::Gen::generate(const UnitPtr& p) } } +void +Slice::Gen::writeExtraHeaders(IceUtil::Output& out) +{ + for(vector<string>::const_iterator i = _extraHeaders.begin(); i != _extraHeaders.end(); ++i) + { + string hdr = *i; + string guard; + string::size_type pos = hdr.rfind(','); + if(pos != string::npos) + { + hdr = i->substr(0, pos); + guard = i->substr(pos + 1); + } + if(!guard.empty()) + { + out << "\n#ifndef " << guard; + out << "\n#define " << guard; + } + out << "\n#include <"; + if(!_include.empty()) + { + out << _include << '/'; + } + out << hdr << '>'; + if(!guard.empty()) + { + out << "\n#endif"; + } + } +} + Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport, bool stream) : H(h), C(c), _dllExport(dllExport), _stream(stream), _doneStaticSymbol(false) { |