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

This commit is contained in:
tqcq 2024-06-14 12:44:44 +08:00
parent 5f299117fe
commit d1fe196bb5
10 changed files with 4701 additions and 4470 deletions

View File

@ -50,7 +50,7 @@ public:
}
private:
sled::optional<Callback> callback_;
tl::optional<Callback> callback_;
};
template<typename... Args, typename Callback>

View File

@ -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;

View File

@ -8,7 +8,7 @@
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;
Config(sled::string_view name);

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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;
}

View File

@ -143,7 +143,7 @@ private:
}
Status status_;
sled::optional<T> value_;
tl::optional<T> value_;
};
template<typename T>

View File

@ -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);

View File

@ -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);

File diff suppressed because it is too large Load Diff