uvcc
libuv C++ bindings
uv::fs::stat Class Reference

Get information about a file. More...

#include "request-fs.hpp"

Inheritance diagram for uv::fs::stat:
uv::fs uv::request

Public Types

using on_request_t = std::function< void(stat _request) >
 The function type of the callback called when the stat request has completed.
 
- Public Types inherited from uv::fs
using uv_t = ::uv_fs_t
 
- Public Types inherited from uv::request
using uv_t = ::uv_req_t
 
using on_destroy_t = std::function< void(void *_data) >
 The function type of the callback called when the request object is about to be destroyed.
 

Public Member Functions

 stat (const stat &)=default
 
statoperator= (const stat &)=default
 
 stat (stat &&) noexcept=default
 
statoperator= (stat &&) noexcept=default
 
on_request_ton_request () const noexcept
 
file handle () const noexcept
 The file which this stat request has been running on. More...
 
const char * path () const noexcept
 The file path affected by request. More...
 
const ::uv_stat_t & result () const noexcept
 The result of the stat request. More...
 
int run (uv::loop &_loop, const char *_path, bool _follow_symlinks=false)
 Run the request. Get status information on a file or directory specified by _path. More...
 
int run (file &_file)
 Run the request. Get status information about the open _file. More...
 
 operator const uv_t * () const noexcept
 
 operator uv_t * () noexcept
 
- Public Member Functions inherited from uv::fs
 fs (const fs &)=default
 
fsoperator= (const fs &)=default
 
 fs (fs &&) noexcept=default
 
fsoperator= (fs &&) noexcept=default
 
::uv_fs_type fs_type () const noexcept
 The tag indicating a subtype of the filesystem request. More...
 
uv::loop loop () const noexcept
 The libuv loop that started this filesystem request and where completion will be reported.
 
 operator const uv_t * () const noexcept
 
 operator uv_t * () noexcept
 
- Public Member Functions inherited from uv::request
 request (const request &_that)
 
requestoperator= (const request &_that)
 
 request (request &&_that) noexcept
 
requestoperator= (request &&_that) noexcept
 
void swap (request &_that) noexcept
 
std::uintptr_t id () const noexcept
 
long nrefs () const noexcept
 The current number of existing references to the same object as this request variable refers to.
 
int uv_status () const noexcept
 The status value returned by the last executed libuv API function on this request.
 
on_destroy_ton_destroy () const noexcept
 
::uv_req_type type () const noexcept
 The tag indicating a libuv type of the request. More...
 
const char * type_name () const noexcept
 A string containing the name of the request type.
 
void *const & data () const noexcept
 The pointer to the user-defined arbitrary data. libuv and uvcc does not use this field.
 
void *& data () noexcept
 
int cancel () noexcept
 Cancel a pending request. More...
 
 operator const uv_t * () const noexcept
 
 operator uv_t * () noexcept
 
 operator bool () const noexcept
 Equivalent to (uv_status() >= 0).
 

Detailed Description

Get information about a file.

Definition at line 1078 of file request-fs.hpp.

Member Function Documentation

◆ handle()

file uv::fs::stat::handle ( ) const
inlinenoexcept

The file which this stat request has been running on.

It is guaranteed that it will be a valid instance at least within the request callback.

If the request was applied to a file path then the handle of the returned file is closed (i.e. uv::file::is_closing() == 1).

Definition at line 1130 of file request-fs.hpp.

◆ path()

const char* uv::fs::stat::path ( ) const
inlinenoexcept

The file path affected by request.

See also
libuv API documentation: uv_fs_t.path.

Definition at line 1138 of file request-fs.hpp.

◆ result()

const ::uv_stat_t& uv::fs::stat::result ( ) const
inlinenoexcept

The result of the stat request.

See also
libuv API documentation: uv_stat_t, uv_timespec_t, uv_fs_t.statbuf.
Linux: stat(), fstat(), lstat().

Definition at line 1151 of file request-fs.hpp.

◆ run() [1/2]

int uv::fs::stat::run ( uv::loop _loop,
const char *  _path,
bool  _follow_symlinks = false 
)
inline

Run the request. Get status information on a file or directory specified by _path.

See also
libuv API documentation: uv_fs_stat(), uv_fs_lstat().
Linux: stat(), lstat().
Note
If the request callback is empty (has not been set), the request runs synchronously.

Definition at line 1159 of file request-fs.hpp.

◆ run() [2/2]

int uv::fs::stat::run ( file _file)
inline

Run the request. Get status information about the open _file.

See also
libuv API documentation: uv_fs_fstat().
Linux: fstat().
Note
If the request callback is empty (has not been set), the request runs synchronously.

Definition at line 1206 of file request-fs.hpp.


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