-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.h
57 lines (35 loc) · 1.1 KB
/
storage.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <memory>
#include <QFileInfo>
#include <QString>
#include <QStringList>
///class is thread safe
struct storage_t {
static const QString tmpsuffix;
storage_t(const QString& root, const QString& path, bool keep_structure);
~storage_t();
QString key(QString path) const;
bool keep_structure() const;
/// Full info about file
QFileInfo info(QString key) const;
/// Only filename without path
QString file(const QString& key) const;
/// Only folder without root and filename
QString folder(const QString& key) const;
/// Full path without root
QString file_path(const QString& key) const;
QString absolute_file_path(const QString& key) const;
QString remote_file_path(const QString& key) const;
QFileInfoList entries(QString key = QString()) const;
friend class storage_test;
// private:
/// Full root path of storage
QString root() const;
/// Relative path from root to files in storage
QString path() const;
/// Full path to files in storage
QString prefix() const;
private:
struct Pimpl;
std::unique_ptr<Pimpl> p_;
};