OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
KeyAbstract.hpp
Go to the documentation of this file.
1#ifndef __OPENTREP_KEY_KEYABSTRACT_HPP
2#define __OPENTREP_KEY_KEYABSTRACT_HPP
3
4// //////////////////////////////////////////////////////////////////////
5// Import section
6// //////////////////////////////////////////////////////////////////////
7// STL
8#include <iosfwd>
9#include <sstream>
10#include <string>
11
12namespace OPENTREP {
13
18 public:
19 // /////////// Display support methods /////////
25 virtual void toStream (std::ostream&) const = 0;
26
32 virtual void fromStream (std::istream&) = 0;
33
37 virtual std::string toString() const = 0;
38
43 virtual std::string describe() const = 0;
44
45
46 protected:
52
56 virtual ~KeyAbstract() {}
57 };
58}
59
65template <class charT, class traits>
66inline
67std::basic_ostream<charT, traits>&
68operator<< (std::basic_ostream<charT, traits>& ioOut,
69 const OPENTREP::KeyAbstract& iKey) {
75 std::basic_ostringstream<charT,traits> ostr;
76 ostr.copyfmt (ioOut);
77 ostr.width (0);
78
79 // Fill string stream
80 iKey.toStream (ostr);
81
82 // Print string stream
83 ioOut << ostr.str();
84
85 return ioOut;
86}
87
93template <class charT, class traits>
94inline
95std::basic_istream<charT, traits>&
96operator>> (std::basic_istream<charT, traits>& ioIn,
97 OPENTREP::KeyAbstract& ioKey) {
98 // Fill Key object with input stream
99 ioKey.fromStream (ioIn);
100 return ioIn;
101}
102
103#endif // __OPENTREP_KEY_KEYABSTRACT_HPP
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, OPENTREP::KeyAbstract &ioKey)
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const OPENTREP::KeyAbstract &iKey)
Base class for the Business Object Model (KEY) layer.
KeyAbstract(const KeyAbstract &)
virtual void toStream(std::ostream &) const =0
virtual void fromStream(std::istream &)=0
virtual std::string toString() const =0
virtual std::string describe() const =0