forked from jupyter-xeus/xeus-cling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxdisplay.hpp
52 lines (47 loc) · 1.51 KB
/
xdisplay.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/***************************************************************************
* Copyright (c) 2016, Johan Mabille, Loic Gouarin and Sylvain Corlay *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#ifndef XCPP_DISPLAY_HPP
#define XCPP_DISPLAY_HPP
#include "xmime.hpp"
namespace xcpp
{
template <class T>
void display(const T& t)
{
using ::xcpp::mime_bundle_repr;
xeus::get_interpreter().display_data(
mime_bundle_repr(t),
xeus::xjson::object(),
xeus::xjson::object()
);
}
template <class T>
void display(const T& t, xeus::xguid id, bool update=false)
{
xeus::xjson transient;
transient["display_id"] = id;
using ::xcpp::mime_bundle_repr;
if (update)
{
xeus::get_interpreter().update_display_data(
mime_bundle_repr(t),
xeus::xjson::object(),
std::move(transient)
);
}
else
{
xeus::get_interpreter().display_data(
mime_bundle_repr(t),
xeus::xjson::object(),
std::move(transient)
);
}
}
}
#endif