OpenTREP Logo  0.07.4
C++ Open Travel Request Parsing Library
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
OPENTREP::BomAbstract::describeKey
virtual std::string describeKey() const =0
OPENTREP::BomAbstract::toStream
virtual void toStream(std::ostream &) const =0
operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &ioIn, OPENTREP::BomAbstract &ioBom)
Definition: BomAbstract.hpp:103
OPENTREP::BomAbstract::toString
virtual std::string toString() const =0
OPENTREP::BomAbstract::fromStream
virtual void fromStream(std::istream &)=0
OPENTREP::BomAbstract::describeShortKey
virtual std::string describeShortKey() const =0
OPENTREP
Definition: BasChronometer.cpp:10
OPENTREP::BomAbstract::~BomAbstract
virtual ~BomAbstract()
Definition: BomAbstract.hpp:63
OPENTREP::FacBomAbstract
Definition: FacBomAbstract.hpp:17
OPENTREP::BomAbstract
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:17
OPENTREP::BomAbstract::BomAbstract
BomAbstract()
Definition: BomAbstract.hpp:57
operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &ioOut, const OPENTREP::BomAbstract &iBom)
Definition: BomAbstract.hpp:75
OPENTREP::BomAbstract::BomAbstract
BomAbstract(const BomAbstract &)
Definition: BomAbstract.hpp:58