当前位置: 首页>>代码示例>>C++>>正文


C++ MojObject::putBool方法代码示例

本文整理汇总了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);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:13,代码来源:EmailAdapter.cpp

示例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;
}
开发者ID:KyleMaas,项目名称:db8,代码行数:34,代码来源:MojDb.cpp

示例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;
	}
}
开发者ID:Garfonso,项目名称:app-services,代码行数:35,代码来源:SmtpValidator.cpp

示例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);
}
开发者ID:webOS-ports,项目名称:activitymanager,代码行数:32,代码来源:IntervalSchedule.cpp

示例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;
}
开发者ID:BigBlueHat,项目名称:db8,代码行数:35,代码来源:MojService.cpp

示例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;
}
开发者ID:edwin12345pro,项目名称:activitymanager,代码行数:33,代码来源:TestCategory.cpp

示例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;
}
开发者ID:sailesharya,项目名称:db8,代码行数:30,代码来源:MojDbIndex.cpp

示例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;
	}
开发者ID:KyleMaas,项目名称:db8,代码行数:8,代码来源:MojLunaServiceTest.cpp

示例9: replySuccess

MojErr MojServiceMessage::replySuccess(MojObject& payload)
{
	MojErr err = payload.putBool(ReturnValueKey, true);
	MojErrCheck(err);
	err = reply(payload);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:9,代码来源:MojServiceMessage.cpp

示例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;
}
开发者ID:edwin12345pro,项目名称:activitymanager,代码行数:22,代码来源:Schedule.cpp

示例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;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:13,代码来源:PopBusDispatcher.cpp

示例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;
}
开发者ID:webOS-ports,项目名称:imlibpurpleservice,代码行数:36,代码来源:ConnectionStateHandler.cpp

示例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);
}
开发者ID:Garfonso,项目名称:app-services,代码行数:16,代码来源:MojoDatabase.cpp

示例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();
}
开发者ID:azimut2000,项目名称:activitymanager,代码行数:16,代码来源:ConnectionManagerProxy.cpp

示例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;
	}
开发者ID:KyleMaas,项目名称:db8,代码行数:16,代码来源:MojLunaServiceTest.cpp


注:本文中的MojObject::putBool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。