27 lines
624 B
C++
27 lines
624 B
C++
#pragma once
|
|
|
|
#include "components/todoEntry.hpp"
|
|
#include "services/todoAdapter.hpp"
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
class TodoService {
|
|
public:
|
|
TodoService(sigc::signal<void()> refreshSignal);
|
|
~TodoService();
|
|
|
|
std::map<int, TodoEntry *> getTodos();
|
|
void init();
|
|
void removeTodo(int id);
|
|
TodoEntry *addTodo(std::string text, bool emitSignal = true, bool persist = true);
|
|
void updateTodo(int id, std::string text);
|
|
|
|
private:
|
|
void load();
|
|
|
|
int nextId = 1;
|
|
std::map<int, TodoEntry *> todos;
|
|
sigc::signal<void()> refreshSignal;
|
|
|
|
std::unique_ptr<ITodoAdapter> adapter;
|
|
}; |