本文整理汇总了C++中json::Object::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::set方法的具体用法?C++ Object::set怎么用?C++ Object::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::Object
的用法示例。
在下文中一共展示了Object::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getArchiveSettings
void getArchiveSettings(JSON::Object &obj, IDatabase *db, int clientid)
{
IQuery *q_get=db->Prepare("SELECT value FROM settings_db.settings WHERE clientid="+nconvert(clientid)+" AND key=?");
q_get->Bind("overwrite");
db_results res=q_get->Read();
q_get->Reset();
if(res.empty() || res[0][L"value"]!=L"true")
clientid=0;
q_get->Bind("overwrite_archive_settings");
res=q_get->Read();
if(res.empty() || res[0][L"value"]!=L"true")
clientid=0;
IQuery *q=db->Prepare("SELECT next_archival, interval, interval_unit, length, length_unit, backup_types FROM settings_db.automatic_archival WHERE clientid=?");
q->Bind(clientid);
res=q->Read();
JSON::Array arr;
for(size_t i=0;i<res.size();++i)
{
_i64 archive_next=watoi64(res[i][L"next_archival"]);
JSON::Object ca;
ca.set("next_archival", res[i][L"next_archival"]);
ca.set("archive_every", watoi(res[i][L"interval"]));
ca.set("archive_every_unit", res[i][L"interval_unit"]);
ca.set("archive_for", watoi(res[i][L"length"]));
ca.set("archive_for_unit", res[i][L"length_unit"]);
ca.set("archive_backup_type", ServerAutomaticArchive::getBackupType(watoi(res[i][L"backup_types"])));
ca.set("archive_window", res[i][L"archive_window"]);
if(archive_next>0 && clientid!=0)
{
_i64 tl=archive_next-(_i64)Server->getTimeSeconds();
ca.set("archive_timeleft", tl);
}
else
{
ca.set("archive_timeleft", "-");
}
arr.add(ca);
}
obj.set("archive_settings", arr);
}
示例2: getMailSettings
void getMailSettings(JSON::Object &obj, IDatabase *db)
{
std::vector<std::wstring> slist=getMailSettingsList();
IQuery *q=db->Prepare("SELECT key, value FROM settings_db.settings WHERE clientid=0 AND key=?");
for(size_t i=0;i<slist.size();++i)
{
q->Bind(slist[i]);
db_results res=q->Read();
q->Reset();
if(!res.empty())
{
obj.set(Server->ConvertToUTF8(slist[i]), res[0][L"value"]);
}
else
{
std::string v="";
if(slist[i]==L"mail_serverport")
v="25";
obj.set(Server->ConvertToUTF8(slist[i]), v);
}
}
}