change naming scheme (delete "snplib_" prefix)
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
namespace snplib
|
||||
{
|
||||
|
||||
class snplib_endpoint_t
|
||||
class net_endpoint_t
|
||||
{
|
||||
public:
|
||||
static constexpr std::string_view id{"SNPLIB-NET-ENDPOINT"};
|
||||
@@ -77,26 +77,26 @@ public:
|
||||
localProtoTypeSerial};
|
||||
|
||||
|
||||
template <snplib_input_char_range_c R>
|
||||
snplib_endpoint_t(const R& ept)
|
||||
template <input_char_range_c R>
|
||||
net_endpoint_t(const R& ept)
|
||||
{
|
||||
fromRange(ept);
|
||||
}
|
||||
|
||||
snplib_endpoint_t(const snplib_endpoint_t& other)
|
||||
net_endpoint_t(const net_endpoint_t& other)
|
||||
{
|
||||
copyInst(other);
|
||||
}
|
||||
|
||||
snplib_endpoint_t(snplib_endpoint_t&& other)
|
||||
net_endpoint_t(net_endpoint_t&& other)
|
||||
{
|
||||
moveInst(std::move(other));
|
||||
}
|
||||
|
||||
virtual ~snplib_endpoint_t() = default;
|
||||
virtual ~net_endpoint_t() = default;
|
||||
|
||||
|
||||
snplib_endpoint_t& operator=(const snplib_endpoint_t& other)
|
||||
net_endpoint_t& operator=(const net_endpoint_t& other)
|
||||
{
|
||||
copyInst(other);
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
snplib_endpoint_t& operator=(snplib_endpoint_t&& other)
|
||||
net_endpoint_t& operator=(net_endpoint_t&& other)
|
||||
{
|
||||
moveInst(std::move(other));
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
template <snplib_input_char_range_c R>
|
||||
template <input_char_range_c R>
|
||||
requires std::ranges::contiguous_range<R>
|
||||
bool fromRange(const R& ept)
|
||||
{
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
if (isLocal()) { // check for special values
|
||||
idx = 0;
|
||||
if (std::ranges::any_of(validLocalProtoTypes, [&idx, this](const auto& el) {
|
||||
bool ok = snplib_char_ranges_compare(_host, el, true);
|
||||
bool ok = char_ranges_compare(_host, el, true);
|
||||
if (!ok) {
|
||||
++idx;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
return _endpoint;
|
||||
}
|
||||
|
||||
template <snplib_view_or_output_char_range_c R>
|
||||
template <view_or_output_char_range_c R>
|
||||
R proto() const
|
||||
{
|
||||
return part<R>(PROTO_PART);
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
return proto<std::string_view>();
|
||||
}
|
||||
|
||||
template <snplib_view_or_output_char_range_c R>
|
||||
template <view_or_output_char_range_c R>
|
||||
R host() const
|
||||
{
|
||||
return part<R>(HOST_PART);
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
return _port;
|
||||
}
|
||||
|
||||
template <snplib_view_or_output_char_range_c R>
|
||||
template <view_or_output_char_range_c R>
|
||||
R portView() const
|
||||
{
|
||||
return part<R>(PORT_PART);
|
||||
@@ -249,11 +249,11 @@ public:
|
||||
return portView<std::string_view>();
|
||||
}
|
||||
|
||||
template <snplib_output_char_range_c R, snplib_input_char_range_c RR = std::string_view>
|
||||
template <output_char_range_c R, input_char_range_c RR = std::string_view>
|
||||
R path(RR&& root_path) const
|
||||
{
|
||||
if (_path.empty()) {
|
||||
if constexpr (snplib_output_char_range_c<R>) {
|
||||
if constexpr (output_char_range_c<R>) {
|
||||
R res;
|
||||
std::ranges::copy(std::forward<RR>(root_path), std::back_inserter(res));
|
||||
|
||||
@@ -285,13 +285,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template <snplib_input_char_range_c RR = std::string_view>
|
||||
template <input_char_range_c RR = std::string_view>
|
||||
std::string path(RR&& root_path) const
|
||||
{
|
||||
return path<std::string, RR>(std::forward<RR>(root_path));
|
||||
}
|
||||
|
||||
template <snplib_view_or_output_char_range_c R>
|
||||
template <view_or_output_char_range_c R>
|
||||
R path() const
|
||||
{
|
||||
return part<R>(PATH_PART);
|
||||
@@ -353,8 +353,8 @@ public:
|
||||
// add '\0' char (or replace special-meaning char/char-sequence) to construct UNIX abstract namespace
|
||||
// endpoint path
|
||||
template <typename T = std::nullptr_t>
|
||||
snplib_endpoint_t& makeAbstract(const T& mark = nullptr)
|
||||
requires(snplib_input_char_range_c<T> || std::same_as<std::remove_cv_t<T>, char> ||
|
||||
net_endpoint_t& makeAbstract(const T& mark = nullptr)
|
||||
requires(input_char_range_c<T> || std::same_as<std::remove_cv_t<T>, char> ||
|
||||
std::is_null_pointer_v<std::remove_cv_t<T>>)
|
||||
{
|
||||
if (!(isLocalStream() || isLocalSeqpacket())) { // only local proto is valid!
|
||||
@@ -393,8 +393,8 @@ protected:
|
||||
ssize_t idx = 0;
|
||||
|
||||
// case-insensitive look-up
|
||||
bool found = std::ranges::any_of(snplib_endpoint_t::validProtoMarks, [&idx, &proto_mark](const auto& el) {
|
||||
bool ok = snplib_char_ranges_compare(proto_mark, el, true);
|
||||
bool found = std::ranges::any_of(net_endpoint_t::validProtoMarks, [&idx, &proto_mark](const auto& el) {
|
||||
bool ok = char_ranges_compare(proto_mark, el, true);
|
||||
|
||||
if (!ok) {
|
||||
++idx;
|
||||
@@ -408,7 +408,7 @@ protected:
|
||||
|
||||
enum EndpointPart { PROTO_PART, HOST_PART, PATH_PART, PORT_PART };
|
||||
|
||||
template <snplib_view_or_output_char_range_c R>
|
||||
template <view_or_output_char_range_c R>
|
||||
R part(EndpointPart what) const
|
||||
{
|
||||
R res;
|
||||
@@ -445,7 +445,7 @@ protected:
|
||||
return res;
|
||||
}
|
||||
|
||||
void copyInst(const snplib_endpoint_t& other)
|
||||
void copyInst(const net_endpoint_t& other)
|
||||
{
|
||||
if (&other != this) {
|
||||
if (other._isValid) {
|
||||
@@ -481,7 +481,7 @@ protected:
|
||||
}
|
||||
|
||||
|
||||
void moveInst(snplib_endpoint_t&& other)
|
||||
void moveInst(net_endpoint_t&& other)
|
||||
{
|
||||
if (&other != this) {
|
||||
if (other._isValid) {
|
||||
|
||||
Reference in New Issue
Block a user