forked from qt-creator/qt-creator
Utils: Rework FilePath guts
This replaces FilePath::m_url by explicit host and scheme members
This removes the unclear duplication of information in m_data and
m_url.path() and avoids syntactic restrictions a real url has on
scheme and host and complex (and potentially lossy) url parsing:
QUrl url;
url.setHost("1234");
assert(url.host() == "0.0.4.210")
The toString/fromString methods now accept strings of the form
scheme://host/path, mimicing the use of urls so far.
Relative remote paths are representable, their toString() output
looks like scheme://./host/path and can be parsed back by fromString().
Change-Id: Id3b52c270b228e23834faa3f44daad8b1718b654
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -102,7 +102,15 @@ public:
|
||||
|
||||
QString fileName() const;
|
||||
QString fileNameWithPathComponents(int pathComponents) const;
|
||||
QString path() const;
|
||||
|
||||
QString scheme() const { return m_scheme; }
|
||||
void setScheme(const QString &scheme);
|
||||
|
||||
QString host() const { return m_host; }
|
||||
void setHost(const QString &host);
|
||||
|
||||
QString path() const { return m_data; }
|
||||
void setPath(const QString &path) { m_data = path; }
|
||||
|
||||
bool needsDevice() const;
|
||||
bool exists() const;
|
||||
@@ -165,8 +173,9 @@ private:
|
||||
friend class ::tst_fileutils;
|
||||
static QString calcRelativePath(const QString &absolutePath, const QString &absoluteAnchorPath);
|
||||
|
||||
QString m_scheme;
|
||||
QString m_host;
|
||||
QString m_data;
|
||||
QUrl m_url;
|
||||
};
|
||||
|
||||
QTCREATOR_UTILS_EXPORT QTextStream &operator<<(QTextStream &s, const FilePath &fn);
|
||||
|
||||
Reference in New Issue
Block a user