MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / Encode

Method Encode

libaegisub/common/path.cpp:115–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115std::string Path::Encode(fs::path const& path) const {
116 // Find the shortest encoding of path made relative to each token
117 std::string shortest = path.string();
118 size_t length = boost::distance(path);
119 for (size_t i = 0; i < paths.size(); ++i) {
120 if (paths[i].empty()) continue;
121
122 const auto p = MakeRelative(path, tokens[i]);
123 const size_t d = boost::distance(p);
124 if (d < length) {
125 length = d;
126 shortest = (tokens[i]/p).string();
127 }
128 }
129
130 return shortest;
131}
132
133void Path::SetToken(std::string_view token_name, fs::path const& token_value) {
134 int idx = checked_find_token(token_name);

Callers 1

TESTFunction · 0.80

Calls 2

stringMethod · 0.80
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64