本文整理汇总了C++中Params::Exists方法的典型用法代码示例。如果您正苦于以下问题:C++ Params::Exists方法的具体用法?C++ Params::Exists怎么用?C++ Params::Exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Params
的用法示例。
在下文中一共展示了Params::Exists方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processNewMessage
void OwCtrl::processNewMessage(const string &msg)
{
json_error_t jerr;
json_t *jroot = json_loads(msg.c_str(), 0, &jerr);
if (!jroot || !json_is_array(jroot))
{
cWarningDom("1wire") << "Error parsing json from sub process: " << jerr.text;
if (jroot)
json_decref(jroot);
return;
}
int idx;
json_t *value;
json_array_foreach(jroot, idx, value)
{
Params p;
jansson_decode_object(value, p);
if (p.Exists("id"))
{
if (p.Exists("value"))
mapValues[p["id"]] = p["value"];
if (p.Exists("type"))
mapValues[p["id"]] = p["type"];
}
}
示例2: 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);
}
示例3: 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");
}
示例4: 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");
}
示例5: 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;
}
}
示例6: 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");
}
示例7: computeSunSetRise
void TimeRange::computeSunSetRise(int year, int month, int day,
int &rise_hour, int &rise_min,
int &set_hour, int &set_min)
{
if (year == cyear && month == cmonth && day == cday &&
(sunrise_hour_cache != 0 || sunrise_min_cache != 0 ||
sunset_hour_cache != 0 || sunset_min_cache != 0))
{
rise_hour = sunrise_hour_cache;
rise_min = sunrise_min_cache;
set_hour = sunset_hour_cache;
set_min = sunset_min_cache;
return;
}
double longitude;
double latitude;
Params opt;
get_config_options(opt);
if (!opt.Exists("longitude") || !opt.Exists("latitude"))
{
longitude = 2.548828;
latitude = 46.422713;
cError() << "Horaire: To use sunset/sunrise, you have to set your longitude/latitude in configuration!";
cError() << "Horaire: Please go to the webpage of the server to set these parameters.";
}
else
{
from_string(get_config_option("longitude"), longitude);
from_string(get_config_option("latitude"), latitude);
}
double rise, set;
int res;
cInfo() << "Horaire: Computing sunrise/sunset for date " <<
day << "/" << month << "/" << year;
res = sun_rise_set(year, month, day, longitude, latitude, &rise, &set);
if (res != 0)
{
rise_hour = 0;
rise_min = 0;
set_hour = 0;
set_min = 0;
cError() << "Horaire: Error in sunset/sunrise calculation!";
return;
}
long tzOffset = getTimezoneOffset();
rise_min = minutes(rise + minutes((double)tzOffset / 3600.0));
rise_hour = hours(rise + (double)tzOffset / 3600.0);
set_min = minutes(set + minutes((double)tzOffset / 3600.0));
set_hour = hours(set + (double)tzOffset / 3600.0);
std::stringstream streamrise, streamset;
streamrise << std::setfill('0') << std::setw(2) << rise_hour << ":" << rise_min;
streamset << std::setfill('0') << std::setw(2) << set_hour << ":" << set_min;
cInfo() << "Horaire: sunrise is at " << streamrise.str() << " and sunset is at " <<
streamset.str();
sunrise_hour_cache = rise_hour;
sunrise_min_cache = rise_min;
sunset_hour_cache = set_hour;
sunset_min_cache = set_min;
cyear = year;
cmonth = month;
cday = day;
}