Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
include
ecl
streams
file_streams.hpp
Go to the documentation of this file.
1
8
/*****************************************************************************
9
** Ifdefs
10
*****************************************************************************/
11
12
#ifndef ECL_STREAMS_FILE_STREAM_HPP_
13
#define ECL_STREAMS_FILE_STREAM_HPP_
14
15
/*****************************************************************************
16
** Includes
17
*****************************************************************************/
18
19
#include <string>
20
#include <ecl/config/macros.hpp>
21
#include <ecl/devices/ofile.hpp>
22
#include <ecl/exceptions/standard_exception.hpp>
23
#include "
text_stream.hpp
"
24
25
/*****************************************************************************
26
** Namespaces
27
*****************************************************************************/
28
29
namespace
ecl
{
30
31
/*****************************************************************************
32
** Interfaces [OFileStream]
33
*****************************************************************************/
42
class
ecl_streams_PUBLIC
OFileStream
:
public
TextStream
<OFile> {
43
public
:
50
OFileStream
() {};
51
63
OFileStream
(
const
std::string &file_name,
const
WriteMode
&mode =
New
)
ecl_throw_decl
(
StandardException
) {
64
ecl_try
{
65
if
( !this->device().open(file_name, mode) ) {
66
error = this->device().error();
67
}
68
}
ecl_catch
(StandardException &e) {
69
ecl_throw
(StandardException(
LOC
,e));
70
}
71
}
72
73
virtual
~OFileStream
() {};
74
};
75
76
}
// namespace ecl
77
78
#endif
/* ECL_STREAMS_FILE_STREAM_HPP_ */
ecl::OFileStream::OFileStream
OFileStream()
Default constructor, underlying device must be manually opened.
Definition:
file_streams.hpp:50
ecl
ecl::WriteMode
WriteMode
ecl_throw
#define ecl_throw(exception)
Standard ecl throw exception throw.
Definition:
ecl/exceptions/macros.hpp:74
ecl_throw_decl
#define ecl_throw_decl(exception)
Standard ecl throw exception declaration.
Definition:
ecl/exceptions/macros.hpp:64
LOC
#define LOC
Stringify the line of code you are at.
Definition:
ecl/errors/macros.hpp:67
ecl::StandardException
Standard exception type, provides code location and error string.
Definition:
standard_exception.hpp:54
ecl::OFileStream::~OFileStream
virtual ~OFileStream()
Definition:
file_streams.hpp:73
text_stream.hpp
Convenience header for various text streams.
ecl::TextStream
A text streaming interface.
Definition:
text_stream.hpp:94
ecl::OFileStream::OFileStream
OFileStream(const std::string &file_name, const WriteMode &mode=New) ecl_throw_decl(StandardException)
Convenience constructor for output file text streams.
Definition:
file_streams.hpp:63
ecl::OFileStream
Convenience class for OFile TextStream definitions.
Definition:
file_streams.hpp:42
ecl_catch
#define ecl_catch(exception)
The catch part of a try-catch macro matching ecl_throw calls.
Definition:
ecl/exceptions/macros.hpp:86
ecl::New
New
ecl_streams_PUBLIC
#define ecl_streams_PUBLIC
Definition:
ecl/streams/macros.hpp:37
ecl_try
#define ecl_try
The try part of a try-catch macro matching ecl_throw calls.
Definition:
ecl/exceptions/macros.hpp:80
xbot_driver
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:27:37