00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _SK_UTIL_STREAMLINER_H_
00012 #define _SK_UTIL_STREAMLINER_H_
00013
00014 #include <sk/util/Object.h>
00015 #include <ostream>
00016
00017 namespace sk {
00018 namespace util {
00019 class StreamLiner
00020 {
00021 public:
00022 StreamLiner(std::ostream& stream)
00023 : _stream(stream), _utilized(false) {}
00024
00025 ~StreamLiner() {
00026 if(_utilized) {
00027 _stream << std::endl;
00028 }
00029 }
00030
00031 template<typename T> const StreamLiner& operator<<(T object) const {
00032 _stream << object;
00033 _utilized = true;
00034 return *this;
00035 }
00036
00037 private:
00038 std::ostream& _stream;
00039 mutable bool _utilized;
00040 };
00041 }
00042 }
00043
00044 #endif