$treeview $search $mathjax
00001 00007 #ifndef __STDAIR_BOM_KEYABSTRACT_HPP 00008 #define __STDAIR_BOM_KEYABSTRACT_HPP 00009 00010 // ////////////////////////////////////////////////////////////////////// 00011 // Import section 00012 // ////////////////////////////////////////////////////////////////////// 00013 // STL 00014 #include <iosfwd> 00015 #include <string> 00016 00017 namespace stdair { 00018 00027 struct KeyAbstract { 00028 public: 00029 00030 // /////////// Display support methods ///////// 00036 virtual void toStream (std::ostream& ioOut) const {} 00037 00043 virtual void fromStream (std::istream& ioIn) {} 00044 00056 virtual const std::string toString() const { return std::string("Hello!"); } 00057 00061 virtual ~KeyAbstract() {} 00062 }; 00063 00064 } 00065 00071 template <class charT, class traits> 00072 inline 00073 std::basic_ostream<charT, traits>& 00074 operator<< (std::basic_ostream<charT, traits>& ioOut, 00075 const stdair::KeyAbstract& iKey) { 00081 std::basic_ostringstream<charT,traits> ostr; 00082 ostr.copyfmt (ioOut); 00083 ostr.width (0); 00084 00085 // Fill string stream 00086 iKey.toStream (ostr); 00087 00088 // Print string stream 00089 ioOut << ostr.str(); 00090 00091 return ioOut; 00092 } 00093 00099 template <class charT, class traits> 00100 inline 00101 std::basic_istream<charT, traits>& 00102 operator>> (std::basic_istream<charT, traits>& ioIn, 00103 stdair::KeyAbstract& ioKey) { 00104 // Fill Key object with input stream 00105 ioKey.fromStream (ioIn); 00106 return ioIn; 00107 } 00108 00109 #endif // __STDAIR_BOM_KEYABSTRACT_HPP