StdAir Logo  1.00.18
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
KeyAbstract.hpp
Go to the documentation of this file.
7#ifndef __STDAIR_BOM_KEYABSTRACT_HPP
8#define __STDAIR_BOM_KEYABSTRACT_HPP
9
10// //////////////////////////////////////////////////////////////////////
11// Import section
12// //////////////////////////////////////////////////////////////////////
13// STL
14#include <iosfwd>
15#include <string>
16
17namespace stdair {
18
27 struct KeyAbstract {
28 public:
29
30 // /////////// Display support methods /////////
36 virtual void toStream (std::ostream& ioOut) const {}
37
43 virtual void fromStream (std::istream& ioIn) {}
44
56 virtual const std::string toString() const { return std::string("Hello!"); }
57
61 virtual ~KeyAbstract() {}
62 };
63
64}
65
71template <class charT, class traits>
72inline
73std::basic_ostream<charT, traits>&
74operator<< (std::basic_ostream<charT, traits>& ioOut,
75 const stdair::KeyAbstract& iKey) {
81 std::basic_ostringstream<charT,traits> ostr;
82 ostr.copyfmt (ioOut);
83 ostr.width (0);
84
85 // Fill string stream
86 iKey.toStream (ostr);
87
88 // Print string stream
89 ioOut << ostr.str();
90
91 return ioOut;
92}
93
99template <class charT, class traits>
100inline
101std::basic_istream<charT, traits>&
102operator>> (std::basic_istream<charT, traits>& ioIn,
103 stdair::KeyAbstract& ioKey) {
104 // Fill Key object with input stream
105 ioKey.fromStream (ioIn);
106 return ioIn;
107}
108
109#endif // __STDAIR_BOM_KEYABSTRACT_HPP
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, stdair::KeyAbstract &ioKey)
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const stdair::KeyAbstract &iKey)
Handle on the StdAir library context.
Base class for the keys of Business Object Model (BOM) layer.
virtual void fromStream(std::istream &ioIn)
Read a Business Object Key from an input stream.
virtual const std::string toString() const
Get the serialised version of the Business Object Key.
virtual ~KeyAbstract()
Default destructor.
virtual void toStream(std::ostream &ioOut) const
Dump a Business Object Key into an output stream.