rename AdcEndpointPrser to AdcEndpoint

fixes
This commit is contained in:
Timur A. Fatkhullin
2024-11-02 23:59:20 +03:00
parent 75b42f40e5
commit fb43a2b378
5 changed files with 72 additions and 381 deletions

View File

@@ -108,7 +108,7 @@ int main(int argc, char* argv[])
"endpoints server will be listening for. For 'local' endpoint the '@' symbol at the beginning of the path "
"means "
"abstract namespace socket.",
cxxopts::value<std::vector<std::string>>()->default_value("local://stream/ADC_ASIO_TEST_SERVER"));
cxxopts::value<std::vector<std::string>>()->default_value("local://stream/@ADC_ASIO_TEST_SERVER"));
options.positional_help("[endpoint0] [enpoint1] ... [endpointN]");
@@ -144,13 +144,13 @@ int main(int argc, char* argv[])
auto epnt = opt_result["endpoints"].as<std::vector<std::string>>();
for (auto& ep : epnt) {
adc::AdcEndpointParser epn(ep);
adc::AdcEndpoint epn(ep);
if (epn.isValid()) {
if (epn.isLocalSeqpacket() || epn.isLocalStream()) {
if (epn.path()[0] == '@') { // replace '@' to '\0' (use of UNIX abstract namespace)
auto it = std::ranges::find(ep, '@');
*it = '\0';
epn = adc::AdcEndpointParser(ep);
epn = adc::AdcEndpoint(ep);
}
}

View File

@@ -85,7 +85,7 @@ TEST_CASE("[ADC NET MESSAGE]")
char ee[] = "tLs://dewlkK.dwed.dwed:8012/dwelk";
std::cout << "EPT CHAR RANGE: " << ee << "\n";
AdcEndpointParser prs(ee);
AdcEndpoint prs(ee);
std::cout << std::boolalpha << "IS VALID: " << prs.isValid() << "\n";
std::cout << "PROTO: [" << prs.proto() << "]\n";
@@ -100,7 +100,7 @@ TEST_CASE("[ADC NET MESSAGE]")
auto it = std::ranges::find(bs, '@');
*it = '\0';
std::cout << "EPT CHAR RANGE: " << bs << "\n";
prs = AdcEndpointParser(bs);
prs = AdcEndpoint(bs);
std::cout << std::boolalpha << "IS VALID: " << prs.isValid() << "\n";
std::cout << "PROTO: [" << prs.proto() << "]\n";
std::cout << "HOST: [" << prs.host() << "]\n";