6#include <unordered_map>
10#ifndef MSGPACK_DEFINE_MAP
11#define MSGPACK_DEFINE_MAP(...)
21 int color = 0, fill = 0;
38 return !(*
this == other);
41 MSGPACK_NVP(
"or", origin_rot), MSGPACK_NVP(
"c", color),
42 MSGPACK_NVP(
"f", fill), MSGPACK_NVP(
"s", stroke_width),
43 MSGPACK_NVP(
"gt", geometry_type),
44 MSGPACK_NVP(
"gp", properties),
45 MSGPACK_NVP(
"L", on_click_member),
46 MSGPACK_NVP(
"l", on_click_field), MSGPACK_NVP(
"x", text))
49 double width = 0, height = 0;
50 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
components;
54 : width(width), height(height), components(), data_ids() {}
60 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
61 std::optional<std::vector<SharedString>>
data_ids;
65 std::map<std::string, std::shared_ptr<Canvas2DComponentData>> data_diff,
66 std::optional<std::vector<SharedString>> data_ids)
67 : field(field), width(width), height(height),
68 data_diff(std::move(data_diff)), data_ids(std::move(data_ids)) {}
70 MSGPACK_NVP(
"h", height), MSGPACK_NVP(
"d", data_diff),
71 MSGPACK_NVP(
"l", data_ids))
76 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
81 const std::unordered_map<
int, std::shared_ptr<Canvas2DComponentData>>
84 : field(field), width(width), height(height), data_diff(),
86 for (
const auto &vc : data_diff) {
87 this->data_diff.emplace(std::to_string(vc.first), vc.second);
92 const std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
95 : field(field), width(width), height(height), data_diff(data_diff),
98 MSGPACK_NVP(
"h", height), MSGPACK_NVP(
"d", data_diff),
99 MSGPACK_NVP(
"l", length))
103 :
public MessageBase<MessageKind::canvas2d_old + MessageKind::res> {
104 unsigned int req_id = 0;
106 double width = 0, height = 0;
107 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
112 const std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
115 : req_id(req_id), sub_field(sub_field), width(width), height(height),
116 data_diff(data_diff), length(length) {}
118 MSGPACK_NVP(
"w", width), MSGPACK_NVP(
"h", height),
119 MSGPACK_NVP(
"d", data_diff), MSGPACK_NVP(
"l", length))
123 :
public MessageBase<MessageKind::canvas2d + MessageKind::res> {
124 unsigned int req_id = 0;
126 double width = 0, height = 0;
127 std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
data_diff;
132 const std::map<std::string, std::shared_ptr<Canvas2DComponentData>>
134 const std::optional<std::vector<SharedString>> &data_ids)
135 : req_id(req_id), sub_field(sub_field), width(width), height(height),
136 data_diff(data_diff), data_ids(data_ids) {}
138 MSGPACK_NVP(
"w", width), MSGPACK_NVP(
"h", height),
139 MSGPACK_NVP(
"d", data_diff), MSGPACK_NVP(
"l", data_ids))
#define MSGPACK_DEFINE_MAP(...)
Definition base.h:11
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:67
#define WEBCFACE_MESSAGE_FMT(Type)
Definition fmt.h:21
Canvas2DComponentData()=default
int color
Definition canvas2d.h:21
bool operator==(const Canvas2DComponentData &other) const
Definition canvas2d.h:28
int fill
Definition canvas2d.h:21
std::array< double, 2 > origin_pos
Definition canvas2d.h:19
SharedString text
Definition canvas2d.h:26
bool operator!=(const Canvas2DComponentData &other) const
Definition canvas2d.h:37
std::optional< SharedString > on_click_member
Definition canvas2d.h:25
std::vector< double > properties
Definition canvas2d.h:24
std::optional< int > geometry_type
Definition canvas2d.h:23
int type
Definition canvas2d.h:18
double origin_rot
Definition canvas2d.h:20
double stroke_width
Definition canvas2d.h:22
std::optional< SharedString > on_click_field
Definition canvas2d.h:25
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > components
Definition canvas2d.h:50
std::vector< SharedString > data_ids
Definition canvas2d.h:51
Canvas2DData(double width, double height)
Definition canvas2d.h:53
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:90
double height
Definition canvas2d.h:75
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:79
std::size_t length
Definition canvas2d.h:77
SharedString field
Definition canvas2d.h:74
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:76
std::optional< std::vector< SharedString > > data_ids
Definition canvas2d.h:61
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:63
double height
Definition canvas2d.h:59
SharedString field
Definition canvas2d.h:58
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:60
型からkindを取得するためだけのベースクラス
Definition base.h:60
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:110
std::size_t length
Definition canvas2d.h:108
SharedString sub_field
Definition canvas2d.h:105
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:107
std::optional< std::vector< SharedString > > data_ids
Definition canvas2d.h:128
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:130
SharedString sub_field
Definition canvas2d.h:125
std::map< std::string, std::shared_ptr< Canvas2DComponentData > > data_diff
Definition canvas2d.h:127
#define WEBCFACE_NS_END
Definition webcface-config.h:118
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:117