OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BomAbstract.hpp
Go to the documentation of this file.
1 #ifndef __OPENTREP_BOM_BOMABSTRACT_HPP
2 #define __OPENTREP_BOM_BOMABSTRACT_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 #include <sstream>
10 #include <string>
11 
12 namespace OPENTREP {
13 
17  class BomAbstract {
18  friend class FacBomAbstract;
19  public:
20  // /////////// Display support methods /////////
26  virtual void toStream (std::ostream&) const = 0;
27 
33  virtual void fromStream (std::istream&) = 0;
34 
38  virtual std::string toString() const = 0;
39 
44  virtual std::string describeKey() const = 0;
45 
50  virtual std::string describeShortKey() const = 0;
51 
52 
53  protected:
59 
63  virtual ~BomAbstract() {}
64  };
65 }
66 
72 template <class charT, class traits>
73 inline
74 std::basic_ostream<charT, traits>&
75 operator<< (std::basic_ostream<charT, traits>& ioOut,
76  const OPENTREP::BomAbstract& iBom) {
82  std::basic_ostringstream<charT,traits> ostr;
83  ostr.copyfmt (ioOut);
84  ostr.width (0);
85 
86  // Fill string stream
87  iBom.toStream (ostr);
88 
89  // Print string stream
90  ioOut << ostr.str();
91 
92  return ioOut;
93 }
94 
100 template <class charT, class traits>
101 inline
102 std::basic_istream<charT, traits>&
103 operator>> (std::basic_istream<charT, traits>& ioIn,
104  OPENTREP::BomAbstract& ioBom) {
105  // Fill Bom object with input stream
106  ioBom.fromStream (ioIn);
107  return ioIn;
108 }
109 
110 #endif // __OPENTREP_BOM_BOMABSTRACT_HPP
BomAbstract(const BomAbstract &)
Definition: BomAbstract.hpp:58
virtual std::string describeShortKey() const =0
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, OPENTREP::BomAbstract &ioBom)
virtual std::string describeKey() const =0
virtual std::string toString() const =0
virtual void toStream(std::ostream &) const =0
virtual void fromStream(std::istream &)=0
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:17