-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
85 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
file(GLOB_RECURSE project_interface_src *.h *.hpp *.cpp) | ||
file(GLOB_RECURSE project_interface_header ../include/ProjectInterface/*) | ||
|
||
add_library(ProjectInterface STATIC ${project_interface_src} ${project_interface_header}) | ||
|
||
target_include_directories(ProjectInterface | ||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/../../include) | ||
|
||
target_link_libraries(ProjectInterface MaaUtils HeaderOnlyLibraries Boost::system) | ||
|
||
add_dependencies(ProjectInterface MaaUtils) | ||
|
||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${project_interface_src}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "ProjectInterface/Parser.h" | ||
|
||
#include "Utils/Logger.h" | ||
|
||
MAA_PROJECT_INTERFACE_NS_BEGIN | ||
|
||
std::optional<InterfaceData> Parser::parse(const std::filesystem::path& path) | ||
{ | ||
LogFunc << VAR(path); | ||
|
||
auto root_opt = json::open(path); | ||
if (!root_opt) { | ||
LogError << "failed to parse" << path; | ||
return std::nullopt; | ||
} | ||
const json::value& root = *root_opt; | ||
|
||
std::string error_key; | ||
if (!InterfaceData().check_json(root, error_key)) { | ||
LogError << "json is not an InterfaceData" << VAR(error_key) << VAR(root); | ||
return std::nullopt; | ||
} | ||
|
||
return root.as<InterfaceData>(); | ||
} | ||
|
||
MAA_PROJECT_INTERFACE_NS_END |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include <filesystem> | ||
#include <optional> | ||
#include <unordered_map> | ||
#include <utility> | ||
|
||
#include "Types.h" | ||
|
||
MAA_PROJECT_INTERFACE_NS_BEGIN | ||
|
||
class Parser | ||
{ | ||
public: | ||
static std::optional<InterfaceData> parse(const std::filesystem::path& path); | ||
}; | ||
|
||
MAA_PROJECT_INTERFACE_NS_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.