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
21 explicit AssignmentFileSearcher(const Assignment& assignment, std::string var_regex = DEFAULT_REGEX);
22
24 bool search(StudentInfo& student, const std::filesystem::path& base);
25
27 std::vector<StudentInfo> search(const std::filesystem::path& base);
28
29 bool search_recursive(StudentInfo& student, const std::filesystem::path& base,
30 int max_depth = DEFAULT_SEARCH_DEPTH);
31
33 std::vector<StudentInfo> search_recursive(const std::filesystem::path& base, int max_depth = DEFAULT_SEARCH_DEPTH);
34
35private:
36 static StudentInfo infer_student_names_from_file(const std::filesystem::path& path);
37};
38
39} // 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:36
bool search(StudentInfo &student, const std::filesystem::path &base)
Equivalent to search_recursive(student, base, 0)
Definition assignment_file_searcher.cpp:96
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:27
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
static constexpr auto DEFAULT_SEARCH_DEPTH
Definition file_searcher.hpp:15
Defines data classes to store result data for the current run session.
Definition asm_buffer.hpp:20
Definition grading_session.hpp:157