aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output/input/json-parsing/json_helper.h
blob: 460911ff383ec2cd0797bd09c3e34fa9a1937b0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Created by thecharlesblake on 11/13/17.
//

#ifndef SOLVITAIRE_UTIL_H
#define SOLVITAIRE_UTIL_H

#include <string>

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>

#include "../../../../../lib/rapidjson/schema.h"
#include "../../../game/search-state/game_state.h"

class json_helper {
public:
    static rapidjson::Document get_file_json(const std::string&);
    static void json_parse_warning(const std::string& msg);
    static void json_parse_err(const std::string& msg);
    static const std::string schema_err_str(const rapidjson::SchemaValidator&);
    static void print_game_state_as_json(const game_state&);
private:
    static boost::property_tree::ptree piles_to_ptree(const game_state&, const std::list<pile::ref>&);
    static boost::property_tree::ptree piles_to_ptree(const game_state&, const std::vector<pile::ref>&);
    static boost::property_tree::ptree pile_to_ptree(const pile&);
    static boost::property_tree::ptree card_to_ptree(const card&);
};


#endif //SOLVITAIRE_UTIL_H