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


C++ SyncItem类代码示例

本文整理汇总了C++中SyncItem的典型用法代码示例。如果您正苦于以下问题:C++ SyncItem类的具体用法?C++ SyncItem怎么用?C++ SyncItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SyncItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getChanges

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;
}
开发者ID:Garfonso,项目名称:webOsSyncML-2.0,代码行数:28,代码来源:WebOsCalendarSyncSource.cpp

示例2: getMoreItems

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;
}
开发者ID:Garfonso,项目名称:webOsSyncML-2.0,代码行数:29,代码来源:WebOsCalendarSyncSource.cpp

示例3: getSyncItemName

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;

}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:28,代码来源:LOSyncSource.cpp

示例4: addItem

int LOSyncSource::addItem(SyncItem& item) {

    WCHAR luid[128];
    wsprintf(luid, TEXT("%s-luid"), item.getKey());
    item.setKey(luid);
    return 200;
}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:7,代码来源:LOSyncSource.cpp

示例5: deleteItem

int WebOsCalendarSyncSource::deleteItem(SyncItem &item)
{
	int ret = STC_COMMAND_FAILED;
	LOG.info("deleteItem called with %s data. And Type %s.",item.getKey(),item.getDataType());

	LOG.info("Calling deleteEvent.");
	std::vector<WString> result = BlockingServiceCall("deleteEvent",item.getKey());
	if(result.empty())
	{
		LOG.error("delete event %s did not work.",item.getKey());
		ret = STC_COMMAND_FAILED;
	}
	else
	{
		LOG.error("delete event was successful, received: %s.",result[0].c_str());
		ret = STC_OK;
	}

	if (isErrorCode(ret))
	{
		report->setLastErrorCode(ERR_ITEM_ERROR);
	    report->setLastErrorMsg(ERRMSG_ITEM_ERROR);
	    report->setState(SOURCE_ERROR);
	    LOG.debug("Error deleting item: %", item.getKey());
	}

	return ret;
}
开发者ID:Garfonso,项目名称:webOsSyncML-2.0,代码行数:28,代码来源:WebOsCalendarSyncSource.cpp

示例6: BEGIN_TEST

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;
}
开发者ID:funambol-mirror,项目名称:funambol-windows-client,代码行数:57,代码来源:dataTransformerTest.cpp

示例7: updateItem

int AbstractSyncSource::updateItem(SyncItem& item)
{
    QByteArray data((char *)item.getData());
    QUniqueId id(QString((char *)item.getKey()));
    //qDebug() << "AbstractSyncSource::updateItem()" << toString(item) << "Id:" << id.toString();
    if (m_model->updateRecord(id, data, m_type))
        return 200; //ok, the SyncML command completed successfully
    else
        return 500; //failed, the recipient encountered an error
}
开发者ID:saschpe,项目名称:qtopia-pimsync,代码行数:10,代码来源:abstractsyncsource.cpp

示例8: testFillSyncItem

    void testFillSyncItem(){
        StringBuffer inFile = getTestFileFullPath(TEST_INPUT_DIR, TEST_FILE_NAME1);
        SyncItem* si = fmss->fakeFillSyncItem(&inFile, true);

        StringBuffer* data = new StringBuffer((char*)si->getData());

        CPPUNIT_ASSERT(si != NULL);
        CPPUNIT_ASSERT(data != NULL);
      
        CPPUNIT_ASSERT(data->find("body") == StringBuffer::npos);
        CPPUNIT_ASSERT(data->find("size") != StringBuffer::npos);
    }
开发者ID:fieldwind,项目名称:syncsdk,代码行数:12,代码来源:MediaSyncSourceTest.cpp

示例9: addItem

int AbstractSyncSource::addItem(SyncItem& item)
{
    QByteArray data((char *)item.getData());
    QUniqueId id = m_model->addRecord(data, QPimSource(), m_type);
    item.setKey(id.toString().toAscii().data());
    m_model->updateRecord(id, data, m_type);
    //qDebug() << "AbstractSyncSource::addItem() " << toString(item) << "Id:" << id.toString();
    if (!id.isNull())
        return 201;    //ok, the requested item was added
    else
        return 500;    //failed, the recipient encountered an error
}
开发者ID:saschpe,项目名称:qtopia-pimsync,代码行数:12,代码来源:abstractsyncsource.cpp

示例10: testAllItems

    //test te getFirstItem. We pass all the values into the properties ArrayList
    //and we get the first one
    void testAllItems() {
        ArrayList properties;
        ConfigSyncSource source(TEXT("config"), APPLICATIONURI, s);
        
        StringBuffer emailaddress("./Email/Address");
        
        properties.add(emailaddress);
        source.setConfigProperties(properties);

        Enumeration* val = source.getAllItemList();
        SyncItem* value = source.getFirstItem();
        StringBuffer valuedata((const char*)value->getData(),value->getDataSize());
        CPPUNIT_ASSERT(valuedata == VALUE);
	delete val;
	delete value;
    }
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:18,代码来源:ConfigSyncSourceUnitTest.cpp

示例11: updateItem

int TestSyncSource::updateItem(SyncItem& item) {
    char* val = toMultibyte( item.getKey() );
    LOG.info("updated item: %s", val);
    if(val){
        delete [] val;
        val = 0;
    }

    char *data = new char [item.getDataSize()];
    memcpy(data, item.getData(), item.getDataSize());
    data[item.getDataSize()] = 0;
    LOG.info("Data: %s", data);
    delete [] data;

    return 200;
}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:16,代码来源:TestSyncSource.cpp

示例12: 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;
}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:17,代码来源:TestSyncSource.cpp

示例13: LOG_CRITICAL

bool StorageHandler::startLargeObjectReplace( StoragePlugin& aPlugin,
                                              const QString& aLocalKey,
                                              const SyncItemKey& aParentKey,
                                              const QString& aType,
                                              const QString& aFormat,
                                              const QString& aVersion,
                                              qint64 aSize )
{
    FUNCTION_CALL_TRACE;

    if( iLargeObject ) {
        LOG_CRITICAL( "Already processing large object, aborting" );
        return false;
    }

    SyncItem* item = NULL;

    // If local key is empty, this Replace should be handled as Add (this is allowed by the protocol)

    if( !aLocalKey.isEmpty() ) {
        item = aPlugin.getSyncItem( aLocalKey );
    }

    if( !item ) {
        LOG_CRITICAL( "Could not find item, processing as Add" );
        return startLargeObjectAdd( aPlugin, aLocalKey, aParentKey, aType, aFormat, aVersion, aSize );
    }

    item->setParentKey( aParentKey );
    item->setType( aType );
    item->setFormat( aFormat );
    item->setVersion( aVersion );

    iLargeObject = item;
    iLargeObjectSize = aSize;
    iLargeObjectKey = aLocalKey;
    if( !iLargeObject->resize(0) )
    {
        LOG_DEBUG( "Large object created for replace couldn't be resized" );
    }

    LOG_DEBUG( "Large object created for replace" );

    return true;
}
开发者ID:kavuri,项目名称:buteo-syncml,代码行数:45,代码来源:StorageHandler.cpp

示例14: wsprintf

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;

}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:18,代码来源:MappingTestSyncSource.cpp

示例15: addItem

int CacheSyncSource::addItem(SyncItem& item) {
    int ret = insertItem(item);
    switch (ret) {        
        case 200:
        case 201:
        case 418: {
            LOG.info("[%s] Successful add of item with key %s - code %d", getName(), item.getKey(), ret);
            KeyValuePair k;
            getKeyAndSignature(item, k);
            insertInCache(k);
        }
        break;
        default:
            LOG.error("[%s] Failed add of item with key %s - code %d", getName(), item.getKey(), ret);
        break;
    }
    return ret;
}
开发者ID:ruphy,项目名称:kfunambol,代码行数:18,代码来源:CacheSyncSource.cpp


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