-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
136 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "print.hpp" | ||
|
||
#include <filesystem> | ||
#include <iostream> | ||
|
||
#include "../logging.hpp" | ||
|
||
namespace fs = std::filesystem; | ||
|
||
namespace kc { | ||
|
||
void print_file(const std::vector<std::shared_ptr<kc::FileContext>> &contexts) | ||
{ | ||
for (const auto &entry : contexts) { | ||
|
||
std::regex link_regex(UNCOMPLETED_TASK_REGEX); | ||
std::string file_content = entry->file_entry->get_content(); | ||
std::smatch link_match; | ||
while(std::regex_search(file_content, link_match, link_regex)) { | ||
|
||
std::cout << entry->file_entry->file_entry.path() << " (" << link_match[2] << ") : " << link_match[3] << std::endl; | ||
|
||
file_content = link_match.suffix(); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include "../parse/FileContext.hpp" | ||
|
||
namespace kc { | ||
|
||
void print_file(const std::vector<std::shared_ptr<kc::FileContext>> &contexts); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "task.hpp" | ||
|
||
namespace kc { | ||
|
||
constexpr TaskState get_task_state(char c){ | ||
switch(c){ | ||
case ' ': | ||
return TaskState::NOT_STARTED; | ||
case '/': | ||
return TaskState::IN_PROGRESS; | ||
case 'x': | ||
return TaskState::COMPLETED; | ||
case '-': | ||
return TaskState::CANCELLED; | ||
} | ||
|
||
return TaskState::UNKNOWN; | ||
} | ||
|
||
constexpr char get_task_state(TaskState c){ | ||
switch(c){ | ||
case TaskState::NOT_STARTED: | ||
return ' '; | ||
case TaskState::IN_PROGRESS: | ||
return '/'; | ||
case TaskState::COMPLETED: | ||
return 'x'; | ||
case TaskState::CANCELLED: | ||
return '-'; | ||
} | ||
|
||
return '?'; | ||
} | ||
|
||
Task::Task(const std::string &task_content, TaskState state, const std::string &due_date_str) | ||
: task_content(task_content), state(state), due_date_str(due_date_str) { | ||
} | ||
|
||
Task::Task(const std::string &task_content, TaskState state) | ||
: task_content(task_content), state(state) { | ||
} | ||
|
||
Task::Task(const std::string &task_content) | ||
: task_content(task_content), state(NOT_STARTED) { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
namespace kc { | ||
|
||
enum TaskState { | ||
NOT_STARTED, IN_PROGRESS, COMPLETED, CANCELLED, UNKNOWN | ||
}; | ||
|
||
constexpr TaskState get_task_state(char c); | ||
constexpr char get_task_state(TaskState c); | ||
|
||
class Task { | ||
public: | ||
|
||
explicit Task(const std::string &task_content, TaskState state, const std::string &due_date_str); | ||
explicit Task(const std::string &task_content, TaskState state); | ||
explicit Task(const std::string &task_content); | ||
|
||
private: | ||
|
||
std::string task_content; | ||
std::string due_date_str; | ||
TaskState state; | ||
}; | ||
|
||
} |