AsmGrader 0.0.0
Loading...
Searching...
No Matches
file_searcher.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <map>
5#include <regex>
6#include <string>
7#include <string_view>
8#include <vector>
9
10namespace asmgrader {
11
13{
14public:
15 explicit FileSearcher(std::string expr, std::map<std::string, std::string> args = {});
16
18 std::vector<std::filesystem::path> search(const std::filesystem::path& base);
19
20 std::vector<std::filesystem::path> search_recursive(const std::filesystem::path& base, int max_depth);
21
22protected:
23 std::string set_arg(const std::string& key, std::string_view value);
24
25 std::string get_expr() const;
26
27private:
28 std::string subst_args() const;
29 static bool does_match(const std::regex& expr, std::string_view filename);
30
31 std::string expr_;
32 std::map<std::string, std::string> args_;
33};
34
35} // namespace asmgrader
Definition file_searcher.hpp:13
std::vector< std::filesystem::path > search_recursive(const std::filesystem::path &base, int max_depth)
Definition file_searcher.cpp:35
std::string set_arg(const std::string &key, std::string_view value)
Definition file_searcher.cpp:22
std::vector< std::filesystem::path > search(const std::filesystem::path &base)
Equivalent to search_recursive(base, 1)
Definition file_searcher.cpp:31
FileSearcher(std::string expr, std::map< std::string, std::string > args={})
Definition file_searcher.cpp:18
std::string get_expr() const
Definition file_searcher.cpp:88
Definition asm_buffer.hpp:19