StdAir Logo  1.00.0
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DbaAbstract.hpp
Go to the documentation of this file.
1 #ifndef __STDAIR_DBA_DBAABSTRACT_HPP
2 #define __STDAIR_DBA_DBAABSTRACT_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 
10 namespace stdair {
11 
13  class DbaAbstract {
14  public:
15 
17  virtual ~DbaAbstract() {}
18 
21  virtual void toStream (std::ostream& ioOut) const {}
22 
25  virtual void fromStream (std::istream& ioIn) {}
26 
27  protected:
30  };
31 }
32 
38 template <class charT, class traits>
39 inline
40 std::basic_ostream<charT, traits>&
41 operator<< (std::basic_ostream<charT, traits>& ioOut,
42  const stdair::DbaAbstract& iDba) {
48  std::basic_ostringstream<charT,traits> ostr;
49  ostr.copyfmt (ioOut);
50  ostr.width (0);
51 
52  // Fill string stream
53  iDba.toStream (ostr);
54 
55  // Print string stream
56  ioOut << ostr.str();
57 
58  return ioOut;
59 }
60 
66 template <class charT, class traits>
67 inline
68 std::basic_istream<charT, traits>&
69 operator>> (std::basic_istream<charT, traits>& ioIn,
70  stdair::DbaAbstract& ioDba) {
71  // Fill Dba object with input stream
72  ioDba.fromStream (ioIn);
73  return ioIn;
74 }
75 
76 #endif // __STDAIR_DBA_DBAABSTRACT_HPP