Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::BonjourReply Struct Reference

#include <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

◆ 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 
)
1051 : ip(std::move(ip))
1052 , port(port)
1053 , service_name(std::move(service_name))
1054 , hostname(std::move(hostname))
1055 , txt_data(std::move(txt_data))
1056{
1057 std::string proto;
1058 std::string port_suffix;
1059 if (port == 443) { proto = "https://"; }
1060 if (port != 443 && port != 80) { port_suffix = std::to_string(port).insert(0, 1, ':'); }
1061
1062 std::string path = this->path();
1063 if (path[0] != '/') { path.insert(0, 1, '/'); }
1064 full_address = proto + ip.to_string() + port_suffix;
1065 if (path != "/") { full_address += path; }
1066 txt_data["path"] = std::move(path);
1067}
uint16_t port
Definition Bonjour.hpp:26
TxtData txt_data
Definition Bonjour.hpp:31
boost::asio::ip::address ip
Definition Bonjour.hpp:25
std::string full_address
Definition Bonjour.hpp:29
std::string path() const
Definition Bonjour.cpp:1069
std::string service_name
Definition Bonjour.hpp:27
std::string hostname
Definition Bonjour.hpp:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ operator<()

bool Slic3r::BonjourReply::operator< ( const BonjourReply other) const
1082{
1083 if (this->ip != other.ip) {
1084 // So that the common case doesn't involve string comparison
1085 return this->ip < other.ip;
1086 } else {
1087 auto cmp = this->full_address.compare(other.full_address);
1088 return cmp != 0 ? cmp < 0 : this->service_name < other.service_name;
1089 }
1090}

References full_address, ip, and service_name.

◆ operator==()

bool Slic3r::BonjourReply::operator== ( const BonjourReply other) const
1076{
1077 return this->full_address == other.full_address
1078 && this->service_name == other.service_name;
1079}

References full_address, and service_name.

◆ path()

std::string Slic3r::BonjourReply::path ( ) const
1070{
1071 const auto it = txt_data.find("path");
1072 return it != txt_data.end() ? it->second : std::string("/");
1073}

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

Referenced by Slic3r::operator<<().

◆ ip

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

◆ port

uint16_t Slic3r::BonjourReply::port

Referenced by BonjourReply().

◆ service_name

std::string Slic3r::BonjourReply::service_name

◆ txt_data

TxtData Slic3r::BonjourReply::txt_data

The documentation for this struct was generated from the following files: