MeteoIODoc 20240328.18c31bd1
mio::JsonWrapper Class Reference

Detailed Description

This is a wrapper class around picoJson and Curl.

This class relies on an embedded version of picojson for reading and parsing JSON data. Picojson is released under a 2-Clause BSD License. Please find here below the full license agreement for picojson:

Copyright 2009-2010 Cybozu Labs, Inc.
Copyright 2011-2014 Kazuho Oku
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Date
2021-11-23

#include <JsonWrapper.h>

Public Member Functions

 JsonWrapper ()
 
 JsonWrapper (const JsonWrapper &)
 
 ~JsonWrapper ()
 
JsonWrapperoperator= (const mio::JsonWrapper &)
 
void setConnectionParams (const std::string &i_proxy_url, const int &i_http_timeout, const bool &i_debug=false)
 Set the connection parameters for CURL. More...
 
void readAndParse (const std::string &request, const std::string &where)
 
std::vector< picojson::value > JSONQuery (const std::string &path) const
 
picojson::value goToJSONPath (const std::string &path) const
 
std::string getString (const std::string &path) const
 
std::vector< std::string > getStrings (const std::string &path) const
 
double getDouble (const std::string &path) const
 
std::vector< double > getDoubles (const std::string &path) const
 

Static Public Member Functions

static void printJSON (const picojson::value &v, const unsigned int &depth)
 

Constructor & Destructor Documentation

◆ JsonWrapper() [1/2]

mio::JsonWrapper::JsonWrapper ( )

◆ JsonWrapper() [2/2]

mio::JsonWrapper::JsonWrapper ( const JsonWrapper c)

◆ ~JsonWrapper()

mio::JsonWrapper::~JsonWrapper ( )

Member Function Documentation

◆ getDouble()

double mio::JsonWrapper::getDouble ( const std::string &  path) const

◆ getDoubles()

std::vector< double > mio::JsonWrapper::getDoubles ( const std::string &  path) const

◆ getString()

std::string mio::JsonWrapper::getString ( const std::string &  path) const

◆ getStrings()

std::vector< std::string > mio::JsonWrapper::getStrings ( const std::string &  path) const

◆ goToJSONPath()

picojson::value mio::JsonWrapper::goToJSONPath ( const std::string &  path) const

◆ JSONQuery()

std::vector< picojson::value > mio::JsonWrapper::JSONQuery ( const std::string &  path) const

◆ operator=()

JsonWrapper & mio::JsonWrapper::operator= ( const mio::JsonWrapper c)

◆ printJSON()

void mio::JsonWrapper::printJSON ( const picojson::value &  v,
const unsigned int &  depth 
)
static

◆ readAndParse()

void mio::JsonWrapper::readAndParse ( const std::string &  request,
const std::string &  where 
)

◆ setConnectionParams()

void mio::JsonWrapper::setConnectionParams ( const std::string &  i_proxy_url,
const int &  i_http_timeout,
const bool &  i_debug = false 
)

Set the connection parameters for CURL.

Parameters
[in]i_proxy_urloptional SOCKS5 proxy URL
[in]i_http_timeouttimeout in seconds for the connections
[in]i_debugenable debug outputs?

The documentation for this class was generated from the following files: