Graphics Editor
 All Classes Namespaces Files Functions Variables Pages
model.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include <memory>
6 #include "canvas_primitives.h"
7 
8 namespace editor {
10  public:
14  GraphicDocument() = default;
15 
19  GraphicDocument(const std::string& path);
20 
24  void load_document(const std::string& path);
25 
29  void add_primitive_to_document(std::shared_ptr<figures::CanvasPrimitive>& primitive);
30 
34  void remove_primitive_from_document(std::shared_ptr<figures::CanvasPrimitive>& primitive);
35 
39  void save_document(const std::string& path);
40 
41  std::vector<std::string> get_elements_representations() const;
42 
43  private:
44  std::vector<std::shared_ptr<figures::CanvasPrimitive>> elements; // using raw address as hash
45  };
46 }
void add_primitive_to_document(std::shared_ptr< figures::CanvasPrimitive > &primitive)
Definition: model.cpp:15
void remove_primitive_from_document(std::shared_ptr< figures::CanvasPrimitive > &primitive)
Definition: model.cpp:20
std::vector< std::string > get_elements_representations() const
Definition: model.cpp:33
void load_document(const std::string &path)
Definition: model.cpp:10
Definition: model.h:9
void save_document(const std::string &path)
Definition: model.cpp:28