2017-10-30 23:44:40 +01:00
|
|
|
#ifndef _LIBRW_FILEHANDLE_HPP_
|
|
|
|
#define _LIBRW_FILEHANDLE_HPP_
|
2018-08-05 18:28:59 +02:00
|
|
|
|
2018-07-06 22:05:43 +02:00
|
|
|
#include <cstddef>
|
2018-08-05 18:28:59 +02:00
|
|
|
#include <memory>
|
2015-02-26 04:57:28 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Contains a pointer to a file's contents.
|
|
|
|
*/
|
2016-09-09 22:13:21 +02:00
|
|
|
struct FileContentsInfo {
|
2018-08-05 18:28:59 +02:00
|
|
|
std::unique_ptr<char[]> data;
|
2016-09-09 22:13:21 +02:00
|
|
|
size_t length;
|
2015-02-26 04:57:28 +01:00
|
|
|
|
2018-08-05 18:28:59 +02:00
|
|
|
FileContentsInfo(std::unique_ptr<char[]> mem, size_t len)
|
|
|
|
: data(std::move(mem)), length(len) {
|
2016-09-09 22:13:21 +02:00
|
|
|
}
|
2016-08-31 21:36:29 +02:00
|
|
|
|
2018-08-05 18:28:59 +02:00
|
|
|
FileContentsInfo(FileContentsInfo&& info)
|
|
|
|
: data(std::move(info.data)), length(info.length) {
|
|
|
|
info.data = nullptr;
|
2016-09-09 22:13:21 +02:00
|
|
|
}
|
2018-08-05 18:28:59 +02:00
|
|
|
|
|
|
|
FileContentsInfo(FileContentsInfo& info) = delete;
|
|
|
|
FileContentsInfo& operator=(FileContentsInfo& info) = delete;
|
|
|
|
|
|
|
|
~FileContentsInfo() = default;
|
2015-02-26 04:57:28 +01:00
|
|
|
};
|
|
|
|
|
2016-08-31 21:29:39 +02:00
|
|
|
#endif
|