acl/lib_acl_cpp/include/acl_cpp/stream/aio_fstream.hpp

93 lines
2.8 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include "aio_istream.hpp"
#include "aio_ostream.hpp"
2014-11-19 00:25:21 +08:00
namespace acl {
class fstream;
/**
* UNIX
2014-11-19 00:25:21 +08:00
*/
class ACL_CPP_API aio_fstream
: public aio_istream
, public aio_ostream
{
public:
/**
*
* @param handle {aio_handle*}
2014-11-19 00:25:21 +08:00
*/
aio_fstream(aio_handle* handle);
#if defined(_WIN32) || defined(_WIN64)
2014-11-19 00:25:21 +08:00
aio_fstream(aio_handle* handle, HANDLE fd, unsigned int oflags = 0600);
#else
aio_fstream(aio_handle* handle, int fd, unsigned int oflags = 0600);
#endif
/**
* ,
* @param path {const char*}
* @param oflags {unsigned int} , We're assuming that O_RDONLY: 0x0000,
2014-11-19 00:25:21 +08:00
* O_WRONLY: 0x0001, O_RDWR: 0x0002, O_APPEND: 0x0008, O_CREAT: 0x0100,
* O_TRUNC: 0x0200, O_EXCL: 0x0400; just for win32, O_TEXT: 0x4000,
* O_BINARY: 0x8000, O_RAW: O_BINARY, O_SEQUENTIAL: 0x0020, O_RANDOM: 0x0010.
* @param mode {int} (: 0600)
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
bool open(const char* path, unsigned int oflags, unsigned int mode);
/**
* /
* , 0700
* @param path {const char*}
* @param mode {int} (: 0600)
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
bool open_trunc(const char* path, unsigned int mode = 0600);
/**
* / 0600,
*
* @param path {const char*}
* @param mode {int} (: 0600)
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
bool create(const char* path, unsigned int mode = 0600);
/**
*
* @param path {const char*}
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
bool open_read(const char* path);
/**
*
*
* @param path {const char*}
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
bool open_write(const char* path);
/**
*
* @param path {const char*}
* @return {bool}
2014-11-19 00:25:21 +08:00
*/
bool open_append(const char* path);
protected:
2019-07-07 11:00:12 +08:00
~aio_fstream(void);
2014-11-19 00:25:21 +08:00
/**
*
2014-11-19 00:25:21 +08:00
*/
2019-07-07 11:00:12 +08:00
virtual void destroy(void);
2014-11-19 00:25:21 +08:00
private:
};
} // namespace acl