28 : path_(std::move(other_path.path_))
34 std::hash<std::string> hasher{};
35 return hasher(this->path_);
40 return this->path_.length();
45 return this->path_.c_str();
55 const size_t last_sep_index = this->path_.rfind(
SEPARATOR);
56 if (last_sep_index == std::string::npos) {
60 return StringRefNull(this->path_.c_str() + last_sep_index + 1);
65 return this->path_ == other_path.path_;
70 return !(*
this == other_path);
75 return this->path_ < other_path.path_;
82 return path_to_append;
84 if (!path_to_append) {
88 std::stringstream new_path;
89 new_path << this->path_ <<
SEPARATOR << path_to_append.path_;
93 AssetCatalogPath::operator
bool()
const
95 return !this->path_.empty();
100 stream << path_to_append.path_;
106 std::stringstream clean_components;
107 bool first_component_seen =
false;
113 if (clean_component.empty()) {
121 if (first_component_seen) {
124 first_component_seen =
true;
126 clean_components << clean_component;
136 std::replace(cleaned.begin(), cleaned.end(),
':',
'-');
147 if (this->path_ == other_path.path_) {
160 const bool prefix_ok = this_path.
startswith(other_path.path_);
161 const char next_char = this_path[other_path.
length()];
162 return prefix_ok && next_char ==
SEPARATOR;
171 if (last_sep_index == std::string::npos) {
179 const char *next_slash_ptr;
181 for (
const char *path_component = this->path_.data(); path_component && path_component[0];
183 path_component = next_slash_ptr ? next_slash_ptr + 1 :
nullptr) {
188 const bool is_last_component = next_slash_ptr ==
nullptr;
190 const StringRef component_name = is_last_component ?
193 next_slash_ptr - path_component);
195 callback(component_name, is_last_component);
206 return to_path / *
this;
213 if (*
this == from_path) {
221 return to_path / path_suffix;
const char * BLI_path_slash_find(const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
static uint8 component(Color32 c, uint i)
constexpr StringRef substr(int64_t start, int64_t size) const
constexpr bool startswith(StringRef prefix) const
const std::string & str() const
AssetCatalogPath operator/(const AssetCatalogPath &path_to_append) const
AssetCatalogPath cleanup() const
StringRefNull name() const
bool operator<(const AssetCatalogPath &other_path) const
const char * c_str() const
static const char SEPARATOR
bool is_contained_in(const AssetCatalogPath &other_path) const
bool operator==(const AssetCatalogPath &other_path) const
static std::string cleanup_component(StringRef component_name)
void iterate_components(ComponentIteratorFn callback) const
bool operator!=(const AssetCatalogPath &other_path) const
AssetCatalogPath rebase(const AssetCatalogPath &from_path, const AssetCatalogPath &to_path) const
AssetCatalogPath()=default
AssetCatalogPath parent() const
DEGForeachIDComponentCallback callback
std::ostream & operator<<(std::ostream &stream, const AssetCatalogPath &path_to_append)
unsigned __int64 uint64_t