|
libdballe 9.4
|
Public Member Functions | |
| JsonFile (const std::string &name, FILE *fd, bool close_on_exit=true) | |
| Encoding | encoding () const override |
| Get the file encoding. More... | |
| BinaryMessage | read () override |
| Read a message from the file. More... | |
| void | write (const std::string &msg) override |
| Append the binary message to the file. More... | |
Public Member Functions inherited from dballe::core::File | |
| File (const std::string &name, FILE *fd, bool close_on_exit=true) | |
| std::string | pathname () const override |
| Get the file pathname. More... | |
| void | close () override |
| Close the underlying file. More... | |
| bool | foreach (std::function< bool(const BinaryMessage &)> dest) override |
| Read all the messages from the file, calling the function on each of them. More... | |
| virtual std::string | pathname () const =0 |
| Get the file pathname. More... | |
| virtual Encoding | encoding () const =0 |
| Get the file encoding. More... | |
| virtual void | close ()=0 |
| Close the underlying file. More... | |
| virtual BinaryMessage | read ()=0 |
| Read a message from the file. More... | |
| virtual bool | foreach (std::function< bool(const BinaryMessage &)> dest)=0 |
| Read all the messages from the file, calling the function on each of them. More... | |
| virtual void | write (const std::string &msg)=0 |
| Append the binary message to the file. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from dballe::core::File | |
| static std::string | resolve_test_data_file (const std::string &name) |
| Resolve the location of a test data file. More... | |
| static std::unique_ptr< dballe::File > | open_test_data_file (Encoding type, const std::string &name) |
| Open a test data file. More... | |
Static Public Member Functions inherited from dballe::File | |
| static std::unique_ptr< File > | create (const std::string &pathname, const char *mode) |
| Open a file from the filesystem, autodetecting the encoding type. More... | |
| static std::unique_ptr< File > | create (Encoding type, const std::string &pathname, const char *mode) |
| Open a file from the filesystem. More... | |
| static std::unique_ptr< File > | create (FILE *file, bool close_on_exit, const std::string &name="(fp)") |
| Create a File from an existing FILE* stream, autodetecting the encoding type. More... | |
| static std::unique_ptr< File > | create (Encoding type, FILE *file, bool close_on_exit, const std::string &name="(fp)") |
| Create a File from an existing FILE* stream. More... | |
| static const char * | encoding_name (Encoding enc) |
| Return a string with the name of this encoding. | |
| static Encoding | parse_encoding (const char *s) |
| Return the Encoding corresponding to the given name. | |
| static Encoding | parse_encoding (const std::string &s) |
| Return the Encoding corresponding to the given name. | |
Protected Attributes inherited from dballe::core::File | |
| std::string | m_name |
| Name of the file. | |
| FILE * | fd |
| FILE structure used to read or write to the file. | |
| bool | close_on_exit |
| True if fd should be closed on destruction. | |
| int | idx |
| Index of the last message read from the file or written to the file. | |
|
inlineoverridevirtual |
Get the file encoding.
Implements dballe::File.
|
overridevirtual |
Read a message from the file.
Implements dballe::File.
|
overridevirtual |
Append the binary message to the file.
Implements dballe::File.