Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* @file api.OutStream.hpp |
3 |
|
|
* @author Sergey Baigudin, sergey@baigudin.software |
4 |
|
|
* @copyright 2017-2022, Sergey Baigudin, Baigudin Software |
5 |
|
|
*/ |
6 |
|
|
#ifndef API_OUTSTREAM_HPP_ |
7 |
|
|
#define API_OUTSTREAM_HPP_ |
8 |
|
|
|
9 |
|
|
#include "api.Object.hpp" |
10 |
|
|
#include "api.String.hpp" |
11 |
|
|
|
12 |
|
|
namespace eoos |
13 |
|
|
{ |
14 |
|
|
namespace api |
15 |
|
|
{ |
16 |
|
|
|
17 |
|
|
/** |
18 |
|
|
* @class OutStream<T> |
19 |
|
|
* @brief Output stream interface. |
20 |
|
|
* |
21 |
|
|
* @tparam T Data type to output. |
22 |
|
|
*/ |
23 |
|
|
template <typename T> |
24 |
|
|
class OutStream : public Object |
25 |
|
|
{ |
26 |
|
|
|
27 |
|
|
public: |
28 |
|
|
|
29 |
|
|
/** |
30 |
|
|
* @brief Destructor. |
31 |
|
|
*/ |
32 |
|
|
virtual ~OutStream() = 0; |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
* @brief Writes to an output stream. |
36 |
|
|
* |
37 |
|
|
* @param source A source character string to be output. |
38 |
|
|
* @return This interface. |
39 |
|
|
*/ |
40 |
|
|
virtual OutStream<T>& operator<<(T const* source) = 0; |
41 |
|
|
|
42 |
|
|
/** |
43 |
|
|
* @brief Flushes buffered data to a storage device. |
44 |
|
|
* |
45 |
|
|
* @return This interface. |
46 |
|
|
*/ |
47 |
|
|
virtual OutStream<T>& flush() = 0; |
48 |
|
|
|
49 |
|
|
}; |
50 |
|
|
|
51 |
|
|
template <typename T> ///< SCA MISRA-C++:2008 Defected Rule 7-3-1 |
52 |
|
736 |
inline OutStream<T>::~OutStream() {} |
53 |
|
|
|
54 |
|
|
} // namespace api |
55 |
|
|
} // namespace eoos |
56 |
|
|
#endif // API_OUT_STREAM_HPP_ |
57 |
|
|
|