2013-05-15 09:00:36 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2013 Statoil ASA, Ceetron AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-05-15 09:00:36 -05:00
|
|
|
// ResInsight 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 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-05-15 09:00:36 -05:00
|
|
|
// ResInsight 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2013-05-15 09:00:36 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-06-06 00:13:53 -05:00
|
|
|
#pragma once
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <QtCore/QMap>
|
2013-05-15 09:00:36 -05:00
|
|
|
#include <QtCore/QString>
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <QtCore/QVariant>
|
2013-05-15 09:00:36 -05:00
|
|
|
|
2016-06-06 03:43:36 -05:00
|
|
|
// Encapsulate the JSON code in a namespace to avoid issues with JSON classes used in opm-parser
|
2019-09-06 03:40:57 -05:00
|
|
|
namespace ResInsightInternalJson
|
|
|
|
{
|
2013-05-15 09:00:36 -05:00
|
|
|
class JsonReader
|
|
|
|
{
|
|
|
|
public:
|
2019-09-06 03:40:57 -05:00
|
|
|
QMap<QString, QVariant> decodeFile( QString filePath );
|
2023-01-06 07:56:41 -06:00
|
|
|
|
|
|
|
// Get a variant list from a map
|
|
|
|
static QVariantList getVariantList( const QMap<QString, QVariant>& map );
|
|
|
|
|
|
|
|
static QString rootKeyText();
|
2013-05-15 09:00:36 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class Json
|
|
|
|
{
|
|
|
|
public:
|
2022-10-18 03:07:16 -05:00
|
|
|
static QString encode( const QMap<QString, QVariant>& map, bool prettify );
|
|
|
|
static QMap<QString, QVariant> decode( const QString& jsonStr );
|
|
|
|
static QMap<QString, QVariant> decode( const QByteArray& byteArray );
|
2013-05-15 09:00:36 -05:00
|
|
|
};
|
2016-06-06 03:43:36 -05:00
|
|
|
|
2022-10-18 03:07:16 -05:00
|
|
|
} // namespace ResInsightInternalJson
|