URING++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
uringpp::dir Class Reference

An opened directory. More...

#include <uringpp/dir.h>

Inheritance diagram for uringpp::dir:
Inheritance graph
[legend]
Collaboration diagram for uringpp::dir:
Collaboration graph
[legend]

Public Member Functions

int fd () const
 Get the file descriptor of the directory. More...
 
 dir (std::shared_ptr< event_loop > loop, int fd)
 Construct a new dir object from a file descriptor. More...
 
 dir (dir &&other) noexcept
 Move construct a new dir object. More...
 
 ~dir ()
 Destroy the dir object. If the directory is open, it will be closed. More...
 
task< void > close ()
 Close the directory. More...
 
sqe_awaitable statx (const char *path, int flags, unsigned mask, struct statx *statxbuf)
 Stat a file/directory in the directory. More...
 
sqe_awaitable mkdir (const char *path, mode_t mode)
 Make a directory. More...
 
sqe_awaitable symlink (const char *oldpath, const char *newpath)
 Symbolic link a file/directory in the directory. More...
 
sqe_awaitable symlink (const char *oldpath, dir const &newdir, const char *newpath)
 Symbolic link a file/directory in the directory to another directory. More...
 
sqe_awaitable link (const char *oldpath, const char *newpath, int flags)
 Link a file/directory in the directory. More...
 
sqe_awaitable link (const char *oldpath, dir const &newdir, const char *newpath, int flags)
 Link a file/directory in the directory to another directory. More...
 
sqe_awaitable rename (const char *oldpath, const char *newpath, int flags)
 Rename a file/directory in the directory. More...
 
sqe_awaitable rename (const char *oldpath, dir const &newdir, const char *newpath, int flags)
 Rename a file/directory in the directory to another directory. More...
 
sqe_awaitable unlink (const char *path, int flags)
 Unlink a file/directory in the directory. More...
 
- Public Member Functions inherited from uringpp::noncopyable
 noncopyable (noncopyable &&)=default
 
 noncopyable (noncopyable const &)=delete
 
noncopyableoperator= (noncopyable const &)=delete
 
noncopyableoperator= (noncopyable &&)=default
 

Static Public Member Functions

static task< diropen (std::shared_ptr< event_loop > loop, char const *path, int flags, mode_t mode)
 Open a directory in the current working directory. More...
 
static task< diropenat (std::shared_ptr< event_loop > loop, dir const &dir, char const *path, int flags, mode_t mode)
 Open a directory in the given directory. More...
 
static task< diropenat2 (std::shared_ptr< event_loop > loop, dir const &dir, char const *path, struct open_how *how)
 Open a directory in the given directory. More...
 

Protected Attributes

std::shared_ptr< event_looploop_
 
int fd_
 

Detailed Description

An opened directory.

Constructor & Destructor Documentation

◆ dir() [1/2]

uringpp::dir::dir ( std::shared_ptr< event_loop loop,
int  fd 
)
inline

Construct a new dir object from a file descriptor.

Parameters
loopThe event loop.
fdThe file descriptor.

◆ dir() [2/2]

uringpp::dir::dir ( dir &&  other)
inlinenoexcept

Move construct a new dir object.

Parameters
other

◆ ~dir()

uringpp::dir::~dir ( )
inline

Destroy the dir object. If the directory is open, it will be closed.

Member Function Documentation

◆ close()

task< void > uringpp::dir::close ( )
inline

Close the directory.

Returns
task<void>

◆ fd()

int uringpp::dir::fd ( ) const
inline

Get the file descriptor of the directory.

Returns
int The file descriptor of the directory.

◆ link() [1/2]

sqe_awaitable uringpp::dir::link ( const char *  oldpath,
const char *  newpath,
int  flags 
)
inline

Link a file/directory in the directory.

Parameters
oldpathThe path to the file/directory to link.
newpathThe path to the file/directory to link to.
flagsThe flags to use when linking the file/directory.
Returns
sqe_awaitable

◆ link() [2/2]

sqe_awaitable uringpp::dir::link ( const char *  oldpath,
dir const &  newdir,
const char *  newpath,
int  flags 
)
inline

Link a file/directory in the directory to another directory.

Parameters
oldpathThe path to the file/directory to link.
newdirThe directory to link to.
newpathThe path to the file/directory to link to.
flagsThe flags to use when linking the file/directory.
Returns
sqe_awaitable

◆ mkdir()

sqe_awaitable uringpp::dir::mkdir ( const char *  path,
mode_t  mode 
)
inline

Make a directory.

Parameters
pathThe path to the directory.
modeThe mode to use when making the directory.
Returns
sqe_awaitable

◆ open()

static task< dir > uringpp::dir::open ( std::shared_ptr< event_loop loop,
char const *  path,
int  flags,
mode_t  mode 
)
inlinestatic

Open a directory in the current working directory.

Parameters
loopThe event loop.
pathThe path to the directory.
flagsThe flags to use when opening the directory.
modeThe mode to use when opening the directory.
Returns
task<dir>

◆ openat()

static task< dir > uringpp::dir::openat ( std::shared_ptr< event_loop loop,
dir const &  dir,
char const *  path,
int  flags,
mode_t  mode 
)
inlinestatic

Open a directory in the given directory.

Parameters
loopThe event loop.
dirThe directory to open the directory in.
pathThe path to the directory.
flagsThe flags to use when opening the directory.
modeThe mode to use when opening the directory.
Returns
task<dir>

◆ openat2()

static task< dir > uringpp::dir::openat2 ( std::shared_ptr< event_loop loop,
dir const &  dir,
char const *  path,
struct open_how *  how 
)
inlinestatic

Open a directory in the given directory.

Parameters
loopThe event loop.
dirThe directory to open the directory in.
pathThe path to the directory.
howHow to open the directory.
Returns
task<dir>

◆ rename() [1/2]

sqe_awaitable uringpp::dir::rename ( const char *  oldpath,
const char *  newpath,
int  flags 
)
inline

Rename a file/directory in the directory.

Parameters
oldpathThe path to the file/directory to rename.
newpathThe path to the file/directory to rename to.
flagsThe flags to use when renaming the file/directory.
Returns
sqe_awaitable

◆ rename() [2/2]

sqe_awaitable uringpp::dir::rename ( const char *  oldpath,
dir const &  newdir,
const char *  newpath,
int  flags 
)
inline

Rename a file/directory in the directory to another directory.

Parameters
oldpathThe path to the file/directory to rename.
newdirThe directory to rename to.
newpathThe path to the file/directory to rename to.
flagsThe flags to use when renaming the file/directory.
Returns
sqe_awaitable

◆ statx()

sqe_awaitable uringpp::dir::statx ( const char *  path,
int  flags,
unsigned  mask,
struct statx *  statxbuf 
)
inline

Stat a file/directory in the directory.

Parameters
pathThe path to the file/directory.
flagsThe flags to use when statting the file/directory.
maskThe mask to use when statting the file/directory.
statxbufThe statxbuf to use when statting the file/directory.
Returns
sqe_awaitable

◆ symlink() [1/2]

sqe_awaitable uringpp::dir::symlink ( const char *  oldpath,
const char *  newpath 
)
inline

Symbolic link a file/directory in the directory.

Parameters
oldpathThe path to the file/directory to link.
newpathThe path to the file/directory to link to.
Returns
sqe_awaitable

◆ symlink() [2/2]

sqe_awaitable uringpp::dir::symlink ( const char *  oldpath,
dir const &  newdir,
const char *  newpath 
)
inline

Symbolic link a file/directory in the directory to another directory.

Parameters
oldpathThe path to the file/directory to link.
newdirThe directory to link to.
newpathThe path to the file/directory to link to.
Returns
sqe_awaitable

◆ unlink()

sqe_awaitable uringpp::dir::unlink ( const char *  path,
int  flags 
)
inline

Unlink a file/directory in the directory.

Parameters
pathThe path to the file/directory to unlink.
flagsThe flags to use when unlink the file/directory.
Returns
sqe_awaitable

The documentation for this class was generated from the following file: