OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
ZipUnicodePathExtraField Struct Reference

Static Public Member Functions

static std::string encode (std::string const &u8path, std::string const &path)
static std::string decode (std::string const &extra, std::string const &path={})

Detailed Description

Member Function Documentation

◆ decode()

std::string ZipUnicodePathExtraField::decode ( std::string const & extra,
std::string const & path = {} )
inlinestatic
147 {}) {
148 char const * p = extra.data();
149 char const * e = p + extra.length();
150 while (p + 4 < e) {
151 boost::uint16_t len = ((boost::uint16_t)p[2]) | ((boost::uint16_t)p[3] << 8);
152 if (p[0] == '\x75' && p[1] == '\x70' && len >= 5 && p + 4 + len < e && p[4] == '\x01') {
153 return std::string(p + 9, p + 4 + len);
154 }
155 else {
156 p += 4 + len;
157 }
158 }
159 return Slic3r::decode_path(path.c_str());
160 }
std::string decode_path(const char *src)
Definition utils.cpp:1401

Referenced by Slic3r::_BBS_3MF_Importer::_extract_auxiliary_file_from_archive(), and Slic3r::_BBS_3MF_Importer::_extract_from_archive().

Here is the caller graph for this function:

◆ encode()

std::string ZipUnicodePathExtraField::encode ( std::string const & u8path,
std::string const & path )
inlinestatic
131 {
132 std::string extra;
133 if (u8path != path) {
134 // 0x7075 - for Unicode filenames
135 extra.push_back('\x75');
136 extra.push_back('\x70');
137 boost::uint16_t len = 5 + u8path.length();
138 extra.push_back((char)(len & 0xff));
139 extra.push_back((char)(len >> 8));
140 auto crc = mz_crc32(0, (unsigned char *) path.c_str(), path.length());
141 extra.push_back('\x01'); // version 1
142 extra.append((char *)&crc, (char *)&crc + 4); // Little Endian
143 extra.append(u8path);
144 }
145 return extra;
146 }

Referenced by Slic3r::_BBS_3MF_Exporter::_add_file_to_archive(), and Slic3r::_BBS_3MF_Exporter::_add_model_file_to_archive().

Here is the caller graph for this function:

The documentation for this struct was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Format/bbs_3mf.cpp