2014-03-12 22:39:37 +01:00
|
|
|
// jsonprops.hxx -- convert properties from/to json
|
|
|
|
//
|
|
|
|
// Written by Torsten Dreyer, started April 2014.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2014 Torsten Dreyer
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 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
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU 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.
|
|
|
|
|
|
|
|
#ifndef JSONPROPS_HXX_
|
|
|
|
#define JSONPROPS_HXX_
|
|
|
|
|
|
|
|
#include <simgear/props/props.hxx>
|
|
|
|
#include <3rdparty/cjson/cJSON.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace flightgear {
|
|
|
|
namespace http {
|
|
|
|
class JSON {
|
|
|
|
public:
|
2014-03-26 08:51:15 +01:00
|
|
|
static cJSON * toJson(SGPropertyNode_ptr n, int depth, double timestamp = -1.0 );
|
|
|
|
static std::string toJsonString(bool indent, SGPropertyNode_ptr n, int depth, double timestamp = -1.0 );
|
2014-05-17 09:07:25 +01:00
|
|
|
|
2014-03-12 22:39:37 +01:00
|
|
|
static void toProp(cJSON * json, SGPropertyNode_ptr base);
|
2014-05-17 09:07:25 +01:00
|
|
|
static void addChildrenToProp(cJSON * json, SGPropertyNode_ptr base);
|
2014-03-12 22:39:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace http
|
|
|
|
} // namespace flightgear
|
|
|
|
|
|
|
|
#endif /* JSONPROPS_HXX_ */
|