Go to the documentation of this file.00001
00007 #ifndef __STDAIR_BOM_KEYABSTRACT_HPP
00008 #define __STDAIR_BOM_KEYABSTRACT_HPP
00009
00010
00011
00012
00013
00014 #include <iosfwd>
00015 #include <string>
00016
00017 namespace stdair {
00018
00026 struct KeyAbstract {
00027 public:
00028
00029
00034 virtual void toStream (std::ostream& ioOut) const {}
00035
00040 virtual void fromStream (std::istream& ioIn) {}
00041
00051 virtual const std::string toString() const { return std::string("Hello!"); }
00052
00056 virtual ~KeyAbstract() {}
00057 };
00058
00059 }
00060
00066 template <class charT, class traits>
00067 inline
00068 std::basic_ostream<charT, traits>&
00069 operator<< (std::basic_ostream<charT, traits>& ioOut,
00070 const stdair::KeyAbstract& iKey) {
00076 std::basic_ostringstream<charT,traits> ostr;
00077 ostr.copyfmt (ioOut);
00078 ostr.width (0);
00079
00080
00081 iKey.toStream (ostr);
00082
00083
00084 ioOut << ostr.str();
00085
00086 return ioOut;
00087 }
00088
00094 template <class charT, class traits>
00095 inline
00096 std::basic_istream<charT, traits>&
00097 operator>> (std::basic_istream<charT, traits>& ioIn,
00098 stdair::KeyAbstract& ioKey) {
00099
00100 ioKey.fromStream (ioIn);
00101 return ioIn;
00102 }
00103
00104 #endif // __STDAIR_BOM_KEYABSTRACT_HPP