diff options
author | Michi Henning <michi@zeroc.com> | 2005-09-07 06:44:51 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-09-07 06:44:51 +0000 |
commit | 874a4e56e2a34579267eb9f1a01a56106b6bc37a (patch) | |
tree | df8d5800be0d94e794d171b65b6f34966ef6999b /cpp/src/slice2cppe/Gen.cpp | |
parent | Bug 355 (diff) | |
download | ice-874a4e56e2a34579267eb9f1a01a56106b6bc37a.tar.bz2 ice-874a4e56e2a34579267eb9f1a01a56106b6bc37a.tar.xz ice-874a4e56e2a34579267eb9f1a01a56106b6bc37a.zip |
Bug 355.
Diffstat (limited to 'cpp/src/slice2cppe/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 281dce591c4..5808126ef91 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -42,11 +42,12 @@ getIds(const ClassDefPtr& p, StringList& ids) } Slice::Gen::Gen(const string& name, const string& base, const string& headerExtension, - const string& sourceExtension, const string& include, const vector<string>& includePaths, - const string& dllExport, const string& dir, bool imp) : + const string& sourceExtension, const vector<string>& extraHeaders, const string& include, + const vector<string>& includePaths, const string& dllExport, const string& dir, bool imp) : _base(base), _headerExtension(headerExtension), _sourceExtension(sourceExtension), + _extraHeaders(extraHeaders), _include(include), _includePaths(includePaths), _dllExport(dllExport), @@ -186,6 +187,40 @@ 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"; + } + } + + // + // Output remaining includes. + // C << "\n#include <"; if(_include.size()) { |