AsmGrader 0.0.0
Loading...
Searching...
No Matches
assignment_file_searcher.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "api/assignment.hpp"
4#include "grading_session.hpp"
6
7#include <filesystem>
8#include <string>
9#include <vector>
10
11namespace asmgrader {
12
14{
15public:
16 // Matches filenames generated by Canvas LMS. Example:
17 // doejohn_1234_00000_image.png
18 static constexpr auto DEFAULT_REGEX = R"(`lastname``firstname`_\d+_\d+_`base`\.`ext`)";
19 static constexpr auto DEFAULT_SEARCH_DEPTH = 10;
20
22 explicit AssignmentFileSearcher(const Assignment& assignment, std::string var_regex = DEFAULT_REGEX);
23
24 bool search_recursive(StudentInfo& student, const std::filesystem::path& base,
25 int max_depth = DEFAULT_SEARCH_DEPTH);
26
28 std::vector<StudentInfo> search_recursive(const std::filesystem::path& base, int max_depth = DEFAULT_SEARCH_DEPTH);
29
30private:
31 static StudentInfo infer_student_names_from_file(const std::filesystem::path& path);
32};
33
34} // namespace asmgrader
Definition assignment_file_searcher.hpp:14
bool search_recursive(StudentInfo &student, const std::filesystem::path &base, int max_depth=DEFAULT_SEARCH_DEPTH)
Definition assignment_file_searcher.cpp:34
static constexpr auto DEFAULT_SEARCH_DEPTH
Definition assignment_file_searcher.hpp:19
AssignmentFileSearcher(const Assignment &assignment, std::string var_regex=DEFAULT_REGEX)
Unknown student name; search for any word in place of lastnamefirstname
Definition assignment_file_searcher.cpp:25
static constexpr auto DEFAULT_REGEX
Definition assignment_file_searcher.hpp:18
Declaration for the logic and data encapsulating a class assignment.
Definition assignment.hpp:23
Definition file_searcher.hpp:13
Defines data classes to store result data for the current run session.
Definition asm_buffer.hpp:19
Definition grading_session.hpp:151