本文整理汇总了C++中SyncItem::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ SyncItem::setData方法的具体用法?C++ SyncItem::setData怎么用?C++ SyncItem::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyncItem
的用法示例。
在下文中一共展示了SyncItem::setData方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: getNextNewItem
SyncItem* LOSyncSource::getNextNewItem() {
if (getUseAdd() == false) {
return NULL;
}
if (count == 2) {
return NULL;
}
StringBuffer name = getSyncItemName();
WCHAR key[256];
wsprintf(key, TEXT(WCHAR_PRINTF_STRING), name.c_str());
wcscat(key, getName());
SyncItem* item = new SyncItem(key);
if (getUseDataEncoding()) {
// just to test that the api works properly with custom encoding
item->setDataEncoding("bin");
}
char* data = getNewCard(true);
item->setData(data, (long)strlen(data));
delete [] data;
return item;
}
示例4: d
END_TEST
/**
* Removed the STATUS from the winevent parser
*/
BEGIN_TEST(WinEventNoSTATUS)
{
int ret = 0;
SyncItem* item = NULL;
WCHAR* internalKey = NULL;
wstring propValue;
WindowsSyncSource* ss = createAppointmentWindowsSyncSource();
WIN_ASSERT_NOT_NULL(ss, TEXT("The syncSource is null."));
StringBuffer VCal;
VCal.append("BEGIN:VCALENDAR\r\n");
VCal.append("VERSION:1.0\r\n");
VCal.append("BEGIN:VEVENT\r\n");
VCal.append("X-FUNAMBOL-FOLDER:DEFAULT_FOLDER\r\n");
VCal.append("X-FUNAMBOL-ALLDAY:1\r\n");
VCal.append("DTSTART:20110407\r\n");
VCal.append("DTEND:20110408\r\n");
VCal.append("X-MICROSOFT-CDO-BUSYSTATUS:FREE\r\n");
VCal.append("CATEGORIES:\r\n");
VCal.append("DESCRIPTION:\r\n");
VCal.append("LOCATION:Roma\r\n");
VCal.append("PRIORITY:1\r\n");
VCal.append("STATUS:NEED ACTION\r\n");
VCal.append("X-MICROSOFT-CDO-REPLYTIME:\r\n");
VCal.append("SUMMARY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:Da test\r\n");
VCal.append("CLASS:PUBLIC\r\n");
VCal.append("AALARM:20110406T060000Z;;0;\r\n");
VCal.append("RRULE:\r\n");
VCal.append("X-FUNAMBOL-BILLINGINFO:\r\n");
VCal.append("X-FUNAMBOL-COMPANIES:\r\n");
VCal.append("X-FUNAMBOL-MILEAGE:\r\n");
VCal.append("X-FUNAMBOL-NOAGING:0 \r\n");
VCal.append("END:VEVENT\r\n");
VCal.append("END:VCALENDAR");
item = new SyncItem(TEXT("GUID"));
item->setData(VCal.c_str(), VCal.length());
WCHAR* tt = toWideChar(VCal.c_str());
WinEvent d(tt);
printf("%S", d.toString().c_str());
// insert test item
ret = ss->addItem(*item);
WIN_ASSERT_EQUAL(ret, 201, TEXT("Adding item is not correct"));
internalKey = (WCHAR*)item->getKey();
delete item;
delete ss;
}
示例5: setModifiedItems
int setModifiedItems() {
SyncItem item;
StringBuffer val;
for (int ii = 0; ii<1; ii++){
val.append("This is the updated item one");
}
for (int i = 0; i < 4; ++i) {
switch (i) {
case 0:
item.setKey(TEXT("item5"));
item.setData(val.c_str() , (val.length())*sizeof(char));
newItems.add(item);
break;
case 1:
item.setKey(TEXT("item1"));
item.setData(val.c_str() , (val.length())*sizeof(char));
updatedItems.add(item);
break;
case 2:
item.setKey(TEXT("item3"));
item.setData(val.c_str() , (val.length())*sizeof(char));
updatedItems.add(item);
break;
case 3:
item.setKey(TEXT("item4"));
deletedItems.add(item);
break;
}
}
return 0;
}
示例6: 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;
}
示例7: setAllItems
int setAllItems() {
SyncItem item;
WCHAR name[64];
char data[128];
for (int i = 0; i < 4; ++i) {
wsprintf(name, TEXT("%s%d"), TEXT("item"), i);
sprintf(data, "This is item %d", i);
item.setKey(name);
item.setData(data , (strlen(data))*sizeof(char));
items.add(item);
}
return 0;
}
示例8: getNextNewItem
SyncItem* MappingTestSyncSource::getNextNewItem() {
if (count == 3) {
return NULL;
}
WCHAR key[256];
wsprintf(key, TEXT("%i-%lu"), count, this->getConfig().getLast());
wcscat(key, getName());
SyncItem* item = new SyncItem(key);
StringBuffer data = getNewCard();
item->setData(data, data.length());
return item;
}
示例9: getNextUpdatedItem
SyncItem* LOSyncSource::getNextUpdatedItem() {
if (getUseUpdate() == false) {
return NULL;
}
if (count == 2) {
return NULL;
}
StringBuffer name = getSyncItemName();
WCHAR key[256];
wsprintf(key, TEXT(WCHAR_PRINTF_STRING), name.c_str());
wcscat(key, getName());
SyncItem* item = new SyncItem(key);
char* data = getNewCard(false);
item->setData(data, (long)strlen(data));
delete [] data;
return item;
}
示例10: fillSyncItem
SyncItem* CacheSyncSource::fillSyncItem(StringBuffer* key) {
SyncItem* syncItem = NULL;
size_t size = 0;
void* content = NULL;
if (!key) {
return NULL;
}
LOG.debug("[%s] Filling item with key %s", getName(), key->c_str());
content = getItemContent((*key), &size);
WCHAR* wkey = toWideChar(key->c_str());
syncItem = new SyncItem(wkey);
syncItem->setData(content, size);
if (wkey) { delete [] wkey; wkey = NULL; }
if (content) { delete [] (char*)content; content = NULL; }
return syncItem;
}
示例11: createContactWindowsSyncSource
//.........这里部分代码省略.........
VCard.append(" l2Tt218vPzPYpwXs1UjLay/K9328kUI9X1HTrm8acGKWdIpIxF91VxjJH40+U3Mas1pcW062\r\n");
VCard.append(" bY5XDMj8nP0P8q0zp8ttfSK7ec4gCHcP4SOlX38LfZ7dJ4Y1+WMEn+9+FYynSi4tpJy28+nr\r\n");
VCard.append(" tp8zoVNpqMpb3afXv6f8BGRFFPE2w2tnOEjwzIOSp5/MV19hokl3psN1bOHwmJI06g0umaEl\r\n");
VCard.append(" 9BHPbRgMRtkUcV13hq2TS5mjePaH4J9az9lOp70d4vVF1a3IrxfvL0Mu0uHtliVt8ciDAY9f\r\n");
VCard.append(" xrttC1qO5QRXON386XU9Dh1C33KAGxwwrjbizu9Mnw6ttB4YV2fVuR89LR/gedy0sTdrSR6P\r\n");
VCard.append(" PolpdjeEUk98UVh+GdfLFYZzg9j60V0xrRt76szz6ixFKXKmc349zNq17HnG+7kB+gY0+Cwj\r\n");
VCard.append(" t9EWNAP3h5OKKK4cVBLAysuv6nYm44KFjMnsEGtIGwQVCn3Fbt1pccKrCrHZ5fGaKKzx0I+x\r\n");
VCard.append(" oytqmjbEzkvZ2ZmeGv8ARL+SEcrursrqySWLfwDiiiu+OlZ27E4ttVE0P0K9dJTbv8wHQ1t3\r\n");
VCard.append(" enw3MeWUc+tFFdrSaPNxPuVLx0OcvdHht2LxYUj0ooorwsVJqpodMJykk2z/2Q==\r\n");
VCard.append("\r\n");
VCard.append("X-ANNIVERSARY:20100902\r\n");
VCard.append("X-FUNAMBOL-BILLINGINFO:\r\n");
VCard.append("TEL;X-FUNAMBOL-CALLBACK:5555555555\r\n");
VCard.append("X-FUNAMBOL-CHILDREN:\r\n");
VCard.append("X-FUNAMBOL-COMPANIES:\r\n");
VCard.append("X-FUNAMBOL-FOLDER:DEFAULT_FOLDER\r\n");
VCard.append("X-FUNAMBOL-HOBBIES:\r\n");
VCard.append("EMAIL;INTERNET;HOME;X-FUNAMBOL-INSTANTMESSENGER:IMaddress\r\n");
VCard.append("X-FUNAMBOL-INITIALS:P.M.P.\r\n");
VCard.append("X-FUNAMBOL-LANGUAGES:\r\n");
VCard.append("X-MANAGER:managerName\r\n");
VCard.append("X-FUNAMBOL-MILEAGE:\r\n");
VCard.append("X-FUNAMBOL-ORGANIZATIONALID:\r\n");
VCard.append("TEL;X-FUNAMBOL-RADIO:1717171717\r\n");
VCard.append("X-SPOUSE:spuse\r\n");
VCard.append("X-FUNAMBOL-SUBJECT:Paolino Middle Paperino suffix\r\n");
VCard.append("TEL;X-FUNAMBOL-TELEX:1181818181818\r\n");
VCard.append("X-FUNAMBOL-YOMICOMPANYNAME:\r\n");
VCard.append("X-FUNAMBOL-YOMIFIRSTNAME:\r\n");
VCard.append("X-FUNAMBOL-YOMILASTNAME:\r\n");
VCard.append("END:VCARD");
item = new SyncItem(TEXT("GUID"));
item->setData(VCard.c_str(), VCard.length());
// insert test item
ret = ss->addItem(*item);
WIN_ASSERT_EQUAL(ret, 201, TEXT("Adding item is not correct"));
internalKey = (WCHAR*)item->getKey();
//
// remove work and car tel number
//
VCard.reset();
VCard.append("BEGIN:VCARD\r\n");
VCard.append("VERSION:2.1\r\n");
VCard.append("N:Paperino;Paolino;Middle;Mr.;suffix\r\n");
VCard.append("PHOTO;ENCODING=b;TYPE=JPEG:\r\n");
VCard.append(" /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQY\r\n");
VCard.append(" GBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYa\r\n");
VCard.append(" KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR\r\n");
VCard.append(" CAA2AEgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA\r\n");
VCard.append(" AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK\r\n");
VCard.append(" FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG\r\n");
VCard.append(" h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl\r\n");
VCard.append(" 5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA\r\n");
VCard.append(" AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk\r\n");
VCard.append(" NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE\r\n");
VCard.append(" hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk\r\n");
VCard.append(" 5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwCfxl4r1qy8S69Aut61bW9vqMysHmlCRxu7\r\n");
VCard.append(" BSrKeFHbsBjpivOm8d+KAQreJtdSVE8uRW1CbnGSJFGemB+tbXxIef8A4THxCDaXAjF/dees\r\n");
VCard.append(" t1tjuYhMxG0Z4xXnN9dwNAkTTJIAodFlRi6jkbAfoc14+HUuaTu3r/X9Py6n0s3FQjdJaLdW\r\n");
VCard.append(" v99vw8007pnZaf418TSW0lxceK9eUjaVRb6U9eSuN3pjmki8beKhOF/4SnWAQcfNqExAx1zg\r\n");
VCard.append(" +tcL9qMSxqc+WoABxt8zBwMep55zVyzlclwxJl+6Y2kC/MTnp3rrcZK7uYQ5FJJr+v8AhtvT\r\n");
VCard.append(" RbHoFn4z8Qmf7NL4p1tVbBybyRmLHsDngZ7VqP4p8SxHYfEOsEoNzn7bIck9FHzVx8Yit7SL\r\n");
VCard.append(" M8Ksko3nAZ93XgDqK1IyWRbi4iaNC2Y1I+82eGPevLrTle6bsfTYKEGuWpFX7WX9fgj0f4Z+\r\n");