1313#include < utility>
1414#include < vector>
1515
16+ #include " nlohmann/json.hpp"
17+
1618#include " xtl/xoptional.hpp"
1719
1820#include " xwidgets/xeither.hpp"
2123#include " xscales.hpp"
2224#include " xinteracts.hpp"
2325
26+ namespace nl = nlohmann;
27+
2428namespace xpl
2529{
2630 /* *******************
@@ -38,8 +42,8 @@ namespace xpl
3842 using scale_type = xw::xholder<xscale>;
3943 using tick_values_type = std::vector<double >;
4044
41- void serialize_state (xeus::xjson &, xeus::buffer_sequence&) const ;
42- void apply_patch (const xeus::xjson &, const xeus::buffer_sequence&);
45+ void serialize_state (nl::json &, xeus::buffer_sequence&) const ;
46+ void apply_patch (const nl::json &, const xeus::buffer_sequence&);
4347
4448 XPROPERTY (std::string, derived_type, orientation, " horizontal" , XEITHER(" horizontal" , " vertical" ));
4549 XPROPERTY (xtl::xoptional<std::string>, derived_type, side, xtl::missing<std::string>(), XEITHER_OPTIONAL(" bottom" , " top" , " left" , " right" ));
@@ -48,8 +52,8 @@ namespace xpl
4852 XPROPERTY (xtl::xoptional<std::string>, derived_type, tick_format);
4953 XPROPERTY (scale_type, derived_type, scale);
5054 XPROPERTY (xtl::xoptional<int >, derived_type, num_ticks);
51- XPROPERTY (::xeus::xjson , derived_type, tick_values, xeus::xjson ::array());
52- XPROPERTY (::xeus::xjson , derived_type, offset, ::xeus::xjson ::object());
55+ XPROPERTY (::nl::json , derived_type, tick_values, nl::json ::array());
56+ XPROPERTY (::nl::json , derived_type, offset, ::nl::json ::object());
5357 XPROPERTY (std::string, derived_type, label_location, " middle" , XEITHER(" middle" , " start" , " end" ));
5458 XPROPERTY (xtl::xoptional<color_type>, derived_type, label_color);
5559 XPROPERTY (xtl::xoptional<color_type>, derived_type, grid_color);
@@ -77,8 +81,6 @@ namespace xpl
7781
7882 using axis = xw::xmaterialize<xaxis>;
7983
80- using axis_generator = xw::xgenerator<xaxis>;
81-
8284 template <class T , class R = void >
8385 struct enable_xaxis
8486 {
@@ -100,8 +102,8 @@ namespace xpl
100102 using base_type = xaxis<D>;
101103 using derived_type = D;
102104
103- void serialize_state (xeus::xjson &, xeus::buffer_sequence&) const ;
104- void apply_patch (const xeus::xjson &, const xeus::buffer_sequence&);
105+ void serialize_state (nl::json &, xeus::buffer_sequence&) const ;
106+ void apply_patch (const nl::json &, const xeus::buffer_sequence&);
105107
106108 protected:
107109
@@ -123,14 +125,12 @@ namespace xpl
123125
124126 using color_axis = xw::xmaterialize<xcolor_axis>;
125127
126- using color_axis_generator = xw::xgenerator<xcolor_axis>;
127-
128128 /* **********************
129129 * axis implementation *
130130 ***********************/
131131
132132 template <class D >
133- inline void xaxis<D>::apply_patch(const xeus::xjson & patch, const xeus::buffer_sequence& buffers)
133+ inline void xaxis<D>::apply_patch(const nl::json & patch, const xeus::buffer_sequence& buffers)
134134 {
135135 using xw::set_property_from_patch;
136136 base_type::apply_patch (patch, buffers);
@@ -153,26 +153,26 @@ namespace xpl
153153 }
154154
155155 template <class D >
156- inline void xaxis<D>::serialize_state(xeus::xjson & state, xeus::buffer_sequence& buffers) const
156+ inline void xaxis<D>::serialize_state(nl::json & state, xeus::buffer_sequence& buffers) const
157157 {
158- using xw::set_patch_from_property ;
158+ using xw::xwidgets_serialize ;
159159 base_type::serialize_state (state, buffers);
160160
161- set_patch_from_property (orientation, state, buffers);
162- set_patch_from_property (side, state, buffers);
163- set_patch_from_property (label, state, buffers);
164- set_patch_from_property (tick_format, state, buffers);
165- set_patch_from_property (scale, state, buffers);
166- set_patch_from_property (num_ticks, state, buffers);
167- set_patch_from_property (tick_values, state, buffers);
168- set_patch_from_property (offset, state, buffers);
169- set_patch_from_property (label_location, state, buffers);
170- set_patch_from_property (label_color, state, buffers);
171- set_patch_from_property (grid_lines, state, buffers);
172- set_patch_from_property (grid_color, state, buffers);
173- set_patch_from_property (color, state, buffers);
174- set_patch_from_property (label_offset, state, buffers);
175- set_patch_from_property (visible, state, buffers);
161+ xwidgets_serialize (orientation, state[ " orientation " ] , buffers);
162+ xwidgets_serialize (side, state[ " side " ] , buffers);
163+ xwidgets_serialize (label, state[ " label " ] , buffers);
164+ xwidgets_serialize (tick_format, state[ " tick_format " ] , buffers);
165+ // xwidgets_serialize (scale, state["scale"] , buffers);
166+ xwidgets_serialize (num_ticks, state[ " num_ticks " ] , buffers);
167+ xwidgets_serialize (tick_values, state[ " tick_values " ] , buffers);
168+ xwidgets_serialize (offset, state[ " offset " ] , buffers);
169+ xwidgets_serialize (label_location, state[ " label_location " ] , buffers);
170+ xwidgets_serialize (label_color, state[ " label_color " ] , buffers);
171+ xwidgets_serialize (grid_lines, state[ " grid_lines " ] , buffers);
172+ xwidgets_serialize (grid_color, state[ " grid_color " ] , buffers);
173+ xwidgets_serialize (color, state[ " color " ] , buffers);
174+ xwidgets_serialize (label_offset, state[ " label_offset " ] , buffers);
175+ xwidgets_serialize (visible, state[ " visible " ] , buffers);
176176 }
177177
178178 template <class D >
@@ -217,16 +217,16 @@ namespace xpl
217217 ******************************/
218218
219219 template <class D >
220- inline void xcolor_axis<D>::apply_patch(const xeus::xjson & patch, const xeus::buffer_sequence& buffers)
220+ inline void xcolor_axis<D>::apply_patch(const nl::json & patch, const xeus::buffer_sequence& buffers)
221221 {
222222 using xw::set_property_from_patch;
223223 base_type::apply_patch (patch, buffers);
224224 }
225225
226226 template <class D >
227- inline void xcolor_axis<D>::serialize_state(xeus::xjson & state, xeus::buffer_sequence& buffers) const
227+ inline void xcolor_axis<D>::serialize_state(nl::json & state, xeus::buffer_sequence& buffers) const
228228 {
229- using xw::set_patch_from_property ;
229+ using xw::xwidgets_serialize ;
230230 base_type::serialize_state (state, buffers);
231231 }
232232
@@ -269,13 +269,9 @@ namespace xpl
269269#ifndef _WIN32
270270 extern template class xw ::xmaterialize<xpl::xaxis>;
271271 extern template class xw ::xtransport<xw::xmaterialize<xpl::xaxis>>;
272- extern template class xw ::xgenerator<xpl::xaxis>;
273- extern template class xw ::xtransport<xw::xgenerator<xpl::xaxis>>;
274272
275273 extern template class xw ::xmaterialize<xpl::xcolor_axis>;
276274 extern template class xw ::xtransport<xw::xmaterialize<xpl::xcolor_axis>>;
277- extern template class xw ::xgenerator<xpl::xcolor_axis>;
278- extern template class xw ::xtransport<xw::xgenerator<xpl::xcolor_axis>>;
279275#endif
280276
281277#endif
0 commit comments