0.08.01
C++ Open Travel Request Parsing Library
Toggle main menu visibility
Loading...
Searching...
No Matches
OPENTREP_Abstract.hpp
Go to the documentation of this file.
1
#ifndef __OPENTREP_OPENTREP_ABSTRACT_HPP
2
#define __OPENTREP_OPENTREP_ABSTRACT_HPP
3
4
// //////////////////////////////////////////////////////////////////////
5
// Import section
6
// //////////////////////////////////////////////////////////////////////
7
// STL
8
#include <iosfwd>
9
#include <string>
10
11
namespace
OPENTREP
{
12
16
struct
OPENTREP_Abstract
{
17
public
:
18
// /////////// Display support methods /////////
24
virtual
void
toStream
(std::ostream& ioOut)
const
= 0;
25
31
virtual
void
fromStream
(std::istream& ioIn) = 0;
32
36
virtual
std::string
toString
()
const
= 0;
37
38
39
protected
:
43
OPENTREP_Abstract
() {}
44
OPENTREP_Abstract
(
const
OPENTREP_Abstract
&) {}
45
49
virtual
~OPENTREP_Abstract
() {}
50
};
51
}
52
58
template
<
class
char
T,
class
traits>
59
inline
60
std::basic_ostream<charT, traits>&
61
operator<<
(std::basic_ostream<charT, traits>& ioOut,
62
const
OPENTREP::OPENTREP_Abstract
& iStructure) {
68
std::basic_ostringstream<charT,traits> ostr;
69
ostr.copyfmt (ioOut);
70
ostr.width (0);
71
72
// Fill string stream
73
iStructure.
toStream
(ostr);
74
75
// Print string stream
76
ioOut << ostr.str();
77
78
return
ioOut;
79
}
80
86
template
<
class
char
T,
class
traits>
87
inline
88
std::basic_istream<charT, traits>&
89
operator>>
(std::basic_istream<charT, traits>& ioIn,
90
OPENTREP::OPENTREP_Abstract
& ioStucture) {
91
// Fill Bom object with input stream
92
ioStucture.
fromStream
(ioIn);
93
return
ioIn;
94
}
95
96
#endif
// __OPENTREP_OPENTREP_ABSTRACT_HPP
operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const OPENTREP::OPENTREP_Abstract &iStructure)
Definition
OPENTREP_Abstract.hpp:61
operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, OPENTREP::OPENTREP_Abstract &ioStucture)
Definition
OPENTREP_Abstract.hpp:89
OPENTREP
Definition
BasChronometer.cpp:10
OPENTREP::OPENTREP_Abstract
Definition
OPENTREP_Abstract.hpp:16
OPENTREP::OPENTREP_Abstract::~OPENTREP_Abstract
virtual ~OPENTREP_Abstract()
Definition
OPENTREP_Abstract.hpp:49
OPENTREP::OPENTREP_Abstract::toString
virtual std::string toString() const =0
OPENTREP::OPENTREP_Abstract::toStream
virtual void toStream(std::ostream &ioOut) const =0
OPENTREP::OPENTREP_Abstract::OPENTREP_Abstract
OPENTREP_Abstract()
Definition
OPENTREP_Abstract.hpp:43
OPENTREP::OPENTREP_Abstract::fromStream
virtual void fromStream(std::istream &ioIn)=0
OPENTREP::OPENTREP_Abstract::OPENTREP_Abstract
OPENTREP_Abstract(const OPENTREP_Abstract &)
Definition
OPENTREP_Abstract.hpp:44
Generated on
for OpenTREP by
1.17.0