File src/tooling/Traverser.cpp changed (mode: 100644) (index 654e13e..a7b02e3) |
18 |
18 |
|
|
19 |
19 |
#include <boost/filesystem/operations.hpp> |
#include <boost/filesystem/operations.hpp> |
20 |
20 |
#include <boost/filesystem/path.hpp> |
#include <boost/filesystem/path.hpp> |
21 |
|
#include <boost/range/adaptors.hpp> |
|
22 |
21 |
|
|
23 |
22 |
#include <functional> |
#include <functional> |
24 |
23 |
#include <string> |
#include <string> |
|
26 |
25 |
#include <vector> |
#include <vector> |
27 |
26 |
|
|
28 |
27 |
#include "tooling/Config.hpp" |
#include "tooling/Config.hpp" |
|
28 |
|
#include "utils/iterators.hpp" |
29 |
29 |
#include "Language.hpp" |
#include "Language.hpp" |
30 |
30 |
|
|
31 |
31 |
namespace fs = boost::filesystem; |
namespace fs = boost::filesystem; |
|
... |
... |
Traverser::search(const boost::filesystem::path &path) |
69 |
69 |
return match(path.string(), /*passedIn=*/true); |
return match(path.string(), /*passedIn=*/true); |
70 |
70 |
} |
} |
71 |
71 |
|
|
72 |
|
using it = fs::directory_iterator; |
|
73 |
|
|
|
74 |
72 |
bool found = false; |
bool found = false; |
75 |
|
for (fs::directory_entry &e : boost::make_iterator_range(it(path), it())) { |
|
|
73 |
|
for (fs::directory_entry &e : rangeFrom<fs::directory_iterator>(path)) { |
76 |
74 |
const fs::path &path = e.path(); |
const fs::path &path = e.path(); |
77 |
75 |
if (fs::is_directory(path)) { |
if (fs::is_directory(path)) { |
78 |
76 |
if (config.shouldVisitDirectory(path.string())) { |
if (config.shouldVisitDirectory(path.string())) { |
File src/utils/iterators.hpp copied from file tools/tui/views/DumpView.hpp (similarity 57%) (mode: 100644) (index e0ac515..e4122da) |
1 |
|
// Copyright (C) 2019 xaizek <xaizek@posteo.net> |
|
|
1 |
|
// Copyright (C) 2024 xaizek <xaizek@posteo.net> |
2 |
2 |
// |
// |
3 |
3 |
// This file is part of zograscope. |
// This file is part of zograscope. |
4 |
4 |
// |
// |
|
14 |
14 |
// You should have received a copy of the GNU Affero General Public License |
// You should have received a copy of the GNU Affero General Public License |
15 |
15 |
// along with zograscope. If not, see <http://www.gnu.org/licenses/>. |
// along with zograscope. If not, see <http://www.gnu.org/licenses/>. |
16 |
16 |
|
|
17 |
|
#ifndef ZOGRASCOPE_TOOLS_TUI_VIEWS_DUMPVIEW_HPP_ |
|
18 |
|
#define ZOGRASCOPE_TOOLS_TUI_VIEWS_DUMPVIEW_HPP_ |
|
|
17 |
|
#ifndef ZOGRASCOPE_UTILS_ITERATORS_HPP_ |
|
18 |
|
#define ZOGRASCOPE_UTILS_ITERATORS_HPP_ |
19 |
19 |
|
|
20 |
|
#include "cursed/Text.hpp" |
|
|
20 |
|
#include <utility> |
21 |
21 |
|
|
22 |
|
#include "../ViewManager.hpp" |
|
23 |
|
|
|
24 |
|
class DumpView : public View |
|
|
22 |
|
namespace guts |
25 |
23 |
{ |
{ |
26 |
|
public: |
|
27 |
|
explicit DumpView(ViewManager &manager); |
|
28 |
24 |
|
|
29 |
|
public: |
|
30 |
|
virtual vle::Mode buildMode() override; |
|
31 |
|
virtual void update() override; |
|
|
25 |
|
template <typename I> |
|
26 |
|
struct ItPair |
|
27 |
|
{ |
|
28 |
|
I from; |
|
29 |
|
I to; |
32 |
30 |
|
|
33 |
|
private: |
|
34 |
|
cursed::Text text; |
|
|
31 |
|
I & begin() { return from; } |
|
32 |
|
I & end() { return to; } |
35 |
33 |
}; |
}; |
36 |
34 |
|
|
37 |
|
#endif // ZOGRASCOPE_TOOLS_TUI_VIEWS_DUMPVIEW_HPP_ |
|
|
35 |
|
} |
|
36 |
|
|
|
37 |
|
template <typename I, typename... Args> |
|
38 |
|
guts::ItPair<I> |
|
39 |
|
rangeFrom(Args &&...args) |
|
40 |
|
{ |
|
41 |
|
return guts::ItPair<I>{ I(std::forward<Args>(args)...), I() }; |
|
42 |
|
} |
|
43 |
|
|
|
44 |
|
#endif // ZOGRASCOPE_UTILS_ITERATORS_HPP_ |