本文整理汇总了C++中MojObject::putBool方法的典型用法代码示例。如果您正苦于以下问题:C++ MojObject::putBool方法的具体用法?C++ MojObject::putBool怎么用?C++ MojObject::putBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MojObject
的用法示例。
在下文中一共展示了MojObject::putBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SerializeFlags
void EmailAdapter::SerializeFlags(const Email& email, MojObject& flags)
{
MojErr err;
err = flags.putBool(Flags::READ, email.IsRead());
ErrorToException(err);
err = flags.putBool(Flags::REPLIED, email.IsReplied());
ErrorToException(err);
err = flags.putBool(Flags::FLAGGED, email.IsFlagged());
ErrorToException(err);
}
示例2: delObj
MojErr MojDb::delObj(const MojObject& id, const MojObject& obj, MojDbStorageItem* item, MojObject& foundObjOut, MojDbReq& req, MojUInt32 flags)
{
MojAssert(item);
MojLogTrace(s_log);
if (MojFlagGet(flags, FlagPurge)) {
// update indexes
MojTokenSet tokenSet;
// we want purge to force delete
req.fixmode(true);
MojErr err = m_kindEngine.update(NULL, &obj, req, OpDelete, tokenSet);
MojErrCheck(err);
// gross layering violation
err = req.txn()->offsetQuota(-(MojInt64) item->size());
MojErrCheck(err);
// permanently delete
bool found = false;
err = m_objDb->del(id, req.txn(), found);
MojErrCheck(err);
if (!found)
MojErrThrow(MojErrDbCorruptDatabase);
err = foundObjOut.put(IdKey, id);
MojErrCheck(err);
} else {
// set deleted flag and put if we are not purging
MojObject newObj = obj;
MojErr err = newObj.putBool(DelKey, true);
MojErrCheck(err);
err = putObj(id, newObj, &obj, item, req, OpDelete);
MojErrCheck(err);
foundObjOut = newObj;
}
return MojErrNone;
}
示例3: Failure
void SmtpValidator::Failure(MailError::ErrorCode errorCode, const std::string& errorText)
{
if (m_timeoutId) {
g_source_remove(m_timeoutId);
m_timeoutId = 0;
}
MojLogInfo(m_log, "SmtpValidator %p Failure1", this);
//MojLogInfo(m_log, "SmtpValidator %p Failure1, was trying to connect to %s:%d", this, m_account->GetHostname().c_str(), m_account->GetPort());
MojLogTrace(m_log);
MojObject reply;
MojErr err = reply.putBool(MojServiceMessage::ReturnValueKey, false);
ErrorToException(err);
std::string accountErrorCode = MailError::GetAccountErrorCode(errorCode);
err = reply.putString(MojServiceMessage::ErrorCodeKey, accountErrorCode.c_str());
ErrorToException(err);
err = reply.putInt("mailErrorCode", errorCode);
ErrorToException(err);
err = reply.putString("errorText", errorText.c_str());
ErrorToException(err);
if (!m_replied) {
// if we already replied due to a timeout, don't reply again.
err = m_msg->reply(reply);
ErrorToException(err);
m_replied = true;
}
}
示例4: ToJson
MojErr IntervalSchedule::ToJson(MojObject& rep, unsigned long flags) const
{
MojErr err;
if (flags & ACTIVITY_JSON_CURRENT) {
err = rep.putString(_T("nextStart"),
Scheduler::TimeToString(m_nextStart, !m_local).c_str());
MojErrCheck(err);
}
if (m_end != UNBOUNDED) {
err = rep.putString(_T("end"),
Scheduler::TimeToString(m_end, !m_local).c_str());
MojErrCheck(err);
}
if (m_skip) {
err = rep.putBool(_T("skip"), true);
MojErrCheck(err);
}
if (m_lastFinished != NEVER) {
err = rep.putString(_T("lastFinished"),
Scheduler::TimeToString(m_lastFinished, !m_local).c_str());
MojErrCheck(err);
}
err = rep.putString(_T("interval"), IntervalToString(m_interval).c_str());
MojErrCheck(err);
return Schedule::ToJson(rep, flags);
}
示例5: CallbackInfo
MojErr MojService::CategoryHandler::addMethod(const MojChar* methodName, Callback callback, bool pub, const MojChar* schemaJson)
{
MojAssert(methodName && callback);
MojString str;
MojErr err = str.assign(methodName);
MojErrCheck(err);
MojRefCountedPtr<MojSchema> schema;
if (schemaJson) {
MojObject schemaObj;
err = schemaObj.fromJson(schemaJson);
MojErrCheck(err);
// add implicit $activity property
MojObject properties;
schemaObj.get(MojSchema::PropertiesKey, properties);
MojObject activityProp;
err = activityProp.putBool(MojSchema::OptionalKey, true);
MojErrCheck(err);
err = properties.put(_T("$activity"), activityProp);
MojErrCheck(err);
err = schemaObj.put(MojSchema::PropertiesKey, properties);
MojErrCheck(err);
schema.reset(new MojSchema);
MojAllocCheck(schema.get());
err = schema->fromObject(schemaObj);
MojErrCheck(err);
}
MojAssert(!m_callbackMap.contains(str));
err = m_callbackMap.put(str, CallbackInfo(callback, schema.get(), pub));
MojErrCheck(err);
return MojErrNone;
}
示例6: runtime_error
MojErr
TestCategoryHandler::WhereMatchTest(MojServiceMessage *msg, MojObject &payload)
{
ACTIVITY_SERVICEMETHOD_BEGIN();
MojObject response;
bool found = payload.get(_T("response"), response);
if (!found) {
throw std::runtime_error("Please provide a \"response\" and a "
"\"where\" clause to test against it");
}
MojObject where;
found = payload.get(_T("where"), where);
if (!found) {
throw std::runtime_error("Please provide a \"where\" clause to test "
"the response against");
}
MojoNewWhereMatcher matcher(where);
bool matched = matcher.Match(response);
MojObject reply;
MojErr err = reply.putBool(_T("matched"), matched);
MojErrCheck(err);
err = msg->reply(reply);
MojErrCheck(err);
ACTIVITY_SERVICEMETHOD_END(msg);
return MojErrNone;
}
示例7: addBuiltinProps
MojErr MojDbIndex::addBuiltinProps()
{
LOG_TRACE("Entering function %s", __FUNCTION__);
MojString idStr;
MojErr err = idStr.assign(MojDb::IdKey);
MojErrCheck(err);
if (m_propNames.find(idStr) == MojInvalidSize) {
MojObject idProp;
err = idProp.put(NameKey, idStr);
MojErrCheck(err);
err = addProp(idProp);
MojErrCheck(err);
}
if (m_includeDeleted && m_propNames.front() != MojDb::DelKey) {
MojObject delProp;
err = delProp.putString(NameKey, MojDb::DelKey);
MojErrCheck(err);
err = delProp.putBool(DefaultKey, false);
MojErrCheck(err);
err = addProp(delProp, true);
MojErrCheck(err);
MojAssert(m_propNames.front() == MojDb::DelKey);
}
m_idIndex = m_propNames.find(idStr);
MojAssert(m_idIndex != MojInvalidSize);
m_idIndex++; // account for prefix
return MojErrNone;
}
示例8: formatEchoResponse
MojErr formatEchoResponse(const MojChar* str, MojObject& respOut)
{
MojErr err = respOut.putBool(MojServiceMessage::ReturnValueKey, true);
MojTestErrCheck(err);
err = respOut.putString(_T("echo"), str);
MojTestErrCheck(err);
return MojErrNone;
}
示例9: replySuccess
MojErr MojServiceMessage::replySuccess(MojObject& payload)
{
MojErr err = payload.putBool(ReturnValueKey, true);
MojErrCheck(err);
err = reply(payload);
MojErrCheck(err);
return MojErrNone;
}
示例10: ToJson
MojErr Schedule::ToJson(MojObject& rep, unsigned long flags) const
{
MojErr err;
if (flags & ACTIVITY_JSON_CURRENT) {
err = rep.putBool(_T("scheduled"), m_scheduled);
MojErrCheck(err);
}
if (m_local) {
err = rep.putBool(_T("local"), m_local);
MojErrCheck(err);
}
if (m_start != DAY_ONE) {
err = rep.putString(_T("start"),
Scheduler::TimeToString(m_start, !m_local).c_str());
MojErrCheck(err);
}
return MojErrNone;
}
示例11: ReplyToPing
MojErr PopBusDispatcher::ReplyToPing(MojServiceMessage* msg)
{
MojLogTrace(s_log);
MojObject reply;
MojErr err = reply.putBool(MojServiceMessage::ReturnValueKey, true);
ErrorToException(err);
err = reply.putString(_T("response"), _T("pong"));
ErrorToException(err);
err = msg->reply(reply);
ErrorToException(err);
return MojErrNone;
}
示例12: gmtime
MojErr ConnectionState::ConnectionChangedScheduler::scheduleActivity()
{
MojLogInfo(IMServiceApp::s_log, _T("com.palm.activitymanager/create \"IMLibpurple Connect Changed\""));
MojRefCountedPtr<MojServiceRequest> req;
MojErr err = m_service->createRequest(req);
if (err != MojErrNone)
{
MojLogError(IMServiceApp::s_log, _T("ConnectionChangedScheduler createRequest failed for connect debounce. error %d"), err);
}
else
{
// Schedule an activity to callback after a few seconds. The activity may already exist
MojObject activity;
const MojChar* activityJSON = _T("{\"name\":\"IMLibpurple Connect Changed\"," \
"\"description\":\"Scheduled callback to check the current connection status\"," \
"\"type\":{\"foreground\":true}}");
activity.fromJson(activityJSON);
// activity.schedule
time_t targetDate;
time(&targetDate);
targetDate += 10; // 10 seconds in the future
tm* ptm = gmtime(&targetDate);
char scheduleTime[50];
sprintf(scheduleTime, "%d-%02d-%02d %02d:%02d:%02dZ", ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
MojObject scheduleObj;
scheduleObj.putString("start", scheduleTime);
activity.put("schedule", scheduleObj);
MojObject params;
params.putBool("start", true);
params.putBool("subscribe", true);
params.put("activity", activity);
err = req->send(m_scheduleActivitySlot, "com.palm.activitymanager", "create", params, MojServiceRequest::Unlimited);
}
return err;
}
示例13: UpdateAccountInitialSync
void MojoDatabase::UpdateAccountInitialSync(Signal::SlotRef slot, const MojObject& accountId, bool sync)
{
//MojLogInfo(PopClient::s_log, "Updating account '%s' initialSynced to %d", AsJsonString(accountId).c_str(), sync);
MojObject account;
MojErr err = account.putBool(PopAccountAdapter::INITIAL_SYNC, sync);
ErrorToException(err);
MojDbQuery query;
err = query.from(PopAccountAdapter::POP_ACCOUNT_KIND);
ErrorToException(err);
err = query.where(PopAccountAdapter::ACCOUNT_ID, MojDbQuery::OpEq, accountId);
ErrorToException(err);
err = m_dbClient.merge(slot, query, account);
ErrorToException(err);
}
示例14: Enable
void ConnectionManagerProxy::Enable()
{
LOG_TRACE("Entering function %s", __FUNCTION__);
LOG_DEBUG("Enabling Connection Manager Proxy");
MojObject params;
params.putBool(_T("subscribe"), true);
m_call = boost::make_shared<MojoWeakPtrCall<ConnectionManagerProxy> >(
boost::dynamic_pointer_cast<ConnectionManagerProxy, RequirementManager>
(shared_from_this()),
&ConnectionManagerProxy::ConnectionManagerUpdate, m_service,
"luna://com.palm.connectionmanager/getstatus", params,
MojoCall::Unlimited);
m_call->Call();
}
示例15: formatErrResponse
MojErr formatErrResponse(MojErr errExpected, MojObject& objOut)
{
MojString errTxt;
MojErr err = MojErrToString(errExpected, errTxt);
MojTestErrCheck(err);
// format expected error return
err = objOut.putBool(MojServiceMessage::ReturnValueKey, false);
MojErrCheck(err);
err = objOut.putInt(MojServiceMessage::ErrorCodeKey, (MojInt64)errExpected);
MojErrCheck(err);
err = objOut.putString(MojServiceMessage::ErrorTextKey, errTxt);
MojErrCheck(err);
return MojErrNone;
}