Libosmium
2.3.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <data_file.hpp>
Public Member Functions | |
DataFile () | |
DataFile (size_t size) | |
DataFile (const char *filename, bool writable) | |
DataFile (const std::string &filename, bool writable) | |
operator bool () const noexcept | |
void | close () |
~DataFile () noexcept | |
int | fd () const |
size_t | size () const |
void | grow (size_t new_size) const |
Private Attributes | |
FILE * | m_file |
Class wrapper for convenient access to some low-level file functions.
|
inline |
Create and open a temporary file. It is removed after opening.
std::system_error | if something went wrong. |
|
inlineexplicit |
Create and open a temporary file with the specified size. It is removed after opening.
std::system_error | if something went wrong. |
|
inline |
Create and open a named file.
filename | the name of the file |
writable | should the file be writable? |
std::system_error | if something went wrong. |
|
inline |
Create and open a named file.
filename | the name of the file |
writable | should the file be writable? |
std::system_error | if something went wrong. |
|
inlinenoexcept |
|
inline |
Close the file.
Does nothing if the file is already closed.
std::system_error | if file could not be closed |
|
inline |
Get file descriptor of underlying file.
std::runtime_errro | if file is not open |
std::system_error | if fileno(3) call failed |
|
inline |
Grow file to given size.
If the file is large enough already, nothing is done. The file is never shrunk.
std::system_error | if ftruncate(2) call failed |
|
inlinenoexcept |
In boolean context the DataFile class returns true if the file is open.
|
inline |
Ask the operating system for the size of this file.
std::system_error | if fstat(2) call failed |
|
private |