1 #ifndef DBA_CORE_FILE_H 2 #define DBA_CORE_FILE_H 4 #include <dballe/file.h> 27 File(
const std::string& name, FILE* fd,
bool close_on_exit=
true);
31 bool foreach(std::function<
bool(
const BinaryMessage&)> dest)
override;
56 void write(
const std::string& msg)
override;
67 void write(
const std::string& msg)
override;
Encoding
Supported encodings.
Definition: file.h:20
virtual BinaryMessage read()=0
Read a message from the file.
static std::unique_ptr< dballe::File > open_test_data_file(Encoding type, const std::string &name)
Open a test data file.
std::string m_name
Name of the file.
Definition: core/file.h:18
Definition: core/file.h:59
Encoding encoding() const override
Get the file encoding.
Definition: core/file.h:65
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
virtual void write(const std::string &msg)=0
Append the binary message to the file.
FILE * fd
FILE structure used to read or write to the file.
Definition: core/file.h:20
std::string pathname() const override
Get the file pathname.
Definition: core/file.h:30
int idx
Index of the last message read from the file or written to the file.
Definition: core/file.h:24
static std::string resolve_test_data_file(const std::string &name)
Resolve the location of a test data file.
Binary message.
Definition: file.h:131
Definition: core/file.h:48
bool close_on_exit
True if fd should be closed on destruction.
Definition: core/file.h:22
Base for dballe::File implementations.
Definition: core/file.h:14
Encoding encoding() const override
Get the file encoding.
Definition: core/file.h:54
File object for doing I/O on binary message streams.
Definition: file.h:17