/usr/include/dballe/core/file.h is in libdballe-dev 7.21-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #ifndef DBA_CORE_FILE_H
#define DBA_CORE_FILE_H
#include <dballe/file.h>
#include <dballe/core/defs.h>
#include <memory>
#include <string>
#include <cstdio>
namespace dballe {
namespace core {
/// Base for dballe::File implementations
class File : public dballe::File
{
protected:
/// Name of the file
std::string m_name;
/// FILE structure used to read or write to the file
FILE* fd;
/// True if fd should be closed on destruction
bool close_on_exit;
/// Index of the last message read from the file or written to the file
int idx;
public:
File(const std::string& name, FILE* fd, bool close_on_exit=true);
virtual ~File();
std::string pathname() const override { return m_name; }
bool foreach(std::function<bool(const BinaryMessage&)> dest) override;
/**
* Resolve the location of a test data file
*
* This should only be used during dballe unit tests.
*/
static std::string resolve_test_data_file(const std::string& name);
/**
* Open a test data file.
*
* This should only be used during dballe unit tests.
*/
static std::unique_ptr<dballe::File> open_test_data_file(Encoding type, const std::string& name);
};
class BufrFile : public dballe::core::File
{
public:
BufrFile(const std::string& name, FILE* fd, bool close_on_exit=true)
: File(name, fd, close_on_exit) {}
Encoding encoding() const override { return BUFR; }
BinaryMessage read() override;
void write(const std::string& msg) override;
};
class CrexFile : public dballe::core::File
{
public:
CrexFile(const std::string& name, FILE* fd, bool close_on_exit=true)
: File(name, fd, close_on_exit) {}
Encoding encoding() const override { return CREX; }
BinaryMessage read() override;
void write(const std::string& msg) override;
};
}
}
#endif
|