Skip to content

Commit

Permalink
Merge pull request #399 from JohanMabille/json
Browse files Browse the repository at this point in the history
Wraps nlohmann_json include
  • Loading branch information
JohanMabille authored May 7, 2024
2 parents fd65b9e + 5a5f265 commit 1bbef72
Show file tree
Hide file tree
Showing 22 changed files with 69 additions and 53 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ set(XEUS_HEADERS
${XEUS_INCLUDE_DIR}/xeus/xhistory_manager.hpp
${XEUS_INCLUDE_DIR}/xeus/xinput.hpp
${XEUS_INCLUDE_DIR}/xeus/xinterpreter.hpp
${XEUS_INCLUDE_DIR}/xeus/xjson.hpp
${XEUS_INCLUDE_DIR}/xeus/xkernel.hpp
${XEUS_INCLUDE_DIR}/xeus/xkernel_configuration.hpp
${XEUS_INCLUDE_DIR}/xeus/xlogger.hpp
Expand Down
7 changes: 3 additions & 4 deletions include/xeus/xcomm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
#include <string>
#include <utility>

#include "nlohmann/json.hpp"

#include "xguid.hpp"
#include "xmessage.hpp"
#include "xeus/xguid.hpp"
#include "xeus/xjson.hpp"
#include "xeus/xmessage.hpp"

namespace nl = nlohmann;

Expand Down
3 changes: 1 addition & 2 deletions include/xeus/xcontrol_messenger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
#ifndef XEUS_CONTROL_MESSENGER_HPP
#define XEUS_CONTROL_MESSENGER_HPP

#include "nlohmann/json.hpp"

#include "xeus/xeus.hpp"
#include "xeus/xjson.hpp"

namespace nl = nlohmann;

Expand Down
11 changes: 5 additions & 6 deletions include/xeus/xdebugger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
#ifndef XEUS_DEBUGGER_HPP
#define XEUS_DEBUGGER_HPP

#include "nlohmann/json.hpp"

#include "xeus.hpp"
#include "xeus_context.hpp"
#include "xkernel_configuration.hpp"
#include "xcontrol_messenger.hpp"
#include "xeus/xeus.hpp"
#include "xeus/xeus_context.hpp"
#include "xeus/xjson.hpp"
#include "xeus/xkernel_configuration.hpp"
#include "xeus/xcontrol_messenger.hpp"

namespace nl = nlohmann;

Expand Down
2 changes: 1 addition & 1 deletion include/xeus/xeus_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <memory>

#include "xeus.hpp"
#include "xeus/xeus.hpp"

namespace xeus
{
Expand Down
2 changes: 1 addition & 1 deletion include/xeus/xguid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "xtl/xbasic_fixed_string.hpp"

#include "xeus.hpp"
#include "xeus/xeus.hpp"

namespace xeus
{
Expand Down
3 changes: 1 addition & 2 deletions include/xeus/xhelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
#include <vector>

#include "xeus/xeus.hpp"
#include "xeus/xjson.hpp"
#include "xeus/xkernel_configuration.hpp"

#include "nlohmann/json.hpp"

namespace nl = nlohmann;

namespace xeus
Expand Down
5 changes: 2 additions & 3 deletions include/xeus/xhistory_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
#include <string>
#include <vector>

#include "nlohmann/json.hpp"

#include "xeus.hpp"
#include "xeus/xeus.hpp"
#include "xeus/xjson.hpp"

namespace nl = nlohmann;

Expand Down
10 changes: 5 additions & 5 deletions include/xeus/xinterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#include <string>
#include <vector>

#include "xcomm.hpp"
#include "xeus.hpp"
#include "xcontrol_messenger.hpp"
#include "xhistory_manager.hpp"
#include "xrequest_context.hpp"
#include "xeus/xcomm.hpp"
#include "xeus/xeus.hpp"
#include "xeus/xcontrol_messenger.hpp"
#include "xeus/xhistory_manager.hpp"
#include "xeus/xrequest_context.hpp"

namespace xeus
{
Expand Down
25 changes: 25 additions & 0 deletions include/xeus/xjson.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/***************************************************************************
* Copyright (c) 2016, Johan Mabille, Sylvain Corlay, Martin Renou *
* Copyright (c) 2016, QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XEUS_JSON_HPP
#define XEUS_JSON_HPP

// Remove annoying false positive warning on GCC: json.hpp:1394:23: warning: potential null pointer dereference
// See https://github.com/nlohmann/json/issues/3525
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wnull-dereference"
# include "nlohmann/json.hpp"
# pragma GCC diagnostic pop
#else
# include "nlohmann/json.hpp"
#endif

#endif

17 changes: 9 additions & 8 deletions include/xeus/xkernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
#ifndef XEUS_KERNEL_HPP
#define XEUS_KERNEL_HPP

#include "xdebugger.hpp"
#include "xeus.hpp"
#include "xeus_context.hpp"
#include "xhistory_manager.hpp"
#include "xinterpreter.hpp"
#include "xkernel_configuration.hpp"
#include "xserver.hpp"
#include "xlogger.hpp"
#include <memory>
#include <string>
#include <functional>

#include "xeus/xdebugger.hpp"
#include "xeus/xeus.hpp"
#include "xeus/xeus_context.hpp"
#include "xeus/xhistory_manager.hpp"
#include "xeus/xinterpreter.hpp"
#include "xeus/xkernel_configuration.hpp"
#include "xeus/xserver.hpp"
#include "xeus/xlogger.hpp"

namespace xeus
{
class xkernel_core;
Expand Down
2 changes: 1 addition & 1 deletion include/xeus/xkernel_configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <string>

#include "xeus.hpp"
#include "xeus/xeus.hpp"

namespace xeus
{
Expand Down
7 changes: 3 additions & 4 deletions include/xeus/xlogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

#include <memory>

#include "nlohmann/json.hpp"

#include "xeus.hpp"
#include "xmessage.hpp"
#include "xeus/xeus.hpp"
#include "xeus/xjson.hpp"
#include "xeus/xmessage.hpp"

namespace nl = nlohmann;

Expand Down
4 changes: 2 additions & 2 deletions include/xeus/xmessage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <string>
#include <vector>

#include "nlohmann/json.hpp"
#include "xeus.hpp"
#include "xeus/xeus.hpp"
#include "xeus/xjson.hpp"

namespace nl = nlohmann;

Expand Down
2 changes: 1 addition & 1 deletion include/xeus/xrequest_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <vector>

#include "xeus/xeus.hpp"
#include "nlohmann/json.hpp"
#include "xeus/xjson.hpp"
#include "xeus/xmessage.hpp" // for xmessage::guid_list
#include "xeus/xserver.hpp" // for channel

Expand Down
8 changes: 4 additions & 4 deletions include/xeus/xserver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

#include <functional>

#include "xeus.hpp"
#include "xkernel_configuration.hpp"
#include "xcontrol_messenger.hpp"
#include "xmessage.hpp"
#include "xeus/xeus.hpp"
#include "xeus/xkernel_configuration.hpp"
#include "xeus/xcontrol_messenger.hpp"
#include "xeus/xmessage.hpp"

namespace xeus
{
Expand Down
2 changes: 1 addition & 1 deletion include/xeus/xsystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <string>

#include "xeus.hpp"
#include "xeus/xeus.hpp"

namespace xeus
{
Expand Down
2 changes: 0 additions & 2 deletions src/xhistory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <string>
#include <vector>

#include "nlohmann/json.hpp"

#include "xeus/xhistory_manager.hpp"
#include "xin_memory_history_manager.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/xin_memory_history_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <string>
#include <regex>

#include "nlohmann/json.hpp"
#include "xeus/xjson.hpp"

#include "xin_memory_history_manager.hpp"

Expand Down
3 changes: 1 addition & 2 deletions src/xkernel_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <fstream>
#include <string>

#include "nlohmann/json.hpp"

#include "xeus/xjson.hpp"
#include "xeus/xkernel_configuration.hpp"

namespace nl = nlohmann;
Expand Down
1 change: 0 additions & 1 deletion src/xkernel_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ namespace xeus
xcomm_manager& comm_manager() & noexcept;
const xcomm_manager& comm_manager() const & noexcept;
xcomm_manager comm_manager() const && noexcept;
const nl::json& parent_header(channel c) const noexcept;

private:

Expand Down
3 changes: 1 addition & 2 deletions src/xlogger_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <fstream>
#include <iostream>

#include "nlohmann/json.hpp"

#include "xeus/xjson.hpp"
#include "xeus/xmessage.hpp"
#include "xlogger_impl.hpp"

Expand Down

0 comments on commit 1bbef72

Please sign in to comment.