OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::BonjourReply Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/Bonjour.hpp>

Collaboration diagram for Slic3r::BonjourReply:

Public Types

typedef std::unordered_map< std::string, std::string > TxtData

Public Member Functions

 BonjourReply ()=delete
 BonjourReply (boost::asio::ip::address ip, uint16_t port, std::string service_name, std::string hostname, TxtData txt_data)
std::string path () const
bool operator== (const BonjourReply &other) const
bool operator< (const BonjourReply &other) const

Public Attributes

boost::asio::ip::address ip
uint16_t port
std::string service_name
std::string hostname
std::string full_address
TxtData txt_data

Detailed Description

Member Typedef Documentation

◆ TxtData

typedef std::unordered_map<std::string, std::string> Slic3r::BonjourReply::TxtData

Constructor & Destructor Documentation

◆ BonjourReply() [1/2]

Slic3r::BonjourReply::BonjourReply ( )
delete

References BonjourReply(), hostname, ip, port, service_name, and txt_data.

Referenced by BonjourReply(), operator<(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BonjourReply() [2/2]

Slic3r::BonjourReply::BonjourReply ( boost::asio::ip::address ip,
uint16_t port,
std::string service_name,
std::string hostname,
BonjourReply::TxtData txt_data )
1073 : ip(std::move(ip))
1074 , port(port)
1075 , service_name(std::move(service_name))
1076 , hostname(std::move(hostname))
1077 , txt_data(std::move(txt_data))
1078{
1079 std::string proto;
1080 std::string port_suffix;
1081 if (port == 443) { proto = "https://"; }
1082 if (port != 443 && port != 80) { port_suffix = std::to_string(port).insert(0, 1, ':'); }
1083
1084 std::string path = this->path();
1085 if (path[0] != '/') { path.insert(0, 1, '/'); }
1086 full_address = proto + ip.to_string() + port_suffix;
1087 if (path != "/") { full_address += path; }
1088 txt_data["path"] = std::move(path);
1089}
uint16_t port
Definition Bonjour.hpp:39
TxtData txt_data
Definition Bonjour.hpp:44
boost::asio::ip::address ip
Definition Bonjour.hpp:38
std::string full_address
Definition Bonjour.hpp:42
std::string path() const
Definition Bonjour.cpp:1091
std::string service_name
Definition Bonjour.hpp:40
std::string hostname
Definition Bonjour.hpp:41

References full_address, hostname, ip, path(), port, service_name, and txt_data.

Here is the call graph for this function:

Member Function Documentation

◆ operator<()

bool Slic3r::BonjourReply::operator< ( const BonjourReply & other) const
1104{
1105 if (this->ip != other.ip) {
1106 // So that the common case doesn't involve string comparison
1107 return this->ip < other.ip;
1108 } else {
1109 auto cmp = this->full_address.compare(other.full_address);
1110 return cmp != 0 ? cmp < 0 : this->service_name < other.service_name;
1111 }
1112}

References BonjourReply(), full_address, ip, and service_name.

Here is the call graph for this function:

◆ operator==()

bool Slic3r::BonjourReply::operator== ( const BonjourReply & other) const
1098{
1099 return this->full_address == other.full_address
1100 && this->service_name == other.service_name;
1101}

References BonjourReply(), full_address, and service_name.

Here is the call graph for this function:

◆ path()

std::string Slic3r::BonjourReply::path ( ) const
1092{
1093 const auto it = txt_data.find("path");
1094 return it != txt_data.end() ? it->second : std::string("/");
1095}

References txt_data.

Referenced by BonjourReply().

Here is the caller graph for this function:

Member Data Documentation

◆ full_address

std::string Slic3r::BonjourReply::full_address

◆ hostname

std::string Slic3r::BonjourReply::hostname

◆ ip

boost::asio::ip::address Slic3r::BonjourReply::ip

◆ port

uint16_t Slic3r::BonjourReply::port

Referenced by BonjourReply(), and BonjourReply().

◆ service_name

std::string Slic3r::BonjourReply::service_name

◆ txt_data


The documentation for this struct was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/Bonjour.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/Bonjour.cpp