Learn Environment
|
Parses tasks and subtasks from a JSON file. More...
#include <task_parser.hpp>
Public Member Functions | |
QVector< QSharedPointer< Task > > | loadTasks (const QString &taskPath, const QString &difficultyPath, const QString &topicPath) |
Loads tasks with all configuration JSON files. More... | |
Parses tasks and subtasks from a JSON file.
The TaskParser class is responsible for loading tasks and their subtasks from a JSON file. It provides methods to parse the JSON data and convert it into Task and Subtask objects.
QVector< QSharedPointer< Task > > TaskParser::loadTasks | ( | const QString & | taskPath, |
const QString & | difficultyPath, | ||
const QString & | topicPath | ||
) |
Loads tasks with all configuration JSON files.
This function reads the tasks, difficulty levels, and topic definitions from the specified JSON files. It parses the JSON data and constructs a vector of shared pointers to Task objects. The tasks are sorted based on the defined topic order from the topic definition JSON file. If any of the files cannot be opened or if there is a JSON parsing error, an empty vector is returned.
taskPath | The path to the JSON file containing the tasks. |
difficultyPath | The path to the JSON file containing the difficulty levels. |
topicPath | The path to the JSON file containing the topic definitions. |