diff options
Diffstat (limited to 'cpp/src/Slice/Util.cpp')
-rw-r--r-- | cpp/src/Slice/Util.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cpp/src/Slice/Util.cpp b/cpp/src/Slice/Util.cpp index 5ddd8c6c8b9..cacad7217f0 100644 --- a/cpp/src/Slice/Util.cpp +++ b/cpp/src/Slice/Util.cpp @@ -395,3 +395,38 @@ Slice::printGeneratedHeader(IceUtilInternal::Output& out, const string& path, co out << comment << " </auto-generated>\n"; out << comment << "\n"; } + +Slice::DependOutputUtil::DependOutputUtil(string& file) : _file(file) +{ + if(!_file.empty()) + { + _os.open(file, ios::out); + } +} + +Slice::DependOutputUtil::~DependOutputUtil() +{ + if(!_file.empty() && _os.is_open()) + { + _os.close(); + } +} + +void +Slice::DependOutputUtil::cleanup() +{ + if(!_file.empty()) + { + if(_os.is_open()) + { + _os.close(); + } + IceUtilInternal::unlink(_file); + } +} + +ostream& +Slice::DependOutputUtil::os() +{ + return _file.empty() ? cout : _os; +} |