5#include <unordered_map>
9#ifndef MSGPACK_DEFINE_MAP
10#define MSGPACK_DEFINE_MAP(...)
20 int color = 0, fill = 0;
37 return !(*
this == other);
40 MSGPACK_NVP(
"or", origin_rot), MSGPACK_NVP(
"c", color),
41 MSGPACK_NVP(
"f", fill), MSGPACK_NVP(
"s", stroke_width),
42 MSGPACK_NVP(
"gt", geometry_type),
43 MSGPACK_NVP(
"gp", properties),
44 MSGPACK_NVP(
"L", on_click_member),
45 MSGPACK_NVP(
"l", on_click_field), MSGPACK_NVP(
"x", text))
48 double width = 0, height = 0;
49 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
components;
53 : width(width), height(height), components(), data_ids() {}
59 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
60 std::optional<std::vector<SharedString>>
data_ids;
64 std::map<std::string, std::shared_ptr<Canvas2DComponentData>> data_diff,
65 std::optional<std::vector<SharedString>> data_ids)
66 : field(field), width(width), height(height),
67 data_diff(std::move(data_diff)), data_ids(std::move(data_ids)) {}
69 MSGPACK_NVP(
"h", height), MSGPACK_NVP(
"d", data_diff),
70 MSGPACK_NVP(
"l", data_ids))
75 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
80 const std::unordered_map<
int, std::shared_ptr<Canvas2DComponentData>>
83 : field(field), width(width), height(height), data_diff(),
85 for (
const auto &vc : data_diff) {
86 this->data_diff.emplace(std::to_string(vc.first), vc.second);
91 const std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
94 : field(field), width(width), height(height), data_diff(data_diff),
97 MSGPACK_NVP(
"h", height), MSGPACK_NVP(
"d", data_diff),
98 MSGPACK_NVP(
"l", length))
102 :
public MessageBase<MessageKind::canvas2d_old + MessageKind::res> {
103 unsigned int req_id = 0;
105 double width = 0, height = 0;
106 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
111 const std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
114 : req_id(req_id), sub_field(sub_field), width(width), height(height),
115 data_diff(data_diff), length(length) {}
117 MSGPACK_NVP(
"w", width), MSGPACK_NVP(
"h", height),
118 MSGPACK_NVP(
"d", data_diff), MSGPACK_NVP(
"l", length))
122 :
public MessageBase<MessageKind::canvas2d + MessageKind::res> {
123 unsigned int req_id = 0;
125 double width = 0, height = 0;
126 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
131 const std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
133 const std::optional<std::vector<SharedString>> &data_ids)
134 : req_id(req_id), sub_field(sub_field), width(width), height(height),
135 data_diff(data_diff), data_ids(data_ids) {}
137 MSGPACK_NVP(
"w", width), MSGPACK_NVP(
"h", height),
138 MSGPACK_NVP(
"d", data_diff), MSGPACK_NVP(
"l", data_ids))
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:69
#define MSGPACK_DEFINE_MAP(...)
Definition canvas2d.h:10
Canvas2DComponentData()=default
int color
Definition canvas2d.h:20
bool operator==(const Canvas2DComponentData &other) const
Definition canvas2d.h:27
int fill
Definition canvas2d.h:20
std::array< double, 2 > origin_pos
Definition canvas2d.h:18
SharedString text
Definition canvas2d.h:25
bool operator!=(const Canvas2DComponentData &other) const
Definition canvas2d.h:36
std::optional< SharedString > on_click_member
Definition canvas2d.h:24
std::vector< double > properties
Definition canvas2d.h:23
std::optional< int > geometry_type
Definition canvas2d.h:22
int type
Definition canvas2d.h:17
double origin_rot
Definition canvas2d.h:19
double stroke_width
Definition canvas2d.h:21
std::optional< SharedString > on_click_field
Definition canvas2d.h:24
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > components
Definition canvas2d.h:49
std::vector< SharedString > data_ids
Definition canvas2d.h:50
Canvas2DData(double width, double height)
Definition canvas2d.h:52
Canvas2DOld(const SharedString &field, double width, double height, const std::map< std::string, std::shared_ptr< Canvas2DComponentData > > &data_diff, std::size_t length)
Definition canvas2d.h:89
double height
Definition canvas2d.h:74
Canvas2DOld(const SharedString &field, double width, double height, const std::unordered_map< int, std::shared_ptr< Canvas2DComponentData > > &data_diff, std::size_t length)
Definition canvas2d.h:78
std::size_t length
Definition canvas2d.h:76
SharedString field
Definition canvas2d.h:73
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:75
std::optional< std::vector< SharedString > > data_ids
Definition canvas2d.h:60
Canvas2D(const SharedString &field, double width, double height, std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff, std::optional< std::vector< SharedString > > data_ids)
Definition canvas2d.h:62
double height
Definition canvas2d.h:58
SharedString field
Definition canvas2d.h:57
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:59
型からkindを取得するためだけのベースクラス
Definition base.h:53
Res(unsigned int req_id, const SharedString &sub_field, double width, double height, const std::map< std::string, std::shared_ptr< Canvas2DComponentData > > &data_diff, std::size_t length)
Definition canvas2d.h:109
std::size_t length
Definition canvas2d.h:107
SharedString sub_field
Definition canvas2d.h:104
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:106
std::optional< std::vector< SharedString > > data_ids
Definition canvas2d.h:127
Res(unsigned int req_id, const SharedString &sub_field, double width, double height, const std::map< std::string, std::shared_ptr< Canvas2DComponentData > > &data_diff, const std::optional< std::vector< SharedString > > &data_ids)
Definition canvas2d.h:129
SharedString sub_field
Definition canvas2d.h:124
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:126
#define WEBCFACE_NS_END
Definition webcface-config.h:104
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:103