本文整理汇总了C++中Params::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Params::clear方法的具体用法?C++ Params::clear怎么用?C++ Params::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Params
的用法示例。
在下文中一共展示了Params::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseParamsItemList
void Utils::parseParamsItemList(std::string l, std::vector<Params> &res, int start_at)
{
std::vector<std::string> tokens;
split(l, tokens);
Params item;
for (unsigned int i = start_at;i < tokens.size();i++)
{
std::string tmp = tokens[i];
std::vector<std::string> tk;
split(tmp, tk, ":", 2);
if (tk.size() != 2) continue;
if (item.Exists(tk[0]))
{
res.push_back(item);
item.clear();
}
item.Add(tk[0], tk[1]);
}
if (item.size() > 0)
res.push_back(item);
}
示例2: db_default_item_list_get_cb
void AudioPlayer::db_default_item_list_get_cb(bool success, vector<string> result, void *data)
{
PlayerInfoData *user_data = reinterpret_cast<PlayerInfoData *>(data);
if (!user_data) return; //Probably leaking here !
if (result.size() < 4) return;
list<Params> infos;
Params item;
int cpt = 0;
for (uint b = 4;b < result.size();b++)
{
string tmp = result[b];
vector<string> tk;
split(tmp, tk, ":", 2);
if (tk.size() != 2) continue;
if (tk[0] == "id")
{
if (cpt > 0) infos.push_back(item);
item.clear();
cpt++;
}
item.Add(tk[0], url_decode2(tk[1]));
}
if (item.size() > 0) infos.push_back(item);
PlayerInfoList_signal sig;
sig.connect(user_data->callback_list);
sig.emit(infos);
delete user_data;
}
示例3: ScenarioCommand
//.........这里部分代码省略.........
Room *old_room = ListeRoom::Instance().getRoomByInput(scenario);
if (room != old_room)
{
if (room)
{
old_room->RemoveInputFromRoom(dynamic_cast<Input *>(scenario));
old_room->RemoveOutputFromRoom(dynamic_cast<Output *>(scenario));
room->AddInput(dynamic_cast<Input *>(scenario));
room->AddOutput(dynamic_cast<Output *>(scenario));
string sig = "modify_room ";
sig += url_encode(string("input_add:") + scenario->get_param("id")) + " ";
sig += url_encode(string("room_name:") + room->get_name()) + " ";
sig += url_encode(string("room_type:") + room->get_type());
IPC::Instance().SendEvent("events", sig);
sig = "modify_room ";
sig += url_encode(string("output_add:") + scenario->get_param("id")) + " ";
sig += url_encode(string("room_name:") + room->get_name()) + " ";
sig += url_encode(string("room_type:") + room->get_type());
IPC::Instance().SendEvent("events", sig);
}
}
if (params["cycle"] != scenario->get_param("cycle"))
{
if (params["cycle"] == "true")
scenario->getAutoScenario()->setCycling(true);
else
scenario->getAutoScenario()->setCycling(false);
}
if (params["disabled"] != scenario->get_param("disabled"))
{
if (params["disabled"] == "true")
scenario->getAutoScenario()->setDisabled(true);
else
scenario->getAutoScenario()->setDisabled(false);
}
scenario->getAutoScenario()->checkScenarioRules();
//Resave config
Config::Instance().SaveConfigIO();
Config::Instance().SaveConfigRule();
string sig = "modify_scenario id:";
sig += request["2"];
IPC::Instance().SendEvent("events", sig);
}
}
else if (request["1"] == "add_schedule")
{
cDebugDom("network") << "add_schedule";
Scenario *sc = dynamic_cast<Scenario *>(ListeRoom::Instance().get_input(request["2"]));
if (sc && sc->getAutoScenario())
{
sc->getAutoScenario()->addSchedule();
//Resave config
Config::Instance().SaveConfigIO();
Config::Instance().SaveConfigRule();
result.clear();
result.Add("0", "scenario");
result.Add("1", request["2"]);
result.Add("2", string("schedule_id:") + sc->getAutoScenario()->getIOPlage()->get_param("id"));
string sig = "modify_scenario id:";
sig += request["2"];
IPC::Instance().SendEvent("events", sig);
}
}
else if (request["1"] == "del_schedule")
{
cDebugDom("network") << "add_schedule";
Scenario *sc = dynamic_cast<Scenario *>(ListeRoom::Instance().get_input(request["2"]));
if (sc && sc->getAutoScenario())
{
sc->getAutoScenario()->deleteSchedule();
//Resave config
Config::Instance().SaveConfigIO();
Config::Instance().SaveConfigRule();
result.clear();
result.Add("0", "scenario");
result.Add("1", "ok");
string sig = "modify_scenario id:";
sig += request["2"];
IPC::Instance().SendEvent("events", sig);
}
}
ProcessDone_signal sig;
sig.connect(callback);
sig.emit(result);
}