本文整理汇总了C++中SyncItem::setDataType方法的典型用法代码示例。如果您正苦于以下问题:C++ SyncItem::setDataType方法的具体用法?C++ SyncItem::setDataType怎么用?C++ SyncItem::setDataType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyncItem
的用法示例。
在下文中一共展示了SyncItem::setDataType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNextDeletedItem
SyncItem* WebOsCalendarSyncSource::getNextDeletedItem()
{
LOG.info("=========== GET NEXT DELETED ITEM CALLED ==================");
if(!mGetChangesCalled)
{
getChanges();
}
std::vector<WString> result = BlockingServiceCall("getDeletedEvent",TEXT(""));
if(result.empty())
{
LOG.error("GetDeleted failed.");
}
else
{
if(result.front() != "finished")
{
SyncItem* item = new SyncItem();
item->setDataType(TEXT("text/calendar"));
//item->setData(e.second.c_str(),e.second.length()); no data for deleted items..
item->setKey(result.front().c_str());
LOG.debug("Added %s as deleted.",result.front().c_str());
return item;
}
}
return NULL;
}
示例2: getNextItem
SyncItem* WebOsCalendarSyncSource::getNextItem()
{
LOG.info("========== GET NEXT ITEM CALLED ===========");
if(mEvents.empty())
{
//no items anymore, need to get more. If that doesn't work, there are no more items.
getMoreItems();
if(mEvents.empty())
{
LOG.info("======= NO MORE ELEMENTS ==========");
return NULL;
}
}
if(!mEvents.empty())
{
//take first event and convert into item of correct type.
std::pair<WString,WString>& e = mEvents.front();
SyncItem* item = new SyncItem();
item->setDataType(TEXT("text/calendar"));
item->setData(e.second.c_str(),e.second.length());
item->setKey(e.first.c_str());
LOG.debug("Received %s from JS with key %s.",e.second.c_str(),e.first.c_str());
mEvents.pop_front();
return item;
}
else
return NULL;
}
示例3: getNextUpdatedItem
SyncItem* WebOsCalendarSyncSource::getNextUpdatedItem()
{
LOG.info("=========== GET NEXT UPDATED ITEM CALLED ==================");
if(!mGetChangesCalled)
{
getChanges();
}
if(!mEvents.empty())
{
//take first event and convert into item of correct type.
std::pair<WString,WString>& e = mEvents.front();
SyncItem* item = new SyncItem();
item->setDataType(TEXT("text/calendar"));
item->setData(e.second.c_str(),e.second.length());
item->setKey(e.first.c_str());
LOG.debug("Received %s from JS.",e.second.c_str());
mEvents.pop_front();
return item;
}
else
return NULL;
return NULL;
}
示例4: SyncItem
SyncItem *AbstractSyncSource::createSyncItem(const QUniqueId &id, bool wantData, SyncState state) const
{
//qDebug() << "AbstractSyncSource::createSyncItem(" << id.toString() << "," << wantData << "," << state << ")";
QByteArray record = m_model->record(id, m_type);
SyncItem *item = new SyncItem();
QString key = id.toString();
item->setKey(key.toAscii().data());
item->setModificationTime(m_lastSync.toTime_t());
item->setState(state);
if (wantData) {
item->setData(record.data(), record.size() - 1); // have to omit '\0'
item->setDataType(getConfig().getType());
}
//qDebug() << "AbstractSyncSource::createSyncItem()" << toString(*item);
return item;
}