-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbdirectory.cpp
More file actions
37 lines (29 loc) · 798 Bytes
/
bdirectory.cpp
File metadata and controls
37 lines (29 loc) · 798 Bytes
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
#include "bdirectory.h"
BDirectory::BDirectory() :
directory(0)
{
SORT_FLAGS = (QDir::Name | QDir::LocaleAware);
FILTER_FLAGS = QDir::Files;
directory = QDir::current();
LoadFileInfos();
}
BDirectory::~BDirectory() {
}
BDirectory::file_iterator BDirectory::file_begin() const {
return fileInfosList.begin();
}
BDirectory::file_iterator BDirectory::file_end() const {
return fileInfosList.end();
}
void BDirectory::SetPath(std::wstring path) {
QString dir_path = QString::fromStdWString(path);
if (directory.exists(dir_path)) {
directory.setPath(dir_path);
LoadFileInfos();
} else {
throw new std::exception();
}
}
void BDirectory::LoadFileInfos() {
fileInfosList = directory.entryInfoList(FILTER_FLAGS, SORT_FLAGS);
}