OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
DbaAbstract.hpp
Go to the documentation of this file.
1#ifndef __OPENTREP_COM_DBA_DBAABSTRACT_HPP
2#define __OPENTREP_COM_DBA_DBAABSTRACT_HPP
3
4// //////////////////////////////////////////////////////////////////////
5// Import section
6// //////////////////////////////////////////////////////////////////////
7// STL
8#include <iostream>
9#include <sstream>
10
11namespace OPENTREP {
12
15 public:
16
18 virtual ~DbaAbstract() {}
19
22 virtual void toStream (std::ostream& ioOut) const {}
23
26 virtual void fromStream (std::istream& ioIn) {}
27
28 protected:
31 };
32}
33
39template <class charT, class traits>
40inline
41std::basic_ostream<charT, traits>&
42operator<< (std::basic_ostream<charT, traits>& ioOut,
43 const OPENTREP::DbaAbstract& iDba) {
49 std::basic_ostringstream<charT,traits> ostr;
50 ostr.copyfmt (ioOut);
51 ostr.width (0);
52
53 // Fill string stream
54 iDba.toStream (ostr);
55
56 // Print string stream
57 ioOut << ostr.str();
58
59 return ioOut;
60}
61
67template <class charT, class traits>
68inline
69std::basic_istream<charT, traits>&
70operator>> (std::basic_istream<charT, traits>& ioIn,
71 OPENTREP::DbaAbstract& ioDba) {
72 // Fill Dba object with input stream
73 ioDba.fromStream (ioIn);
74 return ioIn;
75}
76
77#endif // __OPENTREP_COM_DBA_DBAABSTRACT_HPP
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const OPENTREP::DbaAbstract &iDba)
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, OPENTREP::DbaAbstract &ioDba)
virtual void toStream(std::ostream &ioOut) const
virtual void fromStream(std::istream &ioIn)