Horizon
clipboard.hpp
1 #pragma once
2 #include "canvas/selectables.hpp"
3 #include "nlohmann/json_fwd.hpp"
4 
5 namespace horizon {
6 using json = nlohmann::json;
7 class ClipboardBase {
8 public:
9  json process(const std::set<SelectableRef> &sel);
10 
11  static std::unique_ptr<ClipboardBase> create(class IDocument &doc);
12  virtual ~ClipboardBase()
13  {
14  }
15 
16 protected:
17  virtual void expand_selection();
18  virtual void serialize(json &j);
19  virtual json serialize_junction(const class Junction &ju);
20 
21  virtual class IDocument &get_doc() = 0;
22  std::set<SelectableRef> selection;
23 };
24 
26 public:
27  ClipboardGeneric(IDocument &d) : doc(d)
28  {
29  }
30 
31 protected:
32  IDocument &doc;
33  IDocument &get_doc() override
34  {
35  return doc;
36  }
37 };
38 
39 
40 } // namespace horizon
Definition: clipboard.hpp:7
Definition: clipboard.hpp:25
Definition: idocument.hpp:5
A Junction is a point in 2D-Space.
Definition: junction.hpp:20
a class to store JSON values
Definition: json.hpp:177
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62