Skip to content

Commit

Permalink
refactor: replace boost any to std any
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck authored and eagleoflqj committed Oct 24, 2023
1 parent 775f850 commit d99eaf2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/rime/deployer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <future>
#include <mutex>
#include <queue>
#include <boost/any.hpp>
#include <any>
#include <rime/common.h>
#include <rime/component.h>
#include <rime/messenger.h>
Expand All @@ -19,7 +19,7 @@ namespace rime {

class Deployer;

using TaskInitializer = boost::any;
using TaskInitializer = std::any;

class DeploymentTask : public Class<DeploymentTask, TaskInitializer> {
public:
Expand Down
4 changes: 2 additions & 2 deletions src/rime/dict/user_db_recovery_task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ void UserDbRecoveryTask::RestoreUserDataFromSnapshot(Deployer* deployer) {

UserDbRecoveryTask* UserDbRecoveryTaskComponent::Create(TaskInitializer arg) {
try {
auto db = boost::any_cast<an<Db>>(arg);
auto db = std::any_cast<an<Db>>(arg);
return new UserDbRecoveryTask(db);
} catch (const boost::bad_any_cast&) {
} catch (const std::bad_any_cast&) {
return NULL;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/rime/lever/deployment_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace rime {

DetectModifications::DetectModifications(TaskInitializer arg) {
try {
data_dirs_ = boost::any_cast<vector<string>>(arg);
} catch (const boost::bad_any_cast&) {
data_dirs_ = std::any_cast<vector<string>>(arg);
} catch (const std::bad_any_cast&) {
LOG(ERROR) << "DetectModifications: invalid arguments.";
}
}
Expand Down Expand Up @@ -254,8 +254,8 @@ bool WorkspaceUpdate::Run(Deployer* deployer) {

SchemaUpdate::SchemaUpdate(TaskInitializer arg) : verbose_(false) {
try {
schema_file_ = boost::any_cast<string>(arg);
} catch (const boost::bad_any_cast&) {
schema_file_ = std::any_cast<string>(arg);
} catch (const std::bad_any_cast&) {
LOG(ERROR) << "SchemaUpdate: invalid arguments.";
}
}
Expand Down Expand Up @@ -381,10 +381,10 @@ bool SchemaUpdate::Run(Deployer* deployer) {

ConfigFileUpdate::ConfigFileUpdate(TaskInitializer arg) {
try {
auto p = boost::any_cast<pair<string, string>>(arg);
auto p = std::any_cast<pair<string, string>>(arg);
file_name_ = p.first;
version_key_ = p.second;
} catch (const boost::bad_any_cast&) {
} catch (const std::bad_any_cast&) {
LOG(ERROR) << "ConfigFileUpdate: invalid arguments.";
}
}
Expand Down

0 comments on commit d99eaf2

Please sign in to comment.