mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 05:52:23 +08:00
🔥 use simdjson instead of nlohmannjson
This commit is contained in:
parent
119d4a5767
commit
5f95fbab5c
@ -105,21 +105,21 @@ add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language :
|
||||
executable(
|
||||
'cachyos-installer',
|
||||
src_files,
|
||||
dependencies: [fmt, spdlog, ftxui, cpr, glibmm],
|
||||
dependencies: [fmt, spdlog, ftxui, simdjson, cpr, glibmm],
|
||||
include_directories: [include_directories('src')],
|
||||
install: true)
|
||||
|
||||
executable(
|
||||
'test-exec-interactive',
|
||||
files('src/config.cpp', 'src/tui.cpp', 'src/utils.cpp', 'src/main_test.cpp'),
|
||||
dependencies: [fmt, spdlog, ftxui, cpr, glibmm],
|
||||
dependencies: [fmt, spdlog, ftxui, simdjson, cpr, glibmm],
|
||||
include_directories: [include_directories('src')],
|
||||
install: false)
|
||||
|
||||
executable(
|
||||
'test-process-tailing',
|
||||
files('src/config.cpp', 'src/widgets.cpp', 'src/tui.cpp', 'src/utils.cpp', 'src/follow_process_log.cpp','src/test_proccess_tailing.cpp'),
|
||||
dependencies: [fmt, spdlog, ftxui, cpr, glibmm],
|
||||
dependencies: [fmt, spdlog, ftxui, simdjson, cpr, glibmm],
|
||||
include_directories: [include_directories('src')],
|
||||
install: false)
|
||||
|
||||
|
@ -25,6 +25,8 @@ int main() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
utils::parse_config();
|
||||
|
||||
if (!Config::initialize()) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -46,6 +46,23 @@ namespace ranges = std::ranges;
|
||||
#include <cpr/timeout.h>
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#pragma GCC diagnostic ignored "-Wuseless-cast"
|
||||
#endif
|
||||
|
||||
#include <simdjson.h>
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace utils {
|
||||
@ -465,4 +482,18 @@ void show_iwctl() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void parse_config() noexcept {
|
||||
using namespace simdjson;
|
||||
|
||||
ondemand::parser parser;
|
||||
padded_string json = padded_string::load("test.json");
|
||||
ondemand::document doc = parser.iterate(json);
|
||||
|
||||
for (auto entry : doc["steps"]) {
|
||||
std::string_view step;
|
||||
entry.get(step);
|
||||
std::cout << step << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
@ -34,6 +34,8 @@ void id_system() noexcept;
|
||||
[[nodiscard]] bool handle_connection() noexcept;
|
||||
void show_iwctl() noexcept;
|
||||
|
||||
void parse_config() noexcept;
|
||||
|
||||
template <typename T = std::int32_t,
|
||||
typename = std::enable_if_t<std::numeric_limits<T>::is_integer>>
|
||||
inline T to_int(const std::string_view& str) {
|
||||
|
Loading…
Reference in New Issue
Block a user