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

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

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

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

@ -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.
*/
#include "convert_json.h"
#include <json/json.h>
#include <iostream>
#include <sstream>
#include <memory>
#include "convert_json.h"
void fastWriteJson(const Json::Value &value, std::ostream &to)
{
Json::StreamWriterBuilder builder;

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

@ -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.
*/
#include <cassert>
#include "convert_json.h"
#include "database-files.h"
#include "convert_json.h"
#include "remoteplayer.h"
#include "settings.h"
#include "porting.h"
#include "filesys.h"
#include "server/player_sao.h"
#include "util/string.h"
#include <cassert>
// !!! WARNING !!!
// This backend is intended to be used on Minetest 0.4.16 only for the transition backend

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

31
src/json-forwards.h Normal 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

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

@ -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.
*/
#include <iostream>
#include "config.h"
#include "content/mods.h"
#include <json/json.h>
#include "json-forwards.h"
#include <iostream>
#pragma once

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

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