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:
|
private:
|
||||||
sled::optional<Callback> callback_;
|
tl::optional<Callback> callback_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Args, typename Callback>
|
template<typename... Args, typename Callback>
|
||||||
|
@ -256,16 +256,16 @@ Config::AddDefaultNode(sled::string_view key, ValueType value)
|
|||||||
auto first_key = keys[0];
|
auto first_key = keys[0];
|
||||||
switch (value.index()) {
|
switch (value.index()) {
|
||||||
case 0:
|
case 0:
|
||||||
toml_[first_key] = sled::get<bool>(value);
|
toml_[first_key] = mpark::get<bool>(value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
toml_[first_key] = sled::get<std::string>(value);
|
toml_[first_key] = mpark::get<std::string>(value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
toml_[first_key] = sled::get<int>(value);
|
toml_[first_key] = mpark::get<int>(value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
toml_[first_key] = sled::get<double>(value);
|
toml_[first_key] = mpark::get<double>(value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -284,16 +284,16 @@ Config::GetValueNode(sled::string_view key, toml::value &value) const
|
|||||||
auto &default_value = iter->second;
|
auto &default_value = iter->second;
|
||||||
switch (default_value.index()) {
|
switch (default_value.index()) {
|
||||||
case 0:
|
case 0:
|
||||||
value = sled::get<bool>(default_value);
|
value = mpark::get<bool>(default_value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
value = sled::get<std::string>(default_value);
|
value = mpark::get<std::string>(default_value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
value = sled::get<int>(default_value);
|
value = mpark::get<int>(default_value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
value = sled::get<double>(default_value);
|
value = mpark::get<double>(default_value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -309,16 +309,16 @@ Config::GetDefaultNode(sled::string_view key, toml::value &value) const
|
|||||||
auto &default_value = iter->second;
|
auto &default_value = iter->second;
|
||||||
switch (default_value.index()) {
|
switch (default_value.index()) {
|
||||||
case 0:
|
case 0:
|
||||||
value = sled::get<bool>(default_value);
|
value = mpark::get<bool>(default_value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
value = sled::get<std::string>(default_value);
|
value = mpark::get<std::string>(default_value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
value = sled::get<int>(default_value);
|
value = mpark::get<int>(default_value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
value = sled::get<double>(default_value);
|
value = mpark::get<double>(default_value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
namespace sled {
|
namespace sled {
|
||||||
class Config {
|
class Config {
|
||||||
public:
|
public:
|
||||||
using ValueType = sled::variant<bool, std::string, int, double>;
|
using ValueType = mpark::variant<bool, std::string, int, double>;
|
||||||
Config();
|
Config();
|
||||||
virtual ~Config()=default;
|
virtual ~Config() = default;
|
||||||
Config(sled::string_view name);
|
Config(sled::string_view name);
|
||||||
Config(sled::string_view name, sled::string_view path);
|
Config(sled::string_view name, sled::string_view path);
|
||||||
Config(const Config &lhs) = delete;
|
Config(const Config &lhs) = delete;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -38,7 +38,7 @@ public:
|
|||||||
|
|
||||||
void Run() override
|
void Run() override
|
||||||
{
|
{
|
||||||
has_run_ = true;
|
has_run_ = true;
|
||||||
auto functor = std::move(functor_);
|
auto functor = std::move(functor_);
|
||||||
functor(std::move(callback_));
|
functor(std::move(callback_));
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ class OperationsChain final : public RefCountedNonVirtual<OperationsChain> {
|
|||||||
public:
|
public:
|
||||||
static scoped_refptr<OperationsChain> Create();
|
static scoped_refptr<OperationsChain> Create();
|
||||||
~OperationsChain();
|
~OperationsChain();
|
||||||
OperationsChain(const OperationsChain &) = delete;
|
OperationsChain(const OperationsChain &) = delete;
|
||||||
OperationsChain operator=(const OperationsChain &) = delete;
|
OperationsChain operator=(const OperationsChain &) = delete;
|
||||||
|
|
||||||
void SetOnChainEmptyCallback(std::function<void()> on_chain_empty_callback);
|
void SetOnChainEmptyCallback(std::function<void()> on_chain_empty_callback);
|
||||||
@ -79,7 +79,7 @@ private:
|
|||||||
explicit CallbackHandle(scoped_refptr<OperationsChain> operations_chain);
|
explicit CallbackHandle(scoped_refptr<OperationsChain> operations_chain);
|
||||||
~CallbackHandle();
|
~CallbackHandle();
|
||||||
|
|
||||||
CallbackHandle(const CallbackHandle &) = delete;
|
CallbackHandle(const CallbackHandle &) = delete;
|
||||||
CallbackHandle &operator=(const CallbackHandle &) = delete;
|
CallbackHandle &operator=(const CallbackHandle &) = delete;
|
||||||
void OnOperationComplete();
|
void OnOperationComplete();
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ private:
|
|||||||
void OnOperationComplete();
|
void OnOperationComplete();
|
||||||
|
|
||||||
std::queue<std::unique_ptr<internal::Operation>> chained_operations_;
|
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
|
}// namespace sled
|
||||||
|
@ -2178,6 +2178,12 @@ struct hash<tl::optional<T>> {
|
|||||||
};
|
};
|
||||||
}// namespace std
|
}// namespace std
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SLED_OPTIONAL_H
|
||||||
|
#define SLED_OPTIONAL_H
|
||||||
|
|
||||||
|
// TODO: Remove this
|
||||||
namespace sled {
|
namespace sled {
|
||||||
using namespace tl;
|
using namespace tl;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status status_;
|
Status status_;
|
||||||
sled::optional<T> value_;
|
tl::optional<T> value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -66,9 +66,9 @@ public:
|
|||||||
return false;
|
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);
|
return detail::TranslateFailure(ctx_.failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ HotReloader::Initialize()
|
|||||||
return impl_->Initialize();
|
return impl_->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
sled::optional<HotReloader::Failure>
|
tl::optional<HotReloader::Failure>
|
||||||
HotReloader::UpdateOrError(bool force_reload)
|
HotReloader::UpdateOrError(bool force_reload)
|
||||||
{
|
{
|
||||||
return impl_->Update(force_reload);
|
return impl_->Update(force_reload);
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
* @force_reload: 如果当前库已经加载,是否reload当前库
|
* @force_reload: 如果当前库已经加载,是否reload当前库
|
||||||
* @ status: 如果不为nullptr,返回当前加载状态
|
* @ status: 如果不为nullptr,返回当前加载状态
|
||||||
**/
|
**/
|
||||||
sled::optional<Failure> UpdateOrError(bool force_reload = true);
|
tl::optional<Failure> UpdateOrError(bool force_reload = true);
|
||||||
// bool Rollback();
|
// bool Rollback();
|
||||||
|
|
||||||
void set_userdata(void *data);
|
void set_userdata(void *data);
|
||||||
|
3641
src/sled/variant.h
3641
src/sled/variant.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user