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

Create a new link to a file. More...

#include "request-fs.hpp"

Inheritance diagram for uv::fs::link:
uv::fs uv::request

Public Types

using on_request_t = std::function< void(link _request) >
 The function type of the callback called when the link 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

 link (const link &)=default
 
linkoperator= (const link &)=default
 
 link (link &&) noexcept=default
 
linkoperator= (link &&) noexcept=default
 
on_request_ton_request () const noexcept
 
const char * path () const noexcept
 The file path affected by request. More...
 
const char * link_path () const noexcept
 The new name for the path affected by request. More...
 
int run (uv::loop &_loop, const char *_path, const char *_link_path, bool _symlink, int _symlink_flags=0)
 Run the request. Make a new name for a target specified by _path. 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

Create a new link to a file.

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

Member Function Documentation

◆ path()

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

The file path affected by request.

Warning
On Windows the pointer actually refers to WCHAR string.
See also
libuv API documentation: uv_fs_t.path.

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

◆ link_path()

const char* uv::fs::link::link_path ( ) const
inlinenoexcept

The new name for the path affected by request.

Warning
On Windows the pointer actually refers to WCHAR string.

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

◆ run()

int uv::fs::link::run ( uv::loop _loop,
const char *  _path,
const char *  _link_path,
bool  _symlink,
int  _symlink_flags = 0 
)
inline

Run the request. Make a new name for a target specified by _path.

  • If (_symlink == false), create a new hard link to an existing _path.
  • If (_symlink == true), create a symbolic link which contains the string from _path as a link target.

On Windows the _symlink_flags parameter can be specified to control how the link to a directory will be created:

  • UV_FS_SYMLINK_DIR - request to create a symbolic link;
  • UV_FS_SYMLINK_JUNCTION - request to create a junction point.
See also
libuv API documentation: uv_fs_link(), uv_fs_symlink().
Linux: link(), symlink().
Note
If the request callback is empty (has not been set), the request runs synchronously.

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


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