2018-10-28 08:54:20 +01:00
|
|
|
#pragma once
|
|
|
|
|
2018-12-04 00:27:16 +01:00
|
|
|
#include "AKString.h"
|
2018-10-28 08:54:20 +01:00
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
|
|
class FileSystemPath {
|
|
|
|
public:
|
2019-05-28 11:53:16 +02:00
|
|
|
FileSystemPath() {}
|
2019-06-02 12:26:28 +02:00
|
|
|
explicit FileSystemPath(const StringView&);
|
2018-10-28 08:54:20 +01:00
|
|
|
|
2018-12-03 01:38:22 +01:00
|
|
|
bool is_valid() const { return m_is_valid; }
|
2019-06-07 20:58:12 +02:00
|
|
|
const String& string() const { return m_string; }
|
2018-10-28 08:54:20 +01:00
|
|
|
|
2019-06-07 20:58:12 +02:00
|
|
|
const String& basename() const { return m_basename; }
|
2019-07-28 23:45:50 -05:00
|
|
|
const String& title() const { return m_title; }
|
|
|
|
const String& extension() const { return m_extension; }
|
2018-11-18 14:57:41 +01:00
|
|
|
|
2019-03-30 03:27:25 +01:00
|
|
|
const Vector<String>& parts() const { return m_parts; }
|
|
|
|
|
2019-05-26 22:33:30 +02:00
|
|
|
bool has_extension(StringView) const;
|
|
|
|
|
2018-10-28 08:54:20 +01:00
|
|
|
private:
|
2019-07-15 06:49:28 +02:00
|
|
|
void canonicalize();
|
2018-10-28 08:54:20 +01:00
|
|
|
|
2019-03-30 03:27:25 +01:00
|
|
|
Vector<String> m_parts;
|
2018-10-28 08:54:20 +01:00
|
|
|
String m_string;
|
2018-11-18 14:57:41 +01:00
|
|
|
String m_basename;
|
2019-07-28 23:45:50 -05:00
|
|
|
String m_title;
|
|
|
|
String m_extension;
|
2018-12-03 01:38:22 +01:00
|
|
|
bool m_is_valid { false };
|
2018-10-28 08:54:20 +01:00
|
|
|
};
|
|
|
|
|
2019-07-15 06:49:28 +02:00
|
|
|
String canonicalized_path(const StringView&);
|
|
|
|
|
2018-10-28 08:54:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
using AK::FileSystemPath;
|
2019-07-15 06:49:28 +02:00
|
|
|
using AK::canonicalized_path;
|