Use json forward-declarations

This commit is contained in:
Desour 2023-03-25 19:48:50 +01:00 committed by DS
parent 8b73743baa
commit 7f6b09dce8
12 changed files with 47 additions and 10 deletions

View File

@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <sstream> #include <sstream>
#include <cmath> #include <cmath>
#include <IFileSystem.h> #include <IFileSystem.h>
#include <json/json.h>
#include "client.h" #include "client.h"
#include "network/clientopcodes.h" #include "network/clientopcodes.h"
#include "network/connection.h" #include "network/connection.h"

View File

@ -27,6 +27,7 @@
#cmakedefine01 USE_PROMETHEUS #cmakedefine01 USE_PROMETHEUS
#cmakedefine01 USE_SPATIAL #cmakedefine01 USE_SPATIAL
#cmakedefine01 USE_SYSTEM_GMP #cmakedefine01 USE_SYSTEM_GMP
#cmakedefine01 USE_SYSTEM_JSONCPP
#cmakedefine01 USE_REDIS #cmakedefine01 USE_REDIS
#cmakedefine01 HAVE_ENDIAN_H #cmakedefine01 HAVE_ENDIAN_H
#cmakedefine01 CURSES_HAVE_CURSES_H #cmakedefine01 CURSES_HAVE_CURSES_H

View File

@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <vector> #include <vector>
#include <string> #include <string>
#include <map> #include <map>
#include <json/json.h> #include "json-forwards.h"
#include <unordered_set> #include <unordered_set>
#include "util/basic_macros.h" #include "util/basic_macros.h"
#include "config.h" #include "config.h"

View File

@ -17,12 +17,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "convert_json.h"
#include <json/json.h>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <memory> #include <memory>
#include "convert_json.h"
void fastWriteJson(const Json::Value &value, std::ostream &to) void fastWriteJson(const Json::Value &value, std::ostream &to)
{ {
Json::StreamWriterBuilder builder; Json::StreamWriterBuilder builder;

View File

@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once #pragma once
#include <json/json.h> #include "json-forwards.h"
#include <ostream> #include <ostream>
void fastWriteJson(const Json::Value &value, std::ostream &to); void fastWriteJson(const Json::Value &value, std::ostream &to);

View File

@ -17,15 +17,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <cassert>
#include "convert_json.h"
#include "database-files.h" #include "database-files.h"
#include "convert_json.h"
#include "remoteplayer.h" #include "remoteplayer.h"
#include "settings.h" #include "settings.h"
#include "porting.h" #include "porting.h"
#include "filesys.h" #include "filesys.h"
#include "server/player_sao.h" #include "server/player_sao.h"
#include "util/string.h" #include "util/string.h"
#include <cassert>
// !!! WARNING !!! // !!! WARNING !!!
// This backend is intended to be used on Minetest 0.4.16 only for the transition backend // This backend is intended to be used on Minetest 0.4.16 only for the transition backend

View File

@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "database.h" #include "database.h"
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <json/json.h> #include <json/json.h> // for Json::Value
class PlayerDatabaseFiles : public PlayerDatabase class PlayerDatabaseFiles : public PlayerDatabase
{ {

31
src/json-forwards.h Normal file
View File

@ -0,0 +1,31 @@
/*
Minetest
Copyright (C) 2023 DS
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "config.h"
#if USE_SYSTEM_JSONCPP
#include <json/version.h>
#include <json/allocator.h>
#include <json/config.h>
#include <json/forwards.h>
#else
#include <json/json-forwards.h>
#endif

View File

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/ */
#include <algorithm> #include <algorithm>
#include <stack>
#include "serverenvironment.h" #include "serverenvironment.h"
#include "settings.h" #include "settings.h"
#include "log.h" #include "log.h"

View File

@ -17,10 +17,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <iostream>
#include "config.h" #include "config.h"
#include "content/mods.h" #include "content/mods.h"
#include <json/json.h> #include "json-forwards.h"
#include <iostream>
#pragma once #pragma once

View File

@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "convert_json.h" #include "convert_json.h"
#include "util/serialize.h" #include "util/serialize.h"
#include "util/numeric.h" #include "util/numeric.h"
#include <json/json.h>
void ToolGroupCap::toJson(Json::Value &object) const void ToolGroupCap::toJson(Json::Value &object) const
{ {

View File

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "itemgroup.h" #include "itemgroup.h"
#include <json/json.h> #include "json-forwards.h"
struct ItemDefinition; struct ItemDefinition;