removed a bunch of unnecessary copies (close #238)
This commit is contained in:
parent
58b299ee60
commit
83973cbc04
@ -49,32 +49,32 @@ UVW_INLINE auto GetAddrInfoReq::nodeAddrInfoSync(const char *node, const char *s
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void GetAddrInfoReq::nodeAddrInfo(std::string node, addrinfo *hints) {
|
||||
UVW_INLINE void GetAddrInfoReq::nodeAddrInfo(const std::string &node, addrinfo *hints) {
|
||||
nodeAddrInfo(node.data(), nullptr, hints);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, std::unique_ptr<addrinfo, GetAddrInfoReq::Deleter>> GetAddrInfoReq::nodeAddrInfoSync(std::string node, addrinfo *hints) {
|
||||
UVW_INLINE std::pair<bool, std::unique_ptr<addrinfo, GetAddrInfoReq::Deleter>> GetAddrInfoReq::nodeAddrInfoSync(const std::string &node, addrinfo *hints) {
|
||||
return nodeAddrInfoSync(node.data(), nullptr, hints);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void GetAddrInfoReq::serviceAddrInfo(std::string service, addrinfo *hints) {
|
||||
UVW_INLINE void GetAddrInfoReq::serviceAddrInfo(const std::string &service, addrinfo *hints) {
|
||||
nodeAddrInfo(nullptr, service.data(), hints);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, std::unique_ptr<addrinfo, GetAddrInfoReq::Deleter>> GetAddrInfoReq::serviceAddrInfoSync(std::string service, addrinfo *hints) {
|
||||
UVW_INLINE std::pair<bool, std::unique_ptr<addrinfo, GetAddrInfoReq::Deleter>> GetAddrInfoReq::serviceAddrInfoSync(const std::string &service, addrinfo *hints) {
|
||||
return nodeAddrInfoSync(nullptr, service.data(), hints);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void GetAddrInfoReq::addrInfo(std::string node, std::string service, addrinfo *hints) {
|
||||
UVW_INLINE void GetAddrInfoReq::addrInfo(const std::string &node, const std::string &service, addrinfo *hints) {
|
||||
nodeAddrInfo(node.data(), service.data(), hints);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, std::unique_ptr<addrinfo, GetAddrInfoReq::Deleter>> GetAddrInfoReq::addrInfoSync(std::string node, std::string service, addrinfo *hints) {
|
||||
UVW_INLINE std::pair<bool, std::unique_ptr<addrinfo, GetAddrInfoReq::Deleter>> GetAddrInfoReq::addrInfoSync(const std::string &node, const std::string &service, addrinfo *hints) {
|
||||
return nodeAddrInfoSync(node.data(), service.data(), hints);
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ UVW_INLINE void GetNameInfoReq::nameInfo(const sockaddr &addr, int flags) {
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE void GetNameInfoReq::nameInfo(std::string ip, unsigned int port, int flags) {
|
||||
UVW_INLINE void GetNameInfoReq::nameInfo(const std::string &ip, unsigned int port, int flags) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
nameInfo(reinterpret_cast<const sockaddr &>(addr), flags);
|
||||
@ -115,7 +115,7 @@ UVW_INLINE std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync(std::string ip, unsigned int port, int flags) {
|
||||
UVW_INLINE std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync(const std::string &ip, unsigned int port, int flags) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
return nameInfoSync(reinterpret_cast<const sockaddr &>(addr), flags);
|
||||
@ -130,17 +130,18 @@ UVW_INLINE std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq
|
||||
|
||||
// explicit instantiations
|
||||
#ifdef UVW_AS_LIB
|
||||
template void GetNameInfoReq::nameInfo<IPv4>(std::string ip, unsigned int port, int flags);
|
||||
template void GetNameInfoReq::nameInfo<IPv6>(std::string ip, unsigned int port, int flags);
|
||||
template void GetNameInfoReq::nameInfo<IPv4>(const std::string &, unsigned int, int);
|
||||
template void GetNameInfoReq::nameInfo<IPv6>(const std::string &, unsigned int, int);
|
||||
|
||||
template void GetNameInfoReq::nameInfo<IPv4>(Addr addr, int flags);
|
||||
template void GetNameInfoReq::nameInfo<IPv6>(Addr addr, int flags);
|
||||
template void GetNameInfoReq::nameInfo<IPv4>(Addr, int);
|
||||
template void GetNameInfoReq::nameInfo<IPv6>(Addr, int);
|
||||
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(std::string ip, unsigned int port, int flags);
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(std::string ip, unsigned int port, int flags);
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(const std::string &, unsigned int, int);
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(const std::string &, unsigned int, int);
|
||||
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(Addr addr, int flags);
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(Addr addr, int flags);
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(Addr, int);
|
||||
template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(Addr, int);
|
||||
#endif // UVW_AS_LIB
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
* @param hints Optional `addrinfo` data structure with additional address
|
||||
* type constraints.
|
||||
*/
|
||||
void nodeAddrInfo(std::string node, addrinfo *hints = nullptr);
|
||||
void nodeAddrInfo(const std::string &node, addrinfo *hints = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Sync [getaddrinfo](http://linux.die.net/man/3/getaddrinfo).
|
||||
@ -97,7 +97,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * A `std::unique_ptr<addrinfo, Deleter>` containing the data requested.
|
||||
*/
|
||||
std::pair<bool, std::unique_ptr<addrinfo, Deleter>> nodeAddrInfoSync(std::string node, addrinfo *hints = nullptr);
|
||||
std::pair<bool, std::unique_ptr<addrinfo, Deleter>> nodeAddrInfoSync(const std::string &node, addrinfo *hints = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Async [getaddrinfo](http://linux.die.net/man/3/getaddrinfo).
|
||||
@ -105,7 +105,7 @@ public:
|
||||
* @param hints Optional `addrinfo` data structure with additional address
|
||||
* type constraints.
|
||||
*/
|
||||
void serviceAddrInfo(std::string service, addrinfo *hints = nullptr);
|
||||
void serviceAddrInfo(const std::string &service, addrinfo *hints = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Sync [getaddrinfo](http://linux.die.net/man/3/getaddrinfo).
|
||||
@ -118,7 +118,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * A `std::unique_ptr<addrinfo, Deleter>` containing the data requested.
|
||||
*/
|
||||
std::pair<bool, std::unique_ptr<addrinfo, Deleter>> serviceAddrInfoSync(std::string service, addrinfo *hints = nullptr);
|
||||
std::pair<bool, std::unique_ptr<addrinfo, Deleter>> serviceAddrInfoSync(const std::string &service, addrinfo *hints = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Async [getaddrinfo](http://linux.die.net/man/3/getaddrinfo).
|
||||
@ -127,7 +127,7 @@ public:
|
||||
* @param hints Optional `addrinfo` data structure with additional address
|
||||
* type constraints.
|
||||
*/
|
||||
void addrInfo(std::string node, std::string service, addrinfo *hints = nullptr);
|
||||
void addrInfo(const std::string &node, const std::string &service, addrinfo *hints = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Sync [getaddrinfo](http://linux.die.net/man/3/getaddrinfo).
|
||||
@ -141,7 +141,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * A `std::unique_ptr<addrinfo, Deleter>` containing the data requested.
|
||||
*/
|
||||
std::pair<bool, std::unique_ptr<addrinfo, Deleter>> addrInfoSync(std::string node, std::string service, addrinfo *hints = nullptr);
|
||||
std::pair<bool, std::unique_ptr<addrinfo, Deleter>> addrInfoSync(const std::string &node, const std::string &service, addrinfo *hints = nullptr);
|
||||
};
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ public:
|
||||
* @param flags Optional flags that modify the behavior of `getnameinfo`.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
void nameInfo(std::string ip, unsigned int port, int flags = 0);
|
||||
void nameInfo(const std::string &ip, unsigned int port, int flags = 0);
|
||||
|
||||
/**
|
||||
* @brief Async [getnameinfo](http://linux.die.net/man/3/getnameinfo).
|
||||
@ -211,7 +211,7 @@ public:
|
||||
* * A `const char *` containing a valid service name.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
std::pair<bool, std::pair<const char *, const char *>> nameInfoSync(std::string ip, unsigned int port, int flags = 0);
|
||||
std::pair<bool, std::pair<const char *, const char *>> nameInfoSync(const std::string &ip, unsigned int port, int flags = 0);
|
||||
|
||||
/**
|
||||
* @brief Sync [getnameinfo](http://linux.die.net/man/3/getnameinfo).
|
||||
@ -238,19 +238,20 @@ public:
|
||||
|
||||
// (extern) explicit instantiations
|
||||
#ifdef UVW_AS_LIB
|
||||
extern template void GetNameInfoReq::nameInfo<IPv4>(std::string ip, unsigned int port, int flags);
|
||||
extern template void GetNameInfoReq::nameInfo<IPv6>(std::string ip, unsigned int port, int flags);
|
||||
extern template void GetNameInfoReq::nameInfo<IPv4>(const std::string &, unsigned int, int);
|
||||
extern template void GetNameInfoReq::nameInfo<IPv6>(const std::string &, unsigned int, int);
|
||||
|
||||
extern template void GetNameInfoReq::nameInfo<IPv4>(Addr addr, int flags);
|
||||
extern template void GetNameInfoReq::nameInfo<IPv6>(Addr addr, int flags);
|
||||
extern template void GetNameInfoReq::nameInfo<IPv4>(Addr, int);
|
||||
extern template void GetNameInfoReq::nameInfo<IPv6>(Addr, int);
|
||||
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(std::string ip, unsigned int port, int flags);
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(std::string ip, unsigned int port, int flags);
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(const std::string &, unsigned int, int);
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(const std::string &, unsigned int, int);
|
||||
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(Addr addr, int flags);
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(Addr addr, int flags);
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv4>(Addr, int);
|
||||
extern template std::pair<bool, std::pair<const char *, const char *>> GetNameInfoReq::nameInfoSync<IPv6>(Addr, int);
|
||||
#endif // UVW_AS_LIB
|
||||
|
||||
|
||||
/**
|
||||
* Internal details not to be documented.
|
||||
* @endcond
|
||||
@ -264,4 +265,5 @@ extern template std::pair<bool, std::pair<const char *, const char *>> GetNameIn
|
||||
#include "dns.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_DNS_INCLUDE_H
|
||||
|
||||
@ -66,12 +66,12 @@ UVW_INLINE bool FileReq::closeSync() {
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FileReq::open(std::string path, Flags<FileOpen> flags, int mode) {
|
||||
UVW_INLINE void FileReq::open(const std::string &path, Flags<FileOpen> flags, int mode) {
|
||||
cleanupAndInvoke(&uv_fs_open, parent(), get(), path.data(), flags, mode, &fsOpenCallback);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FileReq::openSync(std::string path, Flags<FileOpen> flags, int mode) {
|
||||
UVW_INLINE bool FileReq::openSync(const std::string &path, Flags<FileOpen> flags, int mode) {
|
||||
auto req = get();
|
||||
|
||||
cleanupAndInvokeSync(&uv_fs_open, parent(), req, path.data(), flags, mode);
|
||||
@ -256,48 +256,48 @@ UVW_INLINE FsReq::~FsReq() noexcept {
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::unlink(std::string path) {
|
||||
UVW_INLINE void FsReq::unlink(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_unlink, parent(), get(), path.data(), &fsGenericCallback<Type::UNLINK>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::unlinkSync(std::string path) {
|
||||
UVW_INLINE bool FsReq::unlinkSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_unlink, parent(), req, path.data());
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::mkdir(std::string path, int mode) {
|
||||
UVW_INLINE void FsReq::mkdir(const std::string &path, int mode) {
|
||||
cleanupAndInvoke(&uv_fs_mkdir, parent(), get(), path.data(), mode, &fsGenericCallback<Type::MKDIR>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::mkdirSync(std::string path, int mode) {
|
||||
UVW_INLINE bool FsReq::mkdirSync(const std::string &path, int mode) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_mkdir, parent(), req, path.data(), mode);
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::mkdtemp(std::string tpl) {
|
||||
UVW_INLINE void FsReq::mkdtemp(const std::string &tpl) {
|
||||
cleanupAndInvoke(&uv_fs_mkdtemp, parent(), get(), tpl.data(), &fsGenericCallback<Type::MKDTEMP>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, const char *> FsReq::mkdtempSync(std::string tpl) {
|
||||
UVW_INLINE std::pair<bool, const char *> FsReq::mkdtempSync(const std::string &tpl) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_mkdtemp, parent(), req, tpl.data());
|
||||
return std::make_pair(!(req->result < 0), req->path);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::mkstemp(std::string tpl) {
|
||||
UVW_INLINE void FsReq::mkstemp(const std::string &tpl) {
|
||||
cleanupAndInvoke(&uv_fs_mkstemp, parent(), get(), tpl.data(), &fsResultCallback<Type::MKSTEMP>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, std::pair<std::string, std::size_t>> FsReq::mkstempSync(std::string tpl) {
|
||||
UVW_INLINE std::pair<bool, std::pair<std::string, std::size_t>> FsReq::mkstempSync(const std::string &tpl) {
|
||||
std::pair<bool, std::pair<std::string, std::size_t>> ret{false, {}};
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_mkdtemp, parent(), req, tpl.data());
|
||||
@ -312,36 +312,36 @@ UVW_INLINE std::pair<bool, std::pair<std::string, std::size_t>> FsReq::mkstempSy
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::lutime(std::string path, Time atime, Time mtime) {
|
||||
UVW_INLINE void FsReq::lutime(const std::string &path, Time atime, Time mtime) {
|
||||
cleanupAndInvoke(&uv_fs_lutime, parent(), get(), path.data(), atime.count(), mtime.count(), &fsGenericCallback<Type::LUTIME>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::lutimeSync(std::string path, Time atime, Time mtime) {
|
||||
UVW_INLINE bool FsReq::lutimeSync(const std::string &path, Time atime, Time mtime) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_lutime, parent(), req, path.data(), atime.count(), mtime.count());
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::rmdir(std::string path) {
|
||||
UVW_INLINE void FsReq::rmdir(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_rmdir, parent(), get(), path.data(), &fsGenericCallback<Type::RMDIR>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::rmdirSync(std::string path) {
|
||||
UVW_INLINE bool FsReq::rmdirSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_rmdir, parent(), req, path.data());
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::scandir(std::string path, int flags) {
|
||||
UVW_INLINE void FsReq::scandir(const std::string &path, int flags) {
|
||||
cleanupAndInvoke(&uv_fs_scandir, parent(), get(), path.data(), flags, &fsResultCallback<Type::SCANDIR>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, std::size_t> FsReq::scandirSync(std::string path, int flags) {
|
||||
UVW_INLINE std::pair<bool, std::size_t> FsReq::scandirSync(const std::string &path, int flags) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_scandir, parent(), req, path.data(), flags);
|
||||
bool err = req->result < 0;
|
||||
@ -366,132 +366,132 @@ UVW_INLINE std::pair<bool, std::pair<FsReq::EntryType, const char *>> FsReq::sca
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::stat(std::string path) {
|
||||
UVW_INLINE void FsReq::stat(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_stat, parent(), get(), path.data(), &fsStatCallback<Type::STAT>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, Stat> FsReq::statSync(std::string path) {
|
||||
UVW_INLINE std::pair<bool, Stat> FsReq::statSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_stat, parent(), req, path.data());
|
||||
return std::make_pair(!(req->result < 0), req->statbuf);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::lstat(std::string path) {
|
||||
UVW_INLINE void FsReq::lstat(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_lstat, parent(), get(), path.data(), &fsStatCallback<Type::LSTAT>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, Stat> FsReq::lstatSync(std::string path) {
|
||||
UVW_INLINE std::pair<bool, Stat> FsReq::lstatSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_lstat, parent(), req, path.data());
|
||||
return std::make_pair(!(req->result < 0), req->statbuf);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::statfs(std::string path) {
|
||||
UVW_INLINE void FsReq::statfs(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_statfs, parent(), get(), path.data(), &fsStatfsCallback);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, Statfs> FsReq::statfsSync(std::string path) {
|
||||
UVW_INLINE std::pair<bool, Statfs> FsReq::statfsSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_statfs, parent(), req, path.data());
|
||||
return std::make_pair(!(req->result < 0), *static_cast<uv_statfs_t *>(req->ptr));
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::rename(std::string old, std::string path) {
|
||||
UVW_INLINE void FsReq::rename(const std::string &old, const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_rename, parent(), get(), old.data(), path.data(), &fsGenericCallback<Type::RENAME>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::renameSync(std::string old, std::string path) {
|
||||
UVW_INLINE bool FsReq::renameSync(const std::string &old, const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_rename, parent(), req, old.data(), path.data());
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::copyfile(std::string old, std::string path, Flags<CopyFile> flags) {
|
||||
UVW_INLINE void FsReq::copyfile(const std::string &old, const std::string &path, Flags<CopyFile> flags) {
|
||||
cleanupAndInvoke(&uv_fs_copyfile, parent(), get(), old.data(), path.data(), flags, &fsGenericCallback<Type::COPYFILE>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::copyfileSync(std::string old, std::string path, Flags<CopyFile> flags) {
|
||||
UVW_INLINE bool FsReq::copyfileSync(const std::string &old, const std::string &path, Flags<CopyFile> flags) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_copyfile, parent(), get(), old.data(), path.data(), flags);
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::access(std::string path, int mode) {
|
||||
UVW_INLINE void FsReq::access(const std::string &path, int mode) {
|
||||
cleanupAndInvoke(&uv_fs_access, parent(), get(), path.data(), mode, &fsGenericCallback<Type::ACCESS>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::accessSync(std::string path, int mode) {
|
||||
UVW_INLINE bool FsReq::accessSync(const std::string &path, int mode) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_access, parent(), req, path.data(), mode);
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::chmod(std::string path, int mode) {
|
||||
UVW_INLINE void FsReq::chmod(const std::string &path, int mode) {
|
||||
cleanupAndInvoke(&uv_fs_chmod, parent(), get(), path.data(), mode, &fsGenericCallback<Type::CHMOD>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::chmodSync(std::string path, int mode) {
|
||||
UVW_INLINE bool FsReq::chmodSync(const std::string &path, int mode) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_chmod, parent(), req, path.data(), mode);
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::utime(std::string path, FsRequest::Time atime, FsRequest::Time mtime) {
|
||||
UVW_INLINE void FsReq::utime(const std::string &path, FsRequest::Time atime, FsRequest::Time mtime) {
|
||||
cleanupAndInvoke(&uv_fs_utime, parent(), get(), path.data(), atime.count(), mtime.count(), &fsGenericCallback<Type::UTIME>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::utimeSync(std::string path, FsRequest::Time atime, FsRequest::Time mtime) {
|
||||
UVW_INLINE bool FsReq::utimeSync(const std::string &path, FsRequest::Time atime, FsRequest::Time mtime) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_utime, parent(), req, path.data(), atime.count(), mtime.count());
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::link(std::string old, std::string path) {
|
||||
UVW_INLINE void FsReq::link(const std::string &old, const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_link, parent(), get(), old.data(), path.data(), &fsGenericCallback<Type::LINK>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::linkSync(std::string old, std::string path) {
|
||||
UVW_INLINE bool FsReq::linkSync(const std::string &old, const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_link, parent(), req, old.data(), path.data());
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::symlink(std::string old, std::string path, Flags<SymLink> flags) {
|
||||
UVW_INLINE void FsReq::symlink(const std::string &old, const std::string &path, Flags<SymLink> flags) {
|
||||
cleanupAndInvoke(&uv_fs_symlink, parent(), get(), old.data(), path.data(), flags, &fsGenericCallback<Type::SYMLINK>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::symlinkSync(std::string old, std::string path, Flags<SymLink> flags) {
|
||||
UVW_INLINE bool FsReq::symlinkSync(const std::string &old, const std::string &path, Flags<SymLink> flags) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_symlink, parent(), req, old.data(), path.data(), flags);
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::readlink(std::string path) {
|
||||
UVW_INLINE void FsReq::readlink(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_readlink, parent(), get(), path.data(), &fsReadlinkCallback);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, std::pair<const char *, std::size_t>> FsReq::readlinkSync(std::string path) {
|
||||
UVW_INLINE std::pair<bool, std::pair<const char *, std::size_t>> FsReq::readlinkSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_readlink, parent(), req, path.data());
|
||||
bool err = req->result < 0;
|
||||
@ -499,48 +499,48 @@ UVW_INLINE std::pair<bool, std::pair<const char *, std::size_t>> FsReq::readlink
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::realpath(std::string path) {
|
||||
UVW_INLINE void FsReq::realpath(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_realpath, parent(), get(), path.data(), &fsGenericCallback<Type::REALPATH>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE std::pair<bool, const char *> FsReq::realpathSync(std::string path) {
|
||||
UVW_INLINE std::pair<bool, const char *> FsReq::realpathSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_realpath, parent(), req, path.data());
|
||||
return std::make_pair(!(req->result < 0), req->path);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::chown(std::string path, Uid uid, Gid gid) {
|
||||
UVW_INLINE void FsReq::chown(const std::string &path, Uid uid, Gid gid) {
|
||||
cleanupAndInvoke(&uv_fs_chown, parent(), get(), path.data(), uid, gid, &fsGenericCallback<Type::CHOWN>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::chownSync(std::string path, Uid uid, Gid gid) {
|
||||
UVW_INLINE bool FsReq::chownSync(const std::string &path, Uid uid, Gid gid) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_chown, parent(), req, path.data(), uid, gid);
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::lchown(std::string path, Uid uid, Gid gid) {
|
||||
UVW_INLINE void FsReq::lchown(const std::string &path, Uid uid, Gid gid) {
|
||||
cleanupAndInvoke(&uv_fs_lchown, parent(), get(), path.data(), uid, gid, &fsGenericCallback<Type::LCHOWN>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::lchownSync(std::string path, Uid uid, Gid gid) {
|
||||
UVW_INLINE bool FsReq::lchownSync(const std::string &path, Uid uid, Gid gid) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_lchown, parent(), req, path.data(), uid, gid);
|
||||
return !(req->result < 0);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsReq::opendir(std::string path) {
|
||||
UVW_INLINE void FsReq::opendir(const std::string &path) {
|
||||
cleanupAndInvoke(&uv_fs_opendir, parent(), get(), path.data(), &fsGenericCallback<Type::OPENDIR>);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool FsReq::opendirSync(std::string path) {
|
||||
UVW_INLINE bool FsReq::opendirSync(const std::string &path) {
|
||||
auto req = get();
|
||||
cleanupAndInvokeSync(&uv_fs_opendir, parent(), req, path.data());
|
||||
return !(req->result < 0);
|
||||
|
||||
93
src/uvw/fs.h
93
src/uvw/fs.h
@ -500,7 +500,7 @@ public:
|
||||
* @param flags Flags made out of underlying constants.
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
*/
|
||||
void open(std::string path, Flags<FileOpen> flags, int mode);
|
||||
void open(const std::string &path, Flags<FileOpen> flags, int mode);
|
||||
|
||||
/**
|
||||
* @brief Sync [open](http://linux.die.net/man/2/open).
|
||||
@ -539,7 +539,7 @@ public:
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool openSync(std::string path, Flags<FileOpen> flags, int mode);
|
||||
bool openSync(const std::string &path, Flags<FileOpen> flags, int mode);
|
||||
|
||||
/**
|
||||
* @brief Async [read](http://linux.die.net/man/2/preadv).
|
||||
@ -804,14 +804,14 @@ public:
|
||||
*
|
||||
* @param path Path, as described in the official documentation.
|
||||
*/
|
||||
void unlink(std::string path);
|
||||
void unlink(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [unlink](http://linux.die.net/man/2/unlink).
|
||||
* @param path Path, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool unlinkSync(std::string path);
|
||||
bool unlinkSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [mkdir](http://linux.die.net/man/2/mkdir).
|
||||
@ -822,7 +822,7 @@ public:
|
||||
* @param path Path, as described in the official documentation.
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
*/
|
||||
void mkdir(std::string path, int mode);
|
||||
void mkdir(const std::string &path, int mode);
|
||||
|
||||
/**
|
||||
* @brief Sync [mkdir](http://linux.die.net/man/2/mkdir).
|
||||
@ -830,7 +830,7 @@ public:
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool mkdirSync(std::string path, int mode);
|
||||
bool mkdirSync(const std::string &path, int mode);
|
||||
|
||||
/**
|
||||
* @brief Async [mktemp](http://linux.die.net/man/3/mkdtemp).
|
||||
@ -840,7 +840,7 @@ public:
|
||||
*
|
||||
* @param tpl Template, as described in the official documentation.
|
||||
*/
|
||||
void mkdtemp(std::string tpl);
|
||||
void mkdtemp(const std::string &tpl);
|
||||
|
||||
/**
|
||||
* @brief Sync [mktemp](http://linux.die.net/man/3/mkdtemp).
|
||||
@ -851,7 +851,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * The actual path of the newly created directory.
|
||||
*/
|
||||
std::pair<bool, const char *> mkdtempSync(std::string tpl);
|
||||
std::pair<bool, const char *> mkdtempSync(const std::string &tpl);
|
||||
|
||||
/**
|
||||
* @brief Async [mkstemp](https://linux.die.net/man/3/mkstemp).
|
||||
@ -861,7 +861,7 @@ public:
|
||||
*
|
||||
* @param tpl Template, as described in the official documentation.
|
||||
*/
|
||||
void mkstemp(std::string tpl);
|
||||
void mkstemp(const std::string &tpl);
|
||||
|
||||
/**
|
||||
* @brief Sync [mkstemp](https://linux.die.net/man/3/mkstemp).
|
||||
@ -883,7 +883,7 @@ public:
|
||||
* false otherwise.
|
||||
* * The second parameter is a composed value (see above).
|
||||
*/
|
||||
std::pair<bool, std::pair<std::string, std::size_t>> mkstempSync(std::string tpl);
|
||||
std::pair<bool, std::pair<std::string, std::size_t>> mkstempSync(const std::string &tpl);
|
||||
|
||||
/**
|
||||
* @brief Async [lutime](http://linux.die.net/man/3/lutimes).
|
||||
@ -897,7 +897,7 @@ public:
|
||||
* @param mtime `std::chrono::duration<double>`, having the same meaning as
|
||||
* described in the official documentation.
|
||||
*/
|
||||
void lutime(std::string path, Time atime, Time mtime);
|
||||
void lutime(const std::string &path, Time atime, Time mtime);
|
||||
|
||||
/**
|
||||
* @brief Sync [lutime](http://linux.die.net/man/3/lutimes).
|
||||
@ -908,7 +908,7 @@ public:
|
||||
* described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool lutimeSync(std::string path, Time atime, Time mtime);
|
||||
bool lutimeSync(const std::string &path, Time atime, Time mtime);
|
||||
|
||||
/**
|
||||
* @brief Async [rmdir](http://linux.die.net/man/2/rmdir).
|
||||
@ -918,14 +918,14 @@ public:
|
||||
*
|
||||
* @param path Path, as described in the official documentation.
|
||||
*/
|
||||
void rmdir(std::string path);
|
||||
void rmdir(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [rmdir](http://linux.die.net/man/2/rmdir).
|
||||
* @param path Path, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool rmdirSync(std::string path);
|
||||
bool rmdirSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [scandir](http://linux.die.net/man/3/scandir).
|
||||
@ -936,7 +936,7 @@ public:
|
||||
* @param path Path, as described in the official documentation.
|
||||
* @param flags Flags, as described in the official documentation.
|
||||
*/
|
||||
void scandir(std::string path, int flags);
|
||||
void scandir(const std::string &path, int flags);
|
||||
|
||||
/**
|
||||
* @brief Sync [scandir](http://linux.die.net/man/3/scandir).
|
||||
@ -948,7 +948,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * The number of directory entries selected.
|
||||
*/
|
||||
std::pair<bool, std::size_t> scandirSync(std::string path, int flags);
|
||||
std::pair<bool, std::size_t> scandirSync(const std::string &path, int flags);
|
||||
|
||||
/**
|
||||
* @brief Gets entries populated with the next directory entry data.
|
||||
@ -989,7 +989,7 @@ public:
|
||||
*
|
||||
* @param path Path, as described in the official documentation.
|
||||
*/
|
||||
void stat(std::string path);
|
||||
void stat(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [stat](http://linux.die.net/man/2/stat).
|
||||
@ -1000,7 +1000,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * An initialized instance of Stat.
|
||||
*/
|
||||
std::pair<bool, Stat> statSync(std::string path);
|
||||
std::pair<bool, Stat> statSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [lstat](http://linux.die.net/man/2/lstat).
|
||||
@ -1010,7 +1010,7 @@ public:
|
||||
*
|
||||
* @param path Path, as described in the official documentation.
|
||||
*/
|
||||
void lstat(std::string path);
|
||||
void lstat(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [lstat](http://linux.die.net/man/2/lstat).
|
||||
@ -1021,7 +1021,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * An initialized instance of Stat.
|
||||
*/
|
||||
std::pair<bool, Stat> lstatSync(std::string path);
|
||||
std::pair<bool, Stat> lstatSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [statfs](http://linux.die.net/man/2/statfs).
|
||||
@ -1034,7 +1034,7 @@ public:
|
||||
*
|
||||
* @param path Path, as described in the official documentation.
|
||||
*/
|
||||
void statfs(std::string path);
|
||||
void statfs(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [statfs](http://linux.die.net/man/2/statfs).
|
||||
@ -1048,7 +1048,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * An initialized instance of Statfs.
|
||||
*/
|
||||
std::pair<bool, Statfs> statfsSync(std::string path);
|
||||
std::pair<bool, Statfs> statfsSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [rename](http://linux.die.net/man/2/rename).
|
||||
@ -1059,7 +1059,7 @@ public:
|
||||
* @param old Old path, as described in the official documentation.
|
||||
* @param path New path, as described in the official documentation.
|
||||
*/
|
||||
void rename(std::string old, std::string path);
|
||||
void rename(const std::string &old, const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [rename](http://linux.die.net/man/2/rename).
|
||||
@ -1067,7 +1067,7 @@ public:
|
||||
* @param path New path, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool renameSync(std::string old, std::string path);
|
||||
bool renameSync(const std::string &old, const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Copies a file asynchronously from a path to a new one.
|
||||
@ -1098,7 +1098,7 @@ public:
|
||||
* @param path New path, as described in the official documentation.
|
||||
* @param flags Optional additional flags.
|
||||
*/
|
||||
void copyfile(std::string old, std::string path, Flags<CopyFile> flags = Flags<CopyFile>{});
|
||||
void copyfile(const std::string &old, const std::string &path, Flags<CopyFile> flags = Flags<CopyFile>{});
|
||||
|
||||
/**
|
||||
* @brief Copies a file synchronously from a path to a new one.
|
||||
@ -1119,7 +1119,7 @@ public:
|
||||
* @param flags Optional additional flags.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool copyfileSync(std::string old, std::string path, Flags<CopyFile> flags = Flags<CopyFile>{});
|
||||
bool copyfileSync(const std::string &old, const std::string &path, Flags<CopyFile> flags = Flags<CopyFile>{});
|
||||
|
||||
/**
|
||||
* @brief Async [access](http://linux.die.net/man/2/access).
|
||||
@ -1130,7 +1130,7 @@ public:
|
||||
* @param path Path, as described in the official documentation.
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
*/
|
||||
void access(std::string path, int mode);
|
||||
void access(const std::string &path, int mode);
|
||||
|
||||
/**
|
||||
* @brief Sync [access](http://linux.die.net/man/2/access).
|
||||
@ -1138,7 +1138,7 @@ public:
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool accessSync(std::string path, int mode);
|
||||
bool accessSync(const std::string &path, int mode);
|
||||
|
||||
/**
|
||||
* @brief Async [chmod](http://linux.die.net/man/2/chmod).
|
||||
@ -1149,7 +1149,7 @@ public:
|
||||
* @param path Path, as described in the official documentation.
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
*/
|
||||
void chmod(std::string path, int mode);
|
||||
void chmod(const std::string &path, int mode);
|
||||
|
||||
/**
|
||||
* @brief Sync [chmod](http://linux.die.net/man/2/chmod).
|
||||
@ -1157,7 +1157,7 @@ public:
|
||||
* @param mode Mode, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool chmodSync(std::string path, int mode);
|
||||
bool chmodSync(const std::string &path, int mode);
|
||||
|
||||
/**
|
||||
* @brief Async [utime](http://linux.die.net/man/2/utime).
|
||||
@ -1171,7 +1171,7 @@ public:
|
||||
* @param mtime `std::chrono::duration<double>`, having the same meaning as
|
||||
* described in the official documentation.
|
||||
*/
|
||||
void utime(std::string path, Time atime, Time mtime);
|
||||
void utime(const std::string &path, Time atime, Time mtime);
|
||||
|
||||
/**
|
||||
* @brief Sync [utime](http://linux.die.net/man/2/utime).
|
||||
@ -1182,7 +1182,7 @@ public:
|
||||
* described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool utimeSync(std::string path, Time atime, Time mtime);
|
||||
bool utimeSync(const std::string &path, Time atime, Time mtime);
|
||||
|
||||
/**
|
||||
* @brief Async [link](http://linux.die.net/man/2/link).
|
||||
@ -1193,7 +1193,7 @@ public:
|
||||
* @param old Old path, as described in the official documentation.
|
||||
* @param path New path, as described in the official documentation.
|
||||
*/
|
||||
void link(std::string old, std::string path);
|
||||
void link(const std::string &old, const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [link](http://linux.die.net/man/2/link).
|
||||
@ -1201,7 +1201,7 @@ public:
|
||||
* @param path New path, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool linkSync(std::string old, std::string path);
|
||||
bool linkSync(const std::string &old, const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [symlink](http://linux.die.net/man/2/symlink).
|
||||
@ -1220,7 +1220,7 @@ public:
|
||||
* @param path New path, as described in the official documentation.
|
||||
* @param flags Optional additional flags.
|
||||
*/
|
||||
void symlink(std::string old, std::string path, Flags<SymLink> flags = Flags<SymLink>{});
|
||||
void symlink(const std::string &old, const std::string &path, Flags<SymLink> flags = Flags<SymLink>{});
|
||||
|
||||
/**
|
||||
* @brief Sync [symlink](http://linux.die.net/man/2/symlink).
|
||||
@ -1237,7 +1237,7 @@ public:
|
||||
* @param flags Flags, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool symlinkSync(std::string old, std::string path, Flags<SymLink> flags = Flags<SymLink>{});
|
||||
bool symlinkSync(const std::string &old, const std::string &path, Flags<SymLink> flags = Flags<SymLink>{});
|
||||
|
||||
/**
|
||||
* @brief Async [readlink](http://linux.die.net/man/2/readlink).
|
||||
@ -1247,7 +1247,7 @@ public:
|
||||
*
|
||||
* @param path Path, as described in the official documentation.
|
||||
*/
|
||||
void readlink(std::string path);
|
||||
void readlink(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [readlink](http://linux.die.net/man/2/readlink).
|
||||
@ -1260,7 +1260,7 @@ public:
|
||||
* * A bunch of data read from the given path.
|
||||
* * The amount of data read from the given path.
|
||||
*/
|
||||
std::pair<bool, std::pair<const char *, std::size_t>> readlinkSync(std::string path);
|
||||
std::pair<bool, std::pair<const char *, std::size_t>> readlinkSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [realpath](http://linux.die.net/man/3/realpath).
|
||||
@ -1270,7 +1270,7 @@ public:
|
||||
*
|
||||
* @param path Path, as described in the official documentation.
|
||||
*/
|
||||
void realpath(std::string path);
|
||||
void realpath(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Sync [realpath](http://linux.die.net/man/3/realpath).
|
||||
@ -1281,7 +1281,7 @@ public:
|
||||
* * A boolean value that is true in case of success, false otherwise.
|
||||
* * The canonicalized absolute pathname.
|
||||
*/
|
||||
std::pair<bool, const char *> realpathSync(std::string path);
|
||||
std::pair<bool, const char *> realpathSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Async [chown](http://linux.die.net/man/2/chown).
|
||||
@ -1293,7 +1293,7 @@ public:
|
||||
* @param uid UID, as described in the official documentation.
|
||||
* @param gid GID, as described in the official documentation.
|
||||
*/
|
||||
void chown(std::string path, Uid uid, Gid gid);
|
||||
void chown(const std::string &path, Uid uid, Gid gid);
|
||||
|
||||
/**
|
||||
* @brief Sync [chown](http://linux.die.net/man/2/chown).
|
||||
@ -1302,7 +1302,7 @@ public:
|
||||
* @param gid GID, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool chownSync(std::string path, Uid uid, Gid gid);
|
||||
bool chownSync(const std::string &path, Uid uid, Gid gid);
|
||||
|
||||
/**
|
||||
* @brief Async [lchown](https://linux.die.net/man/2/lchown).
|
||||
@ -1314,7 +1314,7 @@ public:
|
||||
* @param uid UID, as described in the official documentation.
|
||||
* @param gid GID, as described in the official documentation.
|
||||
*/
|
||||
void lchown(std::string path, Uid uid, Gid gid);
|
||||
void lchown(const std::string &path, Uid uid, Gid gid);
|
||||
|
||||
/**
|
||||
* @brief Sync [lchown](https://linux.die.net/man/2/lchown).
|
||||
@ -1323,7 +1323,7 @@ public:
|
||||
* @param gid GID, as described in the official documentation.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool lchownSync(std::string path, Uid uid, Gid gid);
|
||||
bool lchownSync(const std::string &path, Uid uid, Gid gid);
|
||||
|
||||
/**
|
||||
* @brief Opens a path asynchronously as a directory stream.
|
||||
@ -1337,7 +1337,7 @@ public:
|
||||
*
|
||||
* @param path The path to open as a directory stream.
|
||||
*/
|
||||
void opendir(std::string path);
|
||||
void opendir(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Opens a path synchronously as a directory stream.
|
||||
@ -1349,7 +1349,7 @@ public:
|
||||
* @param path The path to open as a directory stream.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
bool opendirSync(std::string path);
|
||||
bool opendirSync(const std::string &path);
|
||||
|
||||
/**
|
||||
* @brief Closes asynchronously a directory stream.
|
||||
@ -1459,4 +1459,5 @@ struct FsHelper {
|
||||
#include "fs.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_FS_INCLUDE_H
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
@ -31,12 +30,12 @@ UVW_INLINE bool FsEventHandle::init() {
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsEventHandle::start(std::string path, Flags<Event> flags) {
|
||||
UVW_INLINE void FsEventHandle::start(const std::string &path, Flags<Event> flags) {
|
||||
invoke(&uv_fs_event_start, get(), &startCallback, path.data(), flags);
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsEventHandle::start(std::string path, FsEventHandle::Event flag) {
|
||||
UVW_INLINE void FsEventHandle::start(const std::string &path, FsEventHandle::Event flag) {
|
||||
start(std::move(path), Flags<Event>{flag});
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ public:
|
||||
* @param path The file or directory to be monitored.
|
||||
* @param flags Additional flags to control the behavior.
|
||||
*/
|
||||
void start(std::string path, Flags<Event> flags = Flags<Event>{});
|
||||
void start(const std::string &path, Flags<Event> flags = Flags<Event>{});
|
||||
|
||||
/**
|
||||
* @brief Starts watching the specified path.
|
||||
@ -124,7 +124,7 @@ public:
|
||||
* @param path The file or directory to be monitored.
|
||||
* @param flag Additional flag to control the behavior.
|
||||
*/
|
||||
void start(std::string path, Event flag);
|
||||
void start(const std::string &path, Event flag);
|
||||
|
||||
/**
|
||||
* @brief Stops polling the file descriptor.
|
||||
@ -146,4 +146,5 @@ public:
|
||||
#include "fs_event.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_FS_EVENT_INCLUDE_H
|
||||
|
||||
@ -31,7 +31,7 @@ UVW_INLINE bool FsPollHandle::init() {
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void FsPollHandle::start(std::string file, FsPollHandle::Time interval) {
|
||||
UVW_INLINE void FsPollHandle::start(const std::string &file, FsPollHandle::Time interval) {
|
||||
invoke(&uv_fs_poll_start, get(), &startCallback, file.data(), interval.count());
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
* @param file The path to the file to be checked.
|
||||
* @param interval Milliseconds between successive checks.
|
||||
*/
|
||||
void start(std::string file, Time interval);
|
||||
void start(const std::string &file, Time interval);
|
||||
|
||||
/**
|
||||
* @brief Stops the handle.
|
||||
@ -80,4 +80,5 @@ public:
|
||||
#include "fs_poll.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_FS_POLL_INCLUDE_H
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
namespace uvw {
|
||||
|
||||
|
||||
UVW_INLINE SharedLib::SharedLib(UnderlyingType<SharedLib, uv_lib_t>::ConstructorAccess ca, std::shared_ptr<Loop> ref, std::string filename) noexcept
|
||||
UVW_INLINE SharedLib::SharedLib(UnderlyingType<SharedLib, uv_lib_t>::ConstructorAccess ca, std::shared_ptr<Loop> ref, const std::string &filename) noexcept
|
||||
: UnderlyingType{ca, std::move(ref)}
|
||||
{
|
||||
opened = (0 == uv_dlopen(filename.data(), get()));
|
||||
|
||||
@ -21,7 +21,7 @@ namespace uvw {
|
||||
*/
|
||||
class SharedLib final: public UnderlyingType<SharedLib, uv_lib_t> {
|
||||
public:
|
||||
explicit SharedLib(ConstructorAccess ca, std::shared_ptr<Loop> ref, std::string filename) noexcept;
|
||||
explicit SharedLib(ConstructorAccess ca, std::shared_ptr<Loop> ref, const std::string &filename) noexcept;
|
||||
|
||||
~SharedLib() noexcept;
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
* @return A valid function pointer in case of success, `nullptr` otherwise.
|
||||
*/
|
||||
template<typename F>
|
||||
F * sym(std::string name) {
|
||||
F * sym(const std::string &name) {
|
||||
static_assert(std::is_function_v<F>);
|
||||
F *func;
|
||||
auto err = uv_dlsym(get(), name.data(), reinterpret_cast<void**>(&func));
|
||||
@ -67,4 +67,5 @@ private:
|
||||
#include "lib.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_LIB_INCLUDE_H
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
@ -25,12 +24,12 @@ UVW_INLINE void PipeHandle::open(FileHandle file) {
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void PipeHandle::bind(std::string name) {
|
||||
UVW_INLINE void PipeHandle::bind(const std::string &name) {
|
||||
invoke(&uv_pipe_bind, get(), name.data());
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE void PipeHandle::connect(std::string name) {
|
||||
UVW_INLINE void PipeHandle::connect(const std::string &name) {
|
||||
auto listener = [ptr = shared_from_this()](const auto &event, const auto &) {
|
||||
ptr->publish(event);
|
||||
};
|
||||
|
||||
@ -69,7 +69,7 @@ public:
|
||||
*
|
||||
* @param name A valid file path.
|
||||
*/
|
||||
void bind(std::string name);
|
||||
void bind(const std::string &name);
|
||||
|
||||
/**
|
||||
* @brief Connects to the Unix domain socket or the named pipe.
|
||||
@ -81,7 +81,7 @@ public:
|
||||
*
|
||||
* @param name A valid domain socket or named pipe.
|
||||
*/
|
||||
void connect(std::string name);
|
||||
void connect(const std::string &name);
|
||||
|
||||
/**
|
||||
* @brief Gets the name of the Unix domain socket or the named pipe.
|
||||
@ -164,4 +164,5 @@ private:
|
||||
#include "pipe.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_PIPE_INCLUDE_H
|
||||
|
||||
@ -82,7 +82,7 @@ UVW_INLINE int ProcessHandle::pid() noexcept {
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE ProcessHandle &ProcessHandle::cwd(std::string path) noexcept {
|
||||
UVW_INLINE ProcessHandle &ProcessHandle::cwd(const std::string &path) noexcept {
|
||||
poCwd = path;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ public:
|
||||
* @param path The working directory to be used when `spawn()` is invoked.
|
||||
* @return A reference to this process handle.
|
||||
*/
|
||||
ProcessHandle & cwd(std::string path) noexcept;
|
||||
ProcessHandle & cwd(const std::string &path) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Sets flags that control how `spawn()` behaves.
|
||||
@ -251,4 +251,5 @@ private:
|
||||
#include "process.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_PROCESS_INCLUDE_H
|
||||
|
||||
@ -44,7 +44,7 @@ UVW_INLINE void TCPHandle::bind(const sockaddr &addr, Flags<Bind> opts) {
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE void TCPHandle::bind(std::string ip, unsigned int port, Flags<Bind> opts)
|
||||
UVW_INLINE void TCPHandle::bind(const std::string &ip, unsigned int port, Flags<Bind> opts)
|
||||
{
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
@ -71,7 +71,7 @@ UVW_INLINE Addr TCPHandle::peer() const noexcept {
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE void TCPHandle::connect(std::string ip, unsigned int port) {
|
||||
UVW_INLINE void TCPHandle::connect(const std::string &ip, unsigned int port) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
connect(reinterpret_cast<const sockaddr &>(addr));
|
||||
@ -103,8 +103,8 @@ UVW_INLINE void TCPHandle::closeReset() {
|
||||
|
||||
// explicit instantiations
|
||||
#ifdef UVW_AS_LIB
|
||||
template void TCPHandle::bind<IPv4>(std::string, unsigned int, Flags<Bind>);
|
||||
template void TCPHandle::bind<IPv6>(std::string, unsigned int, Flags<Bind>);
|
||||
template void TCPHandle::bind<IPv4>(const std::string &, unsigned int, Flags<Bind>);
|
||||
template void TCPHandle::bind<IPv6>(const std::string &, unsigned int, Flags<Bind>);
|
||||
|
||||
template void TCPHandle::bind<IPv4>(Addr, Flags<Bind>);
|
||||
template void TCPHandle::bind<IPv6>(Addr, Flags<Bind>);
|
||||
@ -115,11 +115,12 @@ template Addr TCPHandle::sock<IPv6>() const noexcept;
|
||||
template Addr TCPHandle::peer<IPv4>() const noexcept;
|
||||
template Addr TCPHandle::peer<IPv6>() const noexcept;
|
||||
|
||||
template void TCPHandle::connect<IPv4>(std::string, unsigned int);
|
||||
template void TCPHandle::connect<IPv6>(std::string, unsigned int);
|
||||
template void TCPHandle::connect<IPv4>(const std::string &, unsigned int);
|
||||
template void TCPHandle::connect<IPv6>(const std::string &, unsigned int);
|
||||
|
||||
template void TCPHandle::connect<IPv4>(Addr addr);
|
||||
template void TCPHandle::connect<IPv6>(Addr addr);
|
||||
#endif // UVW_AS_LIB
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ public:
|
||||
* @param opts Optional additional flags.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
void bind(std::string ip, unsigned int port, Flags<Bind> opts = Flags<Bind>{});
|
||||
void bind(const std::string &ip, unsigned int port, Flags<Bind> opts = Flags<Bind>{});
|
||||
|
||||
/**
|
||||
* @brief Binds the handle to an address and port.
|
||||
@ -197,7 +197,7 @@ public:
|
||||
* @param port The port to which to bind.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
void connect(std::string ip, unsigned int port);
|
||||
void connect(const std::string &ip, unsigned int port);
|
||||
|
||||
/**
|
||||
* @brief Establishes an IPv4 or IPv6 TCP connection.
|
||||
@ -238,8 +238,8 @@ private:
|
||||
|
||||
// (extern) explicit instantiations
|
||||
#ifdef UVW_AS_LIB
|
||||
extern template void TCPHandle::bind<IPv4>(std::string, unsigned int, Flags<Bind>);
|
||||
extern template void TCPHandle::bind<IPv6>(std::string, unsigned int, Flags<Bind>);
|
||||
extern template void TCPHandle::bind<IPv4>(const std::string &, unsigned int, Flags<Bind>);
|
||||
extern template void TCPHandle::bind<IPv6>(const std::string &, unsigned int, Flags<Bind>);
|
||||
|
||||
extern template void TCPHandle::bind<IPv4>(Addr, Flags<Bind>);
|
||||
extern template void TCPHandle::bind<IPv6>(Addr, Flags<Bind>);
|
||||
@ -250,13 +250,14 @@ extern template Addr TCPHandle::sock<IPv6>() const noexcept;
|
||||
extern template Addr TCPHandle::peer<IPv4>() const noexcept;
|
||||
extern template Addr TCPHandle::peer<IPv6>() const noexcept;
|
||||
|
||||
extern template void TCPHandle::connect<IPv4>(std::string, unsigned int);
|
||||
extern template void TCPHandle::connect<IPv6>(std::string, unsigned int);
|
||||
extern template void TCPHandle::connect<IPv4>(const std::string &, unsigned int);
|
||||
extern template void TCPHandle::connect<IPv6>(const std::string &, unsigned int);
|
||||
|
||||
extern template void TCPHandle::connect<IPv4>(Addr addr);
|
||||
extern template void TCPHandle::connect<IPv6>(Addr addr);
|
||||
#endif // UVW_AS_LIB
|
||||
|
||||
|
||||
/**
|
||||
* Internal details not to be documented.
|
||||
* @endcond
|
||||
@ -270,4 +271,5 @@ extern template void TCPHandle::connect<IPv6>(Addr addr);
|
||||
#include "tcp.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_TCP_INCLUDE_H
|
||||
|
||||
@ -51,7 +51,7 @@ UVW_INLINE void UDPHandle::connect(const sockaddr &addr) {
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE void UDPHandle::connect(std::string ip, unsigned int port) {
|
||||
UVW_INLINE void UDPHandle::connect(const std::string &ip, unsigned int port) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
connect(reinterpret_cast<const sockaddr &>(addr));
|
||||
@ -76,7 +76,7 @@ UVW_INLINE Addr UDPHandle::peer() const noexcept {
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE void UDPHandle::bind(std::string ip, unsigned int port, Flags<Bind> opts) {
|
||||
UVW_INLINE void UDPHandle::bind(const std::string &ip, unsigned int port, Flags<Bind> opts) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
bind(reinterpret_cast<const sockaddr &>(addr), std::move(opts));
|
||||
@ -96,7 +96,7 @@ UVW_INLINE Addr UDPHandle::sock() const noexcept {
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE bool UDPHandle::multicastMembership(std::string multicast, std::string iface, Membership membership) {
|
||||
UVW_INLINE bool UDPHandle::multicastMembership(const std::string &multicast, const std::string &iface, Membership membership) {
|
||||
return (0 == uv_udp_set_membership(get(), multicast.data(), iface.data(), static_cast<uv_membership>(membership)));
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ UVW_INLINE bool UDPHandle::multicastTtl(int val) {
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE bool UDPHandle::multicastInterface(std::string iface) {
|
||||
UVW_INLINE bool UDPHandle::multicastInterface(const std::string &iface) {
|
||||
return (0 == uv_udp_set_multicast_interface(get(), iface.data()));
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ UVW_INLINE void UDPHandle::send(const sockaddr &addr, std::unique_ptr<char[]> da
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE void UDPHandle::send(std::string ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len) {
|
||||
UVW_INLINE void UDPHandle::send(const std::string &ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
send(reinterpret_cast<const sockaddr &>(addr), std::move(data), len);
|
||||
@ -173,7 +173,7 @@ UVW_INLINE void UDPHandle::send(const sockaddr &addr, char *data, unsigned int l
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE void UDPHandle::send(std::string ip, unsigned int port, char *data, unsigned int len) {
|
||||
UVW_INLINE void UDPHandle::send(const std::string &ip, unsigned int port, char *data, unsigned int len) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
send(reinterpret_cast<const sockaddr &>(addr), data, len);
|
||||
@ -201,7 +201,7 @@ UVW_INLINE int UDPHandle::trySend(const sockaddr &addr, std::unique_ptr<char[]>
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE int UDPHandle::trySend(std::string ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len) {
|
||||
UVW_INLINE int UDPHandle::trySend(const std::string &ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
return trySend(reinterpret_cast<const sockaddr &>(addr), std::move(data), len);
|
||||
@ -229,7 +229,7 @@ UVW_INLINE int UDPHandle::trySend(const sockaddr &addr, char *data, unsigned int
|
||||
|
||||
|
||||
template<typename I>
|
||||
UVW_INLINE int UDPHandle::trySend(std::string ip, unsigned int port, char *data, unsigned int len) {
|
||||
UVW_INLINE int UDPHandle::trySend(const std::string &ip, unsigned int port, char *data, unsigned int len) {
|
||||
typename details::IpTraits<I>::Type addr;
|
||||
details::IpTraits<I>::addrFunc(ip.data(), port, &addr);
|
||||
return trySend(reinterpret_cast<const sockaddr &>(addr), data, len);
|
||||
@ -265,8 +265,8 @@ UVW_INLINE size_t UDPHandle::sendQueueCount() const noexcept {
|
||||
|
||||
// explicit instantiations
|
||||
#ifdef UVW_AS_LIB
|
||||
template void UDPHandle::connect<IPv4>(std::string, unsigned int);
|
||||
template void UDPHandle::connect<IPv6>(std::string, unsigned int);
|
||||
template void UDPHandle::connect<IPv4>(const std::string &, unsigned int);
|
||||
template void UDPHandle::connect<IPv6>(const std::string &, unsigned int);
|
||||
|
||||
template void UDPHandle::connect<IPv4>(Addr);
|
||||
template void UDPHandle::connect<IPv6>(Addr);
|
||||
@ -274,8 +274,8 @@ template void UDPHandle::connect<IPv6>(Addr);
|
||||
template Addr UDPHandle::peer<IPv4>() const noexcept;
|
||||
template Addr UDPHandle::peer<IPv6>() const noexcept;
|
||||
|
||||
template void UDPHandle::bind<IPv4>(std::string, unsigned int, Flags<Bind>);
|
||||
template void UDPHandle::bind<IPv6>(std::string, unsigned int, Flags<Bind>);
|
||||
template void UDPHandle::bind<IPv4>(const std::string &, unsigned int, Flags<Bind>);
|
||||
template void UDPHandle::bind<IPv6>(const std::string &, unsigned int, Flags<Bind>);
|
||||
|
||||
template void UDPHandle::bind<IPv4>(Addr, Flags<Bind>);
|
||||
template void UDPHandle::bind<IPv6>(Addr, Flags<Bind>);
|
||||
@ -283,20 +283,20 @@ template void UDPHandle::bind<IPv6>(Addr, Flags<Bind>);
|
||||
template Addr UDPHandle::sock<IPv4>() const noexcept;
|
||||
template Addr UDPHandle::sock<IPv6>() const noexcept;
|
||||
|
||||
template bool UDPHandle::multicastMembership<IPv4>(std::string, std::string, Membership);
|
||||
template bool UDPHandle::multicastMembership<IPv6>(std::string, std::string, Membership);
|
||||
template bool UDPHandle::multicastMembership<IPv4>(const std::string &, const std::string &, Membership);
|
||||
template bool UDPHandle::multicastMembership<IPv6>(const std::string &, const std::string &, Membership);
|
||||
|
||||
template bool UDPHandle::multicastInterface<IPv4>(std::string);
|
||||
template bool UDPHandle::multicastInterface<IPv6>(std::string);
|
||||
template bool UDPHandle::multicastInterface<IPv4>(const std::string &);
|
||||
template bool UDPHandle::multicastInterface<IPv6>(const std::string &);
|
||||
|
||||
template void UDPHandle::send<IPv4>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
template void UDPHandle::send<IPv6>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
template void UDPHandle::send<IPv4>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
template void UDPHandle::send<IPv6>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
template void UDPHandle::send<IPv4>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
template void UDPHandle::send<IPv6>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
template void UDPHandle::send<IPv4>(std::string, unsigned int, char *, unsigned int);
|
||||
template void UDPHandle::send<IPv6>(std::string, unsigned int, char *, unsigned int);
|
||||
template void UDPHandle::send<IPv4>(const std::string &, unsigned int, char *, unsigned int);
|
||||
template void UDPHandle::send<IPv6>(const std::string &, unsigned int, char *, unsigned int);
|
||||
|
||||
template void UDPHandle::send<IPv4>(Addr, char *, unsigned int);
|
||||
template void UDPHandle::send<IPv6>(Addr, char *, unsigned int);
|
||||
@ -304,8 +304,8 @@ template void UDPHandle::send<IPv6>(Addr, char *, unsigned int);
|
||||
template int UDPHandle::trySend<IPv4>(const sockaddr &, std::unique_ptr<char[]>, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(const sockaddr &, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
template int UDPHandle::trySend<IPv4>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
template int UDPHandle::trySend<IPv4>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
template int UDPHandle::trySend<IPv4>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
@ -313,8 +313,8 @@ template int UDPHandle::trySend<IPv6>(Addr, std::unique_ptr<char[]>, unsigned in
|
||||
template int UDPHandle::trySend<IPv4>(const sockaddr &, char *, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(const sockaddr &, char *, unsigned int);
|
||||
|
||||
template int UDPHandle::trySend<IPv4>(std::string, unsigned int, char *, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(std::string, unsigned int, char *, unsigned int);
|
||||
template int UDPHandle::trySend<IPv4>(const std::string &, unsigned int, char *, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(const std::string &, unsigned int, char *, unsigned int);
|
||||
|
||||
template int UDPHandle::trySend<IPv4>(Addr, char *, unsigned int);
|
||||
template int UDPHandle::trySend<IPv6>(Addr, char *, unsigned int);
|
||||
@ -323,4 +323,5 @@ template void UDPHandle::recv<IPv4>();
|
||||
template void UDPHandle::recv<IPv6>();
|
||||
#endif // UVW_AS_LIB
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ public:
|
||||
* @param port The port to which to bind.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
void connect(std::string ip, unsigned int port);
|
||||
void connect(const std::string &ip, unsigned int port);
|
||||
|
||||
/**
|
||||
* @brief Associates the handle to a remote address and port (either IPv4 or
|
||||
@ -248,7 +248,7 @@ public:
|
||||
* @param opts Optional additional flags.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
void bind(std::string ip, unsigned int port, Flags<Bind> opts = Flags<Bind>{});
|
||||
void bind(const std::string &ip, unsigned int port, Flags<Bind> opts = Flags<Bind>{});
|
||||
|
||||
/**
|
||||
* @brief Binds the UDP handle to an IP address and port.
|
||||
@ -293,7 +293,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
bool multicastMembership(std::string multicast, std::string iface, Membership membership);
|
||||
bool multicastMembership(const std::string &multicast, const std::string &iface, Membership membership);
|
||||
|
||||
/**
|
||||
* @brief Sets IP multicast loop flag.
|
||||
@ -318,7 +318,7 @@ public:
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
bool multicastInterface(std::string iface);
|
||||
bool multicastInterface(const std::string &iface);
|
||||
|
||||
/**
|
||||
* @brief Sets broadcast on or off.
|
||||
@ -372,7 +372,7 @@ public:
|
||||
* @param len The lenght of the submitted data.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
void send(std::string ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len);
|
||||
void send(const std::string &ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len);
|
||||
|
||||
/**
|
||||
* @brief Sends data over the UDP socket.
|
||||
@ -432,7 +432,7 @@ public:
|
||||
* @param len The lenght of the submitted data.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
void send(std::string ip, unsigned int port, char *data, unsigned int len);
|
||||
void send(const std::string &ip, unsigned int port, char *data, unsigned int len);
|
||||
|
||||
/**
|
||||
* @brief Sends data over the UDP socket.
|
||||
@ -481,7 +481,7 @@ public:
|
||||
* @return Number of bytes written.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
int trySend(std::string ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len);
|
||||
int trySend(const std::string &ip, unsigned int port, std::unique_ptr<char[]> data, unsigned int len);
|
||||
|
||||
/**
|
||||
* @brief Sends data over the UDP socket.
|
||||
@ -524,7 +524,7 @@ public:
|
||||
* @return Number of bytes written.
|
||||
*/
|
||||
template<typename I = IPv4>
|
||||
int trySend(std::string ip, unsigned int port, char *data, unsigned int len);
|
||||
int trySend(const std::string &ip, unsigned int port, char *data, unsigned int len);
|
||||
|
||||
/**
|
||||
* @brief Sends data over the UDP socket.
|
||||
@ -587,8 +587,8 @@ private:
|
||||
|
||||
// (extern) explicit instantiations
|
||||
#ifdef UVW_AS_LIB
|
||||
extern template void UDPHandle::connect<IPv4>(std::string, unsigned int);
|
||||
extern template void UDPHandle::connect<IPv6>(std::string, unsigned int);
|
||||
extern template void UDPHandle::connect<IPv4>(const std::string &, unsigned int);
|
||||
extern template void UDPHandle::connect<IPv6>(const std::string &, unsigned int);
|
||||
|
||||
extern template void UDPHandle::connect<IPv4>(Addr);
|
||||
extern template void UDPHandle::connect<IPv6>(Addr);
|
||||
@ -596,8 +596,8 @@ extern template void UDPHandle::connect<IPv6>(Addr);
|
||||
extern template Addr UDPHandle::peer<IPv4>() const noexcept;
|
||||
extern template Addr UDPHandle::peer<IPv6>() const noexcept;
|
||||
|
||||
extern template void UDPHandle::bind<IPv4>(std::string, unsigned int, Flags<Bind>);
|
||||
extern template void UDPHandle::bind<IPv6>(std::string, unsigned int, Flags<Bind>);
|
||||
extern template void UDPHandle::bind<IPv4>(const std::string &, unsigned int, Flags<Bind>);
|
||||
extern template void UDPHandle::bind<IPv6>(const std::string &, unsigned int, Flags<Bind>);
|
||||
|
||||
extern template void UDPHandle::bind<IPv4>(Addr, Flags<Bind>);
|
||||
extern template void UDPHandle::bind<IPv6>(Addr, Flags<Bind>);
|
||||
@ -605,20 +605,20 @@ extern template void UDPHandle::bind<IPv6>(Addr, Flags<Bind>);
|
||||
extern template Addr UDPHandle::sock<IPv4>() const noexcept;
|
||||
extern template Addr UDPHandle::sock<IPv6>() const noexcept;
|
||||
|
||||
extern template bool UDPHandle::multicastMembership<IPv4>(std::string, std::string, Membership);
|
||||
extern template bool UDPHandle::multicastMembership<IPv6>(std::string, std::string, Membership);
|
||||
extern template bool UDPHandle::multicastMembership<IPv4>(const std::string &, const std::string &, Membership);
|
||||
extern template bool UDPHandle::multicastMembership<IPv6>(const std::string &, const std::string &, Membership);
|
||||
|
||||
extern template bool UDPHandle::multicastInterface<IPv4>(std::string);
|
||||
extern template bool UDPHandle::multicastInterface<IPv6>(std::string);
|
||||
extern template bool UDPHandle::multicastInterface<IPv4>(const std::string &);
|
||||
extern template bool UDPHandle::multicastInterface<IPv6>(const std::string &);
|
||||
|
||||
extern template void UDPHandle::send<IPv4>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template void UDPHandle::send<IPv6>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template void UDPHandle::send<IPv4>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template void UDPHandle::send<IPv6>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
extern template void UDPHandle::send<IPv4>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template void UDPHandle::send<IPv6>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
extern template void UDPHandle::send<IPv4>(std::string, unsigned int, char *, unsigned int);
|
||||
extern template void UDPHandle::send<IPv6>(std::string, unsigned int, char *, unsigned int);
|
||||
extern template void UDPHandle::send<IPv4>(const std::string &, unsigned int, char *, unsigned int);
|
||||
extern template void UDPHandle::send<IPv6>(const std::string &, unsigned int, char *, unsigned int);
|
||||
|
||||
extern template void UDPHandle::send<IPv4>(Addr, char *, unsigned int);
|
||||
extern template void UDPHandle::send<IPv6>(Addr, char *, unsigned int);
|
||||
@ -626,8 +626,8 @@ extern template void UDPHandle::send<IPv6>(Addr, char *, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv4>(const sockaddr &, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(const sockaddr &, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
extern template int UDPHandle::trySend<IPv4>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(std::string, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv4>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(const std::string &, unsigned int, std::unique_ptr<char[]>, unsigned int);
|
||||
|
||||
extern template int UDPHandle::trySend<IPv4>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(Addr, std::unique_ptr<char[]>, unsigned int);
|
||||
@ -635,8 +635,8 @@ extern template int UDPHandle::trySend<IPv6>(Addr, std::unique_ptr<char[]>, unsi
|
||||
extern template int UDPHandle::trySend<IPv4>(const sockaddr &, char *, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(const sockaddr &, char *, unsigned int);
|
||||
|
||||
extern template int UDPHandle::trySend<IPv4>(std::string, unsigned int, char *, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(std::string, unsigned int, char *, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv4>(const std::string &, unsigned int, char *, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(const std::string &, unsigned int, char *, unsigned int);
|
||||
|
||||
extern template int UDPHandle::trySend<IPv4>(Addr, char *, unsigned int);
|
||||
extern template int UDPHandle::trySend<IPv6>(Addr, char *, unsigned int);
|
||||
@ -645,6 +645,7 @@ extern template void UDPHandle::recv<IPv4>();
|
||||
extern template void UDPHandle::recv<IPv6>();
|
||||
#endif // UVW_AS_LIB
|
||||
|
||||
|
||||
/**
|
||||
* Internal details not to be documented.
|
||||
* @endcond
|
||||
@ -658,4 +659,5 @@ extern template void UDPHandle::recv<IPv6>();
|
||||
#include "udp.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_UDP_INCLUDE_H
|
||||
|
||||
@ -278,7 +278,7 @@ UVW_INLINE std::string Utilities::processTitle() {
|
||||
}
|
||||
|
||||
|
||||
UVW_INLINE bool Utilities::processTitle(std::string title) {
|
||||
UVW_INLINE bool Utilities::processTitle(const std::string &title) {
|
||||
return (0 == uv_set_process_title(title.c_str()));
|
||||
}
|
||||
|
||||
|
||||
@ -742,7 +742,7 @@ struct Utilities {
|
||||
* @param title The process title to be set.
|
||||
* @return True in case of success, false otherwise.
|
||||
*/
|
||||
static bool processTitle(std::string title);
|
||||
static bool processTitle(const std::string &title);
|
||||
|
||||
/**
|
||||
* @brief Gets memory information (in bytes).
|
||||
@ -846,4 +846,5 @@ Overloaded(Func...) -> Overloaded<Func...>;
|
||||
#include "util.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UVW_UTIL_INCLUDE_H
|
||||
|
||||
Loading…
Reference in New Issue
Block a user