diff options
author | Michi Henning <michi@zeroc.com> | 2005-09-08 03:39:54 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-09-08 03:39:54 +0000 |
commit | 7f7978740f36b0c44abede9e799c4dc6d1a22cfd (patch) | |
tree | d0eaaa658fd08238742f777502b880385ee6f4d0 /cpp/src/slice2cppe/Gen.cpp | |
parent | More changes for bug 355. (diff) | |
download | ice-7f7978740f36b0c44abede9e799c4dc6d1a22cfd.tar.bz2 ice-7f7978740f36b0c44abede9e799c4dc6d1a22cfd.tar.xz ice-7f7978740f36b0c44abede9e799c4dc6d1a22cfd.zip |
Fixed for 355, updated version to 3.0.0.
Diffstat (limited to 'cpp/src/slice2cppe/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 5808126ef91..0e160b0c096 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -187,40 +187,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()) { @@ -325,7 +293,9 @@ Slice::Gen::generate(const UnitPtr& p) } implH << _base << ".h>"; - implC << "#include <"; + writeExtraHeaders(implC); + + implC << "\n#include <"; if(_include.size()) { implC << _include << '/'; @@ -337,6 +307,37 @@ Slice::Gen::generate(const UnitPtr& p) } } +void +Slice::Gen::writeExtraHeaders(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) : H(h), C(c), _dllExport(dllExport), _doneStaticSymbol(false) { |