本文整理汇总了C++中Params::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Params::Add方法的具体用法?C++ Params::Add怎么用?C++ Params::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Params
的用法示例。
在下文中一共展示了Params::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendJson
void JsonApiHandlerHttp::sendJson(const Json &json)
{
string data = json.dump();
Params headers;
headers.Add("Connection", "Close");
headers.Add("Cache-Control", "no-cache, must-revalidate");
headers.Add("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
headers.Add("Content-Type", "application/json");
headers.Add("Content-Length", Utils::to_string(data.size()));
string res = httpClient->buildHttpResponse(HTTP_200, headers, data);
sendData.emit(res);
}
示例2: browserShowPlaylistTracks
void ActivityAudioListView::browserShowPlaylistTracks(Params &infos, Params pl_infos)
{
if (!infos.Exists("count")) return;
EmitSignal("browser,loading,stop", "calaos");
cDebug() << "RESULT infos: " << pl_infos.toString();
pl_infos.Add("count", infos["count"]);
int count;
from_string(infos["count"], count);
int pl_id;
from_string(pl_infos["id"], pl_id);
CREATE_GENLIST_HELPER(glist);
GenlistItemPlaylistHeader *header = new GenlistItemPlaylistHeader(evas, parent, player_current->getPlayer(), pl_infos, pl_id);
header->Append(glist);
for (int i = 0;i < count;i++)
{
GenlistItemTrack *item = new GenlistItemTrack(evas, parent, player_current->getPlayer(), i, GenlistItemTrack::TRACK_PLAYLIST, pl_id);
item->Append(glist);
}
elm_naviframe_item_push(pager_browser, NULL, NULL, NULL, glist, "calaos");
}
示例3: browserShowYearAlbum
void ActivityAudioListView::browserShowYearAlbum(Params &infos, Params year_infos)
{
if (!infos.Exists("count")) return;
EmitSignal("browser,loading,stop", "calaos");
cDebug() << "RESULT infos: " << year_infos.toString();
year_infos.Add("count", infos["count"]);
int count;
from_string(infos["count"], count);
int year_id;
from_string(year_infos["year"], year_id);
CREATE_GENLIST_HELPER(glist);
for (int i = 0;i < count;i++)
{
GenlistItemAlbum *item = new GenlistItemAlbum(evas, parent, player_current->getPlayer(), i, GenlistItemAlbum::ALBUM_YEAR, year_id);
item->Append(glist);
item->setUserData(item);
item->item_selected.connect(sigc::mem_fun(*this, &ActivityAudioListView::albumSelected));
}
elm_naviframe_item_push(pager_browser, NULL, NULL, NULL, glist, "calaos");
}
示例4: db_album_track_count_get_cb
void AudioPlayer::db_album_track_count_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() < 5) return;
Params infos;
for (uint b = 4;b < result.size();b++)
{
vector<string> tmp;
Utils::split(result[b], tmp, ":", 2);
if (tmp.size() < 2) continue;
if (tmp[0] == "count")
{
infos.Add(tmp[0], tmp[1]);
break;
}
}
PlayerInfo_signal sig;
sig.connect(user_data->callback);
sig.emit(infos);
delete user_data;
}
示例5: 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);
}
示例6: get_config_options
bool Utils::get_config_options(Params &options)
{
TiXmlDocument document(getConfigFile(LOCAL_CONFIG).c_str());
if (!document.LoadFile())
{
cError() << "There was an exception in XML parsing.";
cError() << "Parse error: " << document.ErrorDesc();
cError() << "In file " << getConfigFile(LOCAL_CONFIG) << " At line " << document.ErrorRow();
return false;
}
TiXmlHandle docHandle(&document);
TiXmlElement *key_node = docHandle.FirstChildElement("calaos:config").FirstChildElement().ToElement();
if (key_node)
{
for(; key_node; key_node = key_node->NextSiblingElement())
{
if (key_node->ValueStr() == "calaos:option" &&
key_node->Attribute("name") &&
key_node->Attribute("value"))
{
options.Add(key_node->Attribute("name"), key_node->Attribute("value"));
}
}
}
return true;
}
示例7: sendJson
void JsonApiHandlerHttp::sendJson(json_t *json)
{
char *d = json_dumps(json, JSON_COMPACT | JSON_ENSURE_ASCII /*| JSON_ESCAPE_SLASH*/);
if (!d)
{
json_decref(json);
cDebugDom("network") << "json_dumps failed!";
Params headers;
headers.Add("Connection", "close");
headers.Add("Content-Type", "text/html");
string res = httpClient->buildHttpResponse(HTTP_500, headers, HTTP_500_BODY);
sendData.emit(res);
closeConnection.emit(0, string());
return;
}
json_decref(json);
string data(d);
free(d);
Params headers;
headers.Add("Connection", "Close");
headers.Add("Cache-Control", "no-cache, must-revalidate");
headers.Add("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
headers.Add("Content-Type", "application/json");
headers.Add("Content-Length", Utils::to_string(data.size()));
string res = httpClient->buildHttpResponse(HTTP_200, headers, data);
sendData.emit(res);
}
示例8: on_buttonBox_accepted
void DialogNewAudio::on_buttonBox_accepted()
{
if (ui->edit_name->text().isEmpty())
{
ui->label_error_empty->show();
return;
}
Params p;
p.Add("name", ui->edit_name->text().toUtf8().constData());
p.Add("host", ui->edit_ip->text().toUtf8().constData());
p.Add("id", ui->edit_mac->text().toUtf8().constData());
p.Add("type", "slim");
output = ListeRoom::Instance().createAudio(p, room);
accept();
}
示例9: on_buttonBox_accepted
void DialogNewAVReceiver::on_buttonBox_accepted()
{
if (ui->lineEditName->text().isEmpty())
{
ui->labelError->show();
return;
}
Params p;
p.Add("name", ui->lineEditName->text().toUtf8().constData());
p.Add("model", ui->comboBoxType->itemData(ui->comboBoxType->currentIndex()).toString().toUtf8().constData());
p.Add("host", ui->lineEditHost->text().toUtf8().constData());
p.Add("visible", "true");
p.Add("type", "AVReceiver");
output = ListeRoom::Instance().createOutput(p, room);
accept();
}
示例10: on_buttonBox_accepted
void DialogNewScenario::on_buttonBox_accepted()
{
if (ui->edit_name->text().isEmpty())
{
ui->label_error_empty->show();
return;
}
Params p;
p.Add("name", ui->edit_name->text().toUtf8().constData());
p.Add("type", "scenario");
if (ui->checkBox_visible->isChecked())
p.Add("visible", "true");
else
p.Add("visible", "false");
IOBase *in = ListeRoom::Instance().createInput(p, room);
output = in;
accept();
}
示例11: executableDone
void AudioModel::executableDone(Ecore_Exe_Event_Del *event)
{
if (!event) return;
PlayerInfoData *data = reinterpret_cast<PlayerInfoData *>(ecore_exe_data_get(event->exe));
if (!data) return;
if (data->thumb_exe != event->exe) return;
PlayerInfo_signal sig;
sig.connect(data->callback);
Params p;
p.Add("filename", data->cover_fname);
sig.emit(p);
delete data;
}
示例12: getDBAlbumCoverItem
void AudioPlayer::getDBAlbumCoverItem(Params &item, PlayerInfo_cb callback, int size)
{
if (!item.Exists("cover_url")) return;
string fname = Utils::getCacheFile(".cover_cache/album_") + item["cover_id"];
string cmdsize;
switch (size)
{
default:
case AUDIO_COVER_SIZE_SMALL: cmdsize = "40x40"; fname += "_small.jpg"; break;
case AUDIO_COVER_SIZE_MEDIUM: cmdsize = "100x100"; fname += "_medium.jpg"; break;
case AUDIO_COVER_SIZE_BIG: cmdsize = "250x250"; fname += "_big.jpg"; break;
}
if (ecore_file_exists(fname.c_str()))
{
PlayerInfo_signal sig;
sig.connect(callback);
Params p;
p.Add("filename", fname);
sig.emit(p);
return;
}
PlayerInfoData *data = new PlayerInfoData();
data->cover_fname = fname;
data->callback = callback;
data->item = item;
string cmd;
cmd = Prefix::Instance().binDirectoryGet();
cmd += "calaos_thumb " + item["cover_url"] + " " + fname + " " + cmdsize;
data->thumb_exe = ecore_exe_run(cmd.c_str(), data);
if (!data->thumb_exe)
{
PlayerInfo_signal sig;
sig.connect(callback);
Params p;
sig.emit(p);
delete data;
}
}
示例13: cover_cb
void AudioPlayer::cover_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() < 3) return;
Params infos;
vector<string> tmp;
Utils::split(result[2], tmp, ":", 2);
if (tmp.size() < 2) return;
infos.Add("cover", tmp[1]);
PlayerInfo_signal sig;
sig.connect(user_data->callback);
sig.emit(infos);
delete user_data;
}
示例14: browserShowAlbumTracks
void ActivityAudioListView::browserShowAlbumTracks(Params &infos, int album_id, Params album_infos)
{
if (!infos.Exists("count")) return;
EmitSignal("browser,loading,stop", "calaos");
album_infos.Add("count", infos["count"]);
int count;
from_string(infos["count"], count);
CREATE_GENLIST_HELPER(glist);
GenlistItemAlbumHeader *header = new GenlistItemAlbumHeader(evas, parent, player_current->getPlayer(), album_infos, album_id);
header->Append(glist);
for (int i = 0;i < count;i++)
{
GenlistItemTrack *item = new GenlistItemTrack(evas, parent, player_current->getPlayer(), i, GenlistItemTrack::TRACK_ALBUM, album_id);
item->Append(glist, NULL);
}
elm_naviframe_item_push(pager_browser, NULL, NULL, NULL, glist, "calaos");
}
示例15: 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;
}