#pragma once #include #include #include #include #include namespace backend { struct labeller_impl; struct rect { int x1=0, x2=0, y1=0, y2=0; }; struct label { label() {} label(const std::string& name, double time) : name(name), time(time) {} std::string name; double time; rect location; }; class labeller { public: labeller(const std::filesystem::path& savepath); std::pair getSurrounding(double time) const; std::vector getLabels() const; std::vector getRectangleLabels() const; void applyLabel(std::string name, double time); void deleteLabel(double time); // Deletes closest to time, last added if ties void undo(); void redo(); void save() const; private: std::shared_ptr data; }; }