From 882afd91325d03ae924fef648d7485295a450b59 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 14 Nov 2017 01:47:55 +0000 Subject: Add rules presets to resources --- src/main/util/util.cpp | 5 +++++ src/main/util/util.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/main/util/util.cpp create mode 100644 src/main/util/util.h (limited to 'src/main/util') diff --git a/src/main/util/util.cpp b/src/main/util/util.cpp new file mode 100644 index 0000000..ed46d3b --- /dev/null +++ b/src/main/util/util.cpp @@ -0,0 +1,5 @@ +// +// Created by thecharlesblake on 11/13/17. +// + +#include "util.h" diff --git a/src/main/util/util.h b/src/main/util/util.h new file mode 100644 index 0000000..63b8d0d --- /dev/null +++ b/src/main/util/util.h @@ -0,0 +1,14 @@ +// +// Created by thecharlesblake on 11/13/17. +// + +#ifndef SOLVITAIRE_UTIL_H +#define SOLVITAIRE_UTIL_H + + +class util { + +}; + + +#endif //SOLVITAIRE_UTIL_H -- cgit v1.2.1 From fbc39b856dc7b10e4d5dacb90741ea85f22da8bc Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 14 Nov 2017 01:50:18 +0000 Subject: Add util class, with read file to string method --- src/main/util/util.cpp | 18 ++++++++++++++++++ src/main/util/util.h | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src/main/util') diff --git a/src/main/util/util.cpp b/src/main/util/util.cpp index ed46d3b..46038aa 100644 --- a/src/main/util/util.cpp +++ b/src/main/util/util.cpp @@ -2,4 +2,22 @@ // Created by thecharlesblake on 11/13/17. // +#include +#include + #include "util.h" + +using namespace std; +using namespace boost; + +const optional util::read_file(const string& filename) { + ifstream ifstr(filename); + stringstream buf; + buf << ifstr.rdbuf(); + + if (ifstr.fail()) { + return none; + } else { + return buf.str(); + } +} diff --git a/src/main/util/util.h b/src/main/util/util.h index 63b8d0d..1721daa 100644 --- a/src/main/util/util.h +++ b/src/main/util/util.h @@ -5,9 +5,13 @@ #ifndef SOLVITAIRE_UTIL_H #define SOLVITAIRE_UTIL_H +#include -class util { +#include +class util { +public: + static const boost::optional read_file(const std::string&); }; -- cgit v1.2.1