aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
Diffstat (limited to 'libdevcore')
-rw-r--r--libdevcore/CMakeLists.txt16
-rw-r--r--libdevcore/JSON.cpp8
-rw-r--r--libdevcore/JSON.h7
3 files changed, 28 insertions, 3 deletions
diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt
index fa7e3f48..01a8bcc6 100644
--- a/libdevcore/CMakeLists.txt
+++ b/libdevcore/CMakeLists.txt
@@ -1,7 +1,17 @@
-file(GLOB sources "*.cpp")
-file(GLOB headers "*.h")
+set(sources
+ CommonData.cpp
+ CommonIO.cpp
+ Exceptions.cpp
+ IndentedWriter.cpp
+ JSON.cpp
+ Keccak256.cpp
+ StringUtils.cpp
+ SwarmHash.cpp
+ UTF8.cpp
+ Whiskers.cpp
+)
-add_library(devcore ${sources} ${headers})
+add_library(devcore ${sources})
target_link_libraries(devcore PRIVATE jsoncpp ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_include_directories(devcore PUBLIC "${CMAKE_SOURCE_DIR}")
target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
diff --git a/libdevcore/JSON.cpp b/libdevcore/JSON.cpp
index 6317cc89..086fae50 100644
--- a/libdevcore/JSON.cpp
+++ b/libdevcore/JSON.cpp
@@ -21,6 +21,8 @@
#include "JSON.h"
+#include "CommonIO.h"
+
#include <sstream>
#include <map>
#include <memory>
@@ -111,4 +113,10 @@ bool jsonParse(string const& _input, Json::Value& _json, string *_errs /* = null
return parse(readerBuilder, _input, _json, _errs);
}
+bool jsonParseFile(string const& _fileName, Json::Value& _json, string *_errs /* = nullptr */)
+{
+ return jsonParse(readFileAsString(_fileName), _json, _errs);
+}
+
+
} // namespace dev
diff --git a/libdevcore/JSON.h b/libdevcore/JSON.h
index 1ce822cd..ecb93467 100644
--- a/libdevcore/JSON.h
+++ b/libdevcore/JSON.h
@@ -48,4 +48,11 @@ bool jsonParseStrict(std::string const& _input, Json::Value& _json, std::string*
/// \return \c true if the document was successfully parsed, \c false if an error occurred.
bool jsonParse(std::string const& _input, Json::Value& _json, std::string* _errs = nullptr);
+/// Parse a JSON string (@a _input) and writes resulting JSON object to (@a _json)
+/// \param _input file containing JSON input
+/// \param _json [out] resulting JSON object
+/// \param _errs [out] Formatted error messages
+/// \return \c true if the document was successfully parsed, \c false if an error occurred.
+bool jsonParseFile(std::string const& _fileName, Json::Value& _json, std::string* _errs = nullptr);
+
}