0.08.01
C++ Open Travel Request Parsing Library
Toggle main menu visibility
Loading...
Searching...
No Matches
StructAbstract.hpp
Go to the documentation of this file.
1
#ifndef __OPENTREP_BAS_STRUCTABSTRACT_HPP
2
#define __OPENTREP_BAS_STRUCTABSTRACT_HPP
3
4
// //////////////////////////////////////////////////////////////////////
5
// Import section
6
// //////////////////////////////////////////////////////////////////////
7
// STL
8
#include <iosfwd>
9
#include <string>
10
11
namespace
OPENTREP
{
12
16
struct
StructAbstract
{
17
public
:
18
22
virtual
~StructAbstract
() {}
23
29
void
toStream
(std::ostream& ioOut)
const
{
30
ioOut <<
describe
();
31
}
32
38
virtual
void
fromStream
(std::istream& ioIn) {}
39
45
virtual
std::string
describe
()
const
= 0;
46
47
protected
:
51
StructAbstract
() {}
52
};
53
}
54
60
template
<
class
char
T,
class
traits>
61
inline
62
std::basic_ostream<charT, traits>&
63
operator<<
(std::basic_ostream<charT, traits>& ioOut,
64
const
OPENTREP::StructAbstract
& iStruct) {
70
std::basic_ostringstream<charT,traits> ostr;
71
ostr.copyfmt (ioOut);
72
ostr.width (0);
73
74
// Fill string stream
75
iStruct.
toStream
(ostr);
76
77
// Print string stream
78
ioOut << ostr.str();
79
80
return
ioOut;
81
}
82
88
template
<
class
char
T,
class
traits>
89
inline
90
std::basic_istream<charT, traits>&
91
operator>>
(std::basic_istream<charT, traits>& ioIn,
92
OPENTREP::StructAbstract
& ioStruct) {
93
// Fill the Structure object with the input stream.
94
ioStruct.
fromStream
(ioIn);
95
return
ioIn;
96
97
}
98
#endif
// __OPENTREP_BAS_STRUCTABSTRACT_HPP
operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, OPENTREP::StructAbstract &ioStruct)
Definition
StructAbstract.hpp:91
operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const OPENTREP::StructAbstract &iStruct)
Definition
StructAbstract.hpp:63
OPENTREP
Definition
BasChronometer.cpp:10
OPENTREP::StructAbstract
Base class for the light structures.
Definition
StructAbstract.hpp:16
OPENTREP::StructAbstract::~StructAbstract
virtual ~StructAbstract()
Definition
StructAbstract.hpp:22
OPENTREP::StructAbstract::StructAbstract
StructAbstract()
Definition
StructAbstract.hpp:51
OPENTREP::StructAbstract::toStream
void toStream(std::ostream &ioOut) const
Definition
StructAbstract.hpp:29
OPENTREP::StructAbstract::describe
virtual std::string describe() const =0
OPENTREP::StructAbstract::fromStream
virtual void fromStream(std::istream &ioIn)
Definition
StructAbstract.hpp:38
Generated on
for OpenTREP by
1.17.0