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 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/util/util.cpp (limited to 'src/main/util/util.cpp') 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" -- 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 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main/util/util.cpp') 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(); + } +} -- cgit v1.2.1