aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/defines/Define.cpp
blob: 8d910cbce9a82f894c5b0bde4815784ffbcff85c (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
#include "Define.hpp"

#include "openvic-simulation/dataloader/NodeTools.hpp"

using namespace OpenVic;
using namespace OpenVic::NodeTools;

DefineManager::DefineManager() : start_date {}, end_date {} {}

bool DefineManager::load_defines_file(ast::NodeCPtr root) {
   return expect_dictionary_keys(
      "defines", ONE_EXACTLY, expect_dictionary_keys(
         "start_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(start_date)),
         "end_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(end_date)),

         ai_defines.get_name(), ONE_EXACTLY, ai_defines.expect_defines(),
         country_defines.get_name(), ONE_EXACTLY, country_defines.expect_defines(),
         diplomacy_defines.get_name(), ONE_EXACTLY, diplomacy_defines.expect_defines(),
         economy_defines.get_name(), ONE_EXACTLY, economy_defines.expect_defines(),
         graphics_defines.get_name(), ONE_EXACTLY, graphics_defines.expect_defines(),
         military_defines.get_name(), ONE_EXACTLY, military_defines.expect_defines(),
         pops_defines.get_name(), ONE_EXACTLY, pops_defines.expect_defines()
      )
   )(root);
}