feat update optional
Some checks failed
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 4m44s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 4m33s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 4m38s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 4m42s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 4m11s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 4m22s
Some checks failed
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 4m44s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 4m33s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 4m38s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 4m42s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 4m11s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 4m22s
This commit is contained in:
parent
5f299117fe
commit
d1fe196bb5
@ -50,7 +50,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
sled::optional<Callback> callback_;
|
||||
tl::optional<Callback> callback_;
|
||||
};
|
||||
|
||||
template<typename... Args, typename Callback>
|
||||
|
@ -256,16 +256,16 @@ Config::AddDefaultNode(sled::string_view key, ValueType value)
|
||||
auto first_key = keys[0];
|
||||
switch (value.index()) {
|
||||
case 0:
|
||||
toml_[first_key] = sled::get<bool>(value);
|
||||
toml_[first_key] = mpark::get<bool>(value);
|
||||
break;
|
||||
case 1:
|
||||
toml_[first_key] = sled::get<std::string>(value);
|
||||
toml_[first_key] = mpark::get<std::string>(value);
|
||||
break;
|
||||
case 2:
|
||||
toml_[first_key] = sled::get<int>(value);
|
||||
toml_[first_key] = mpark::get<int>(value);
|
||||
break;
|
||||
case 3:
|
||||
toml_[first_key] = sled::get<double>(value);
|
||||
toml_[first_key] = mpark::get<double>(value);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@ -284,16 +284,16 @@ Config::GetValueNode(sled::string_view key, toml::value &value) const
|
||||
auto &default_value = iter->second;
|
||||
switch (default_value.index()) {
|
||||
case 0:
|
||||
value = sled::get<bool>(default_value);
|
||||
value = mpark::get<bool>(default_value);
|
||||
break;
|
||||
case 1:
|
||||
value = sled::get<std::string>(default_value);
|
||||
value = mpark::get<std::string>(default_value);
|
||||
break;
|
||||
case 2:
|
||||
value = sled::get<int>(default_value);
|
||||
value = mpark::get<int>(default_value);
|
||||
break;
|
||||
case 3:
|
||||
value = sled::get<double>(default_value);
|
||||
value = mpark::get<double>(default_value);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@ -309,16 +309,16 @@ Config::GetDefaultNode(sled::string_view key, toml::value &value) const
|
||||
auto &default_value = iter->second;
|
||||
switch (default_value.index()) {
|
||||
case 0:
|
||||
value = sled::get<bool>(default_value);
|
||||
value = mpark::get<bool>(default_value);
|
||||
break;
|
||||
case 1:
|
||||
value = sled::get<std::string>(default_value);
|
||||
value = mpark::get<std::string>(default_value);
|
||||
break;
|
||||
case 2:
|
||||
value = sled::get<int>(default_value);
|
||||
value = mpark::get<int>(default_value);
|
||||
break;
|
||||
case 3:
|
||||
value = sled::get<double>(default_value);
|
||||
value = mpark::get<double>(default_value);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -8,9 +8,9 @@
|
||||
namespace sled {
|
||||
class Config {
|
||||
public:
|
||||
using ValueType = sled::variant<bool, std::string, int, double>;
|
||||
using ValueType = mpark::variant<bool, std::string, int, double>;
|
||||
Config();
|
||||
virtual ~Config()=default;
|
||||
virtual ~Config() = default;
|
||||
Config(sled::string_view name);
|
||||
Config(sled::string_view name, sled::string_view path);
|
||||
Config(const Config &lhs) = delete;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -93,7 +93,7 @@ private:
|
||||
void OnOperationComplete();
|
||||
|
||||
std::queue<std::unique_ptr<internal::Operation>> chained_operations_;
|
||||
sled::optional<std::function<void()>> on_chain_empty_callback_;
|
||||
tl::optional<std::function<void()>> on_chain_empty_callback_;
|
||||
};
|
||||
|
||||
}// namespace sled
|
||||
|
@ -2178,6 +2178,12 @@ struct hash<tl::optional<T>> {
|
||||
};
|
||||
}// namespace std
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef SLED_OPTIONAL_H
|
||||
#define SLED_OPTIONAL_H
|
||||
|
||||
// TODO: Remove this
|
||||
namespace sled {
|
||||
using namespace tl;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ private:
|
||||
}
|
||||
|
||||
Status status_;
|
||||
sled::optional<T> value_;
|
||||
tl::optional<T> value_;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -66,9 +66,9 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
sled::optional<Failure> Update(bool force_reload)
|
||||
tl::optional<Failure> Update(bool force_reload)
|
||||
{
|
||||
if (cr_plugin_update(ctx_, force_reload) == 0) { return sled::nullopt; }
|
||||
if (cr_plugin_update(ctx_, force_reload) == 0) { return tl::nullopt; }
|
||||
return detail::TranslateFailure(ctx_.failure);
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ HotReloader::Initialize()
|
||||
return impl_->Initialize();
|
||||
}
|
||||
|
||||
sled::optional<HotReloader::Failure>
|
||||
tl::optional<HotReloader::Failure>
|
||||
HotReloader::UpdateOrError(bool force_reload)
|
||||
{
|
||||
return impl_->Update(force_reload);
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
* @force_reload: 如果当前库已经加载,是否reload当前库
|
||||
* @ status: 如果不为nullptr,返回当前加载状态
|
||||
**/
|
||||
sled::optional<Failure> UpdateOrError(bool force_reload = true);
|
||||
tl::optional<Failure> UpdateOrError(bool force_reload = true);
|
||||
// bool Rollback();
|
||||
|
||||
void set_userdata(void *data);
|
||||
|
2441
src/sled/variant.h
2441
src/sled/variant.h
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user