blob: e9397137069564470c6f6d8d06c993b6c5bb6680 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#pragma once
#include "util/assert.h"
#include <QUrl>
namespace mixxx {
class UrlResource {
public:
virtual ~UrlResource() = default;
QUrl getUrl() const {
return m_url;
}
QString getUrlString() const {
return m_url.toString();
}
protected:
explicit UrlResource(const QUrl& url)
: m_url(url) {
}
inline bool isLocalFile() const {
// TODO(XXX): We need more testing how network shares are
// handled! From the documentation of QUrl::isLocalFile():
// "Note that this function considers URLs with hostnames
// to be local file paths, ..."
return m_url.isLocalFile();
}
inline QString getLocalFileName() const {
DEBUG_ASSERT(isLocalFile());
return m_url.toLocalFile();
}
private:
QUrl m_url;
};
} // namespace mixxx
|