Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JAbstractIO.hh
Go to the documentation of this file.
1#ifndef __JLANG__JABSTRACTIO__
2#define __JLANG__JABSTRACTIO__
3
4#include <istream>
5#include <ostream>
6
7
8/**
9 * \author mdejong
10 */
11
12namespace JLANG {}
13namespace JPP { using namespace JLANG; }
14
15namespace JLANG {
16
17
18 /**
19 * Interface for ASCII input using standard streams.
20 */
22 public:
23 /**
24 * Virtual destructor.
25 */
26 virtual ~JStreamInput()
27 {}
28
29
30 /**
31 * Stream input.
32 *
33 * \param in input stream
34 * \return input stream
35 */
36 virtual std::istream& read(std::istream& in) = 0;
37
38
39 /**
40 * Read object from input.
41 *
42 * \param in input stream
43 * \param object object
44 * \return input stream
45 */
46 friend inline std::istream& operator>>(std::istream& in, JStreamInput& object)
47 {
48 return object.read(in);
49 }
50 };
51
52
53 /**
54 * Interface for ASCII output using standard streams.
55 */
57 public:
58 /**
59 * Virtual destructor.
60 */
62 {}
63
64
65 /**
66 * Stream output.
67 *
68 * \param out output stream
69 * \return output stream
70 */
71 virtual std::ostream& write(std::ostream& out) const = 0;
72
73
74 /**
75 * Write object to output.
76 *
77 * \param out output stream
78 * \param object object
79 * \return output stream
80 */
81 friend inline std::ostream& operator<<(std::ostream& out, const JStreamOutput& object)
82 {
83 return object.write(out);
84 }
85 };
86
87
88 /**
89 * Interface for ASCII output with prefix and postfix using standard streams.
90 */
92 public:
93 /**
94 * Virtual destructor.
95 */
97 {}
98
99
100 /**
101 * Stream output.
102 *
103 * \param out output stream
104 * \param prefix prefix
105 * \param postfix postfix
106 * \return output stream
107 */
108 virtual std::ostream& write(std::ostream& out,
109 const char* prefix,
110 const char postfix) const = 0;
111 };
112}
113
114#endif
Interface for ASCII input using standard streams.
virtual ~JStreamInput()
Virtual destructor.
friend std::istream & operator>>(std::istream &in, JStreamInput &object)
Read object from input.
virtual std::istream & read(std::istream &in)=0
Stream input.
Interface for ASCII output using standard streams.
virtual ~JStreamOutput()
Virtual destructor.
virtual std::ostream & write(std::ostream &out) const =0
Stream output.
friend std::ostream & operator<<(std::ostream &out, const JStreamOutput &object)
Write object to output.
Interface for ASCII output with prefix and postfix using standard streams.
virtual std::ostream & write(std::ostream &out, const char *prefix, const char postfix) const =0
Stream output.
virtual ~JStreamSuffixOutput()
Virtual destructor.
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).