Lines Matching defs:FilePath
32 using StringType = FilePath::StringType;
33 using StringViewType = FilePath::StringViewType;
40 const FilePath::CharType kStringTerminator = FILE_PATH_LITERAL('\0');
42 // If this FilePath contains a drive letter specification, returns the
85 FilePath::IsSeparator(path[letter + 1]);
88 return path.length() > 1 && FilePath::IsSeparator(path[0]) &&
89 FilePath::IsSeparator(path[1]);
92 return path.length() > 0 && FilePath::IsSeparator(path[0]);
98 if (!FilePath::IsSeparator(*it))
110 if (path == FilePath::kCurrentDirectory || path == FilePath::kParentDirectory)
113 return path.rfind(FilePath::kExtensionSeparator);
128 path.rfind(FilePath::kExtensionSeparator, last_dot - 1);
130 FilePath::kSeparators, last_dot - 1, FilePath::kSeparatorsLength - 1);
160 if (path.empty() || path == FilePath::kCurrentDirectory ||
161 path == FilePath::kParentDirectory) {
170 FilePath::FilePath() = default;
172 FilePath::FilePath(const FilePath& that) = default;
173 FilePath::FilePath(FilePath&& that) noexcept = default;
175 FilePath::FilePath(StringViewType path) {
182 FilePath::~FilePath() = default;
184 FilePath& FilePath::operator=(const FilePath& that) = default;
186 FilePath& FilePath::operator=(FilePath&& that) = default;
188 bool FilePath::operator==(const FilePath& that) const {
196 bool FilePath::operator!=(const FilePath& that) const {
205 bool FilePath::IsSeparator(CharType character) {
215 void FilePath::GetComponents(std::vector<StringType>* components) const {
224 FilePath current = *this;
225 FilePath base;
241 FilePath dir = current.DirName();
250 bool FilePath::IsParent(const FilePath& child) const {
254 bool FilePath::AppendRelativePath(const FilePath& child, FilePath* path) const {
300 FilePath FilePath::DirName() const {
301 FilePath new_path(path_);
335 FilePath FilePath::BaseName() const {
336 FilePath new_path(path_);
357 StringType FilePath::Extension() const {
358 FilePath base(BaseName());
366 StringType FilePath::FinalExtension() const {
367 FilePath base(BaseName());
375 FilePath FilePath::RemoveExtension() const {
383 return FilePath(path_.substr(0, dot));
386 FilePath FilePath::RemoveFinalExtension() const {
394 return FilePath(path_.substr(0, dot));
397 FilePath FilePath::InsertBeforeExtension(StringViewType suffix) const {
399 return FilePath(path_);
402 return FilePath();
408 return FilePath(ret);
411 FilePath FilePath::InsertBeforeExtensionASCII(std::string_view suffix) const {
420 FilePath FilePath::AddExtension(StringViewType extension) const {
422 return FilePath();
424 // If the new extension is "" or ".", then just return the current FilePath.
435 return FilePath(str);
438 FilePath FilePath::ReplaceExtension(StringViewType extension) const {
440 return FilePath();
442 FilePath no_ext = RemoveExtension();
452 return FilePath(str);
455 FilePath FilePath::Append(StringViewType component) const {
472 // it's likely in practice to wind up with FilePath objects containing
475 return FilePath(appended);
478 FilePath new_path(path_);
499 FilePath FilePath::Append(const FilePath& component) const {
503 FilePath FilePath::AppendASCII(std::string_view component) const {
512 bool FilePath::IsAbsolute() const {
516 bool FilePath::EndsWithSeparator() const {
522 FilePath FilePath::AsEndingWithSeparator() const {
531 return FilePath(path_str);
534 FilePath FilePath::StripTrailingSeparators() const {
535 FilePath new_path(path_);
541 bool FilePath::ReferencesParent() const {
569 std::u16string FilePath::LossyDisplayName() const {
573 std::string FilePath::MaybeAsASCII() const {
579 std::string FilePath::As8Bit() const {
588 std::string FilePath::MaybeAsASCII() const {
594 std::string FilePath::As8Bit() const {
600 void FilePath::StripTrailingSeparatorsInternal() {
621 FilePath FilePath::NormalizePathSeparators() const {
625 FilePath FilePath::NormalizePathSeparatorsTo(CharType separator) const {
634 return FilePath(copy);