diff options
| author | thecharlesblake | 2018-01-03 12:39:06 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-03 12:39:06 +0000 |
| commit | fa40f6facc5c500cae8bf890e66a7bf5d490387e (patch) | |
| tree | 9b3202e433e5151a38f78084ee843b20edec4f89 /src/main/util/util.cpp | |
| parent | Major refactor, putting pile logic into game_state (diff) | |
| download | metasol-fa40f6facc5c500cae8bf890e66a7bf5d490387e.tar.gz metasol-fa40f6facc5c500cae8bf890e66a7bf5d490387e.zip | |
Rename util to json_helper
Diffstat (limited to 'src/main/util/util.cpp')
| -rw-r--r-- | src/main/util/util.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/main/util/util.cpp b/src/main/util/util.cpp deleted file mode 100644 index 7e7de8d..0000000 --- a/src/main/util/util.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// Created by thecharlesblake on 11/13/17. -// - -#include <fstream> -#include <sstream> - -#include "util.h" - -using namespace std; -using namespace rapidjson; - -Document util::get_file_json(const string& filename) { - // Reads the file into a string - std::ifstream ifstr(filename); - std::stringstream buf; - buf << ifstr.rdbuf(); - - if (ifstr.fail()) { - throw runtime_error("could not read file " + filename); - } else { - Document d; - - d.Parse(buf.str().c_str()); - if (d.HasParseError()) { - throw runtime_error(filename + " not valid json"); - } else { - return d; - } - } -} - -void util::json_parse_err(const string& msg) { - throw runtime_error("Error in JSON doc: " + msg); -} |
