diff options
author | vng <viktor.govako@gmail.com> | 2012-10-30 17:24:15 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:46:28 +0300 |
commit | 77564c5b7a3c2448a0fb7d46d1104a756eaeaf27 (patch) | |
tree | c2c56b396ec5e943a103bd239d0d3a8a7f734586 /platform/platform_qt.cpp | |
parent | f05dcc2e4838503e9ebc204cfa1c894bda9ff46f (diff) |
Make GetFilesInDir with GetFilesByExt and GetFilesByRegExp function in Platform.
Diffstat (limited to 'platform/platform_qt.cpp')
-rw-r--r-- | platform/platform_qt.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/platform/platform_qt.cpp b/platform/platform_qt.cpp index c0265141b7..22ad70de62 100644 --- a/platform/platform_qt.cpp +++ b/platform/platform_qt.cpp @@ -1,5 +1,6 @@ #include "platform.hpp" #include "constants.hpp" +#include "regexp.hpp" #include "../coding/file_reader.hpp" @@ -29,13 +30,20 @@ bool Platform::GetFileSizeByName(string const & fileName, uint64_t & size) const } } -void Platform::GetFilesInDir(string const & directory, string const & mask, FilesList & outFiles) +void Platform::GetFilesByRegExp(string const & directory, string const & regexp, FilesList & outFiles) { - QDir dir(directory.c_str(), mask.c_str(), QDir::Unsorted, - QDir::Files | QDir::Readable | QDir::Dirs | QDir::NoDotAndDotDot); + regexp::RegExpT exp; + regexp::Create(regexp, exp); + + QDir dir(QString::fromUtf8(directory.c_str())); int const count = dir.count(); + for (int i = 0; i < count; ++i) - outFiles.push_back(dir[i].toUtf8().data()); + { + string const name = dir[i].toUtf8().data(); + if (regexp::IsExist(name, exp)) + outFiles.push_back(name); + } } string Platform::DeviceName() const |