Files
OrcaSlicer/src/slic3r/Utils/json_diff.hpp
T
HanifKoh 6639a32b0c Remove using namespace std from json_diff.hpp (#16222)
The directive sat at global scope in a header that DeviceManager.hpp
includes, so most of the GUI compiled with all of std in the global
namespace. 42 files had come to rely on it, mostly for string, vector
and unordered_map, four of them for the ""sv and ""ms literals.

Those sites are qualified. GCodeViewer.cpp spelled the type as
std::vector<::string>, which only resolved through the directive. The
files that use the ""sv and ""ms literals get a file-scope
"using namespace std::string_view_literals;" or
"using namespace std::chrono_literals;", as other sources already do.
2026-10-07 14:58:49 +08:00

38 lines
1.2 KiB
C++

#ifndef __JSON_DIFF_HPP
#define __JSON_DIFF_HPP
#include <string>
#include <atomic>
#include <vector>
#include "nlohmann/json.hpp"
class json_diff
{
private:
std::string printer_type;
std::string printer_version = "00.00.00.00";
nlohmann::json settings_base;
nlohmann::json full_message;
nlohmann::json diff2all_base;
nlohmann::json all2diff_base;
int decode_error_count = 0;
int diff_objects(nlohmann::json const &in, nlohmann::json &out, nlohmann::json const &base);
int restore_objects(nlohmann::json const &in, nlohmann::json &out, nlohmann::json const &base);
int restore_append_objects(nlohmann::json const &in, nlohmann::json &out);
void merge_objects(nlohmann::json const &in, nlohmann::json &out);
public:
bool load_compatible_settings(std::string const &type, std::string const &version);
int all2diff(nlohmann::json const &in, nlohmann::json &out);
int diff2all(nlohmann::json const &in, nlohmann::json &out);
int all2diff_base_reset(nlohmann::json const &base);
int diff2all_base_reset(nlohmann::json &base);
void compare_print(nlohmann::json &a, nlohmann::json &b);
bool is_need_request();
};
#endif // __JSON_DIFF_HPP