26 : path_(std::move(other_path.path_))
32 std::hash<std::string> hasher{};
38 return path_.length();
53 const size_t last_sep_index = path_.rfind(
SEPARATOR);
54 if (last_sep_index == std::string::npos) {
63 return path_ == other_path.path_;
68 return !(*
this == other_path);
73 return path_ < other_path.path_;
80 return path_to_append;
82 if (!path_to_append) {
86 std::stringstream new_path;
87 new_path << path_ <<
SEPARATOR << path_to_append.path_;
91AssetCatalogPath::operator bool()
const
93 return !path_.empty();
98 stream << path_to_append.path_;
104 std::stringstream clean_components;
105 bool first_component_seen =
false;
111 if (clean_component.empty()) {
119 if (first_component_seen) {
122 first_component_seen =
true;
124 clean_components << clean_component;
132 std::string cleaned = component_name.
trim();
134 std::replace(cleaned.begin(), cleaned.end(),
':',
'-');
145 if (path_ == other_path.path_) {
158 const bool prefix_ok = this_path.
startswith(other_path.path_);
159 const char next_char = this_path[other_path.
length()];
160 return prefix_ok && next_char ==
SEPARATOR;
168 std::string::size_type last_sep_index = path_.rfind(
SEPARATOR);
169 if (last_sep_index == std::string::npos) {
177 const char *next_slash_ptr;
179 for (
const char *path_component = path_.data(); path_component && path_component[0];
181 path_component = next_slash_ptr ? next_slash_ptr + 1 :
nullptr)
187 const bool is_last_component = next_slash_ptr ==
nullptr;
189 const StringRef component_name = is_last_component ?
192 next_slash_ptr - path_component);
194 callback(component_name, is_last_component);
205 return to_path / *
this;
212 if (*
this == from_path) {
220 return to_path / path_suffix;
const char * BLI_path_slash_find(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
constexpr StringRef substr(int64_t start, int64_t size) const
constexpr bool startswith(StringRef prefix) const
constexpr StringRef trim() const
AssetCatalogPath parent() const
const std::string & str() const
AssetCatalogPath cleanup() const
const char * c_str() const
AssetCatalogPath rebase(const AssetCatalogPath &from_path, const AssetCatalogPath &to_path) const
AssetCatalogPath operator/(const AssetCatalogPath &path_to_append) const
AssetCatalogPath()=default
bool operator==(const AssetCatalogPath &other_path) const
bool operator!=(const AssetCatalogPath &other_path) const
bool is_contained_in(const AssetCatalogPath &other_path) const
void iterate_components(ComponentIteratorFn callback) const
static const char SEPARATOR
StringRefNull name() const
bool operator<(const AssetCatalogPath &other_path) const
static std::string cleanup_component(StringRef component_name)
DEGForeachIDComponentCallback callback
std::ostream & operator<<(std::ostream &stream, const AssetCatalogPath &path_to_append)
unsigned __int64 uint64_t