Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::DnsRR_TXT Struct Reference
+ Collaboration diagram for Slic3r::DnsRR_TXT:

Public Types

enum  { TAG = 0x10 }
 

Static Public Member Functions

static optional< DnsRR_TXTdecode (const DnsResource &rr, const Bonjour::TxtKeys &txt_keys)
 

Public Attributes

BonjourReply::TxtData data
 

Detailed Description

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
TAG 
313 {
314 TAG = 0x10,
315 };
@ TAG
Definition Bonjour.cpp:314

Member Function Documentation

◆ decode()

static optional< DnsRR_TXT > Slic3r::DnsRR_TXT::decode ( const DnsResource rr,
const Bonjour::TxtKeys txt_keys 
)
inlinestatic
320 {
321 const size_t size = rr.data.size();
322 if (size < 2) {
323 return boost::none;
324 }
325
326 DnsRR_TXT res;
327
328 for (auto it = rr.data.begin(); it != rr.data.end(); ) {
329 unsigned val_size = static_cast<unsigned char>(*it);
330 if (val_size == 0 || it + val_size >= rr.data.end()) {
331 return boost::none;
332 }
333 ++it;
334
335 const auto it_end = it + val_size;
336 const auto it_eq = std::find(it, it_end, '=');
337 if (it_eq > it && it_eq < it_end - 1) {
338 std::string key(it_eq - it, ' ');
339 std::copy(it, it_eq, key.begin());
340
341 if (txt_keys.find(key) != txt_keys.end() || key == "path") {
342 // This key-value has been requested for
343 std::string value(it_end - it_eq - 1, ' ');
344 std::copy(it_eq + 1, it_end, value.begin());
345 res.data.insert(std::make_pair(std::move(key), std::move(value)));
346 }
347 }
348
349 it = it_end;
350 }
351
352 return std::move(res);
353 }
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References Slic3r::DnsResource::data, and data.

Referenced by Slic3r::DnsMessage::parse_rr().

+ Here is the caller graph for this function:

Member Data Documentation

◆ data

BonjourReply::TxtData Slic3r::DnsRR_TXT::data

Referenced by decode().


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