mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2025-10-26 10:52:21 +00:00
Change scripts toml11 version.
This commit is contained in:
@@ -41,7 +41,7 @@ sudo install -d /usr/local/include/date/
|
|||||||
sudo install -m644 libcron/externals/date/include/date/* /usr/local/include/date/
|
sudo install -m644 libcron/externals/date/include/date/* /usr/local/include/date/
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
git clone https://github.com/ToruNiina/toml11 --depth=1
|
git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1
|
||||||
cd toml11
|
cd toml11
|
||||||
cmake -DCMAKE_CXX_STANDARD=11 .
|
cmake -DCMAKE_CXX_STANDARD=11 .
|
||||||
sudo make install -j6 > /dev/null
|
sudo make install -j6 > /dev/null
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ cmake -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD
|
|||||||
make install -j4
|
make install -j4
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
git clone https://github.com/ToruNiina/toml11 --depth=1
|
git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1
|
||||||
cd toml11
|
cd toml11
|
||||||
cmake -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DCMAKE_CXX_STANDARD=11 .
|
cmake -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DCMAKE_CXX_STANDARD=11 .
|
||||||
make install -j4
|
make install -j4
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <toml.hpp>
|
|
||||||
|
|
||||||
#include "config/binding.h"
|
#include "config/binding.h"
|
||||||
#include "handler/webget.h"
|
#include "handler/webget.h"
|
||||||
@@ -565,12 +564,12 @@ void readYAMLConf(YAML::Node &node)
|
|||||||
writeLog(0, "Load preference settings in YAML format completed.", LOG_LEVEL_INFO);
|
writeLog(0, "Load preference settings in YAML format completed.", LOG_LEVEL_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class... U>
|
//template <class T, class... U>
|
||||||
void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args)
|
//void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args)
|
||||||
{
|
//{
|
||||||
if(v.contains(k)) target = toml::find<T>(v, k);
|
// if(v.contains(k)) target = toml::find<T>(v, k);
|
||||||
if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward<U>(args)...);
|
// if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward<U>(args)...);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void operate_toml_kv_table(const std::vector<toml::table> &arr, const toml::key &key_name, const toml::key &value_name, std::function<void (const toml::value&, const toml::value&)> binary_op)
|
void operate_toml_kv_table(const std::vector<toml::table> &arr, const toml::key &key_name, const toml::key &value_name, std::function<void (const toml::value&, const toml::value&)> binary_op)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "utils/string.h"
|
#include "utils/string.h"
|
||||||
#include "utils/stl_extra.h"
|
#include "utils/stl_extra.h"
|
||||||
#include "utils/tribool.h"
|
#include "utils/tribool.h"
|
||||||
|
#include <toml.hpp>
|
||||||
|
|
||||||
struct Settings
|
struct Settings
|
||||||
{
|
{
|
||||||
@@ -100,7 +101,12 @@ extern Settings global;
|
|||||||
|
|
||||||
int importItems(string_array &target, bool scope_limit = true);
|
int importItems(string_array &target, bool scope_limit = true);
|
||||||
int loadExternalConfig(std::string &path, ExternalConfig &ext);
|
int loadExternalConfig(std::string &path, ExternalConfig &ext);
|
||||||
|
template <class T, class... U>
|
||||||
|
void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args)
|
||||||
|
{
|
||||||
|
if(v.contains(k)) target = toml::find<T>(v, k);
|
||||||
|
if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward<U>(args)...);
|
||||||
|
}
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
void parseGroupTimes(const std::string &src, Args... args)
|
void parseGroupTimes(const std::string &src, Args... args)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user