StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
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
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, stdair::DbaAbstract &ioDba)
Definition: DbaAbstract.hpp:69
Handle on the StdAir library context.
virtual void toStream(std::ostream &ioOut) const
Definition: DbaAbstract.hpp:21
virtual void fromStream(std::istream &ioIn)
Definition: DbaAbstract.hpp:25
virtual ~DbaAbstract()
Definition: DbaAbstract.hpp:17