本文整理汇总了C++中SyncItem::setParentKey方法的典型用法代码示例。如果您正苦于以下问题:C++ SyncItem::setParentKey方法的具体用法?C++ SyncItem::setParentKey怎么用?C++ SyncItem::setParentKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyncItem
的用法示例。
在下文中一共展示了SyncItem::setParentKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceItem
bool StorageHandler::replaceItem( const ItemId& aItemId,
StoragePlugin& aPlugin,
const QString& aLocalKey,
const SyncItemKey& aParentKey,
const QString& aType,
const QString& aFormat,
const QString& aVersion,
const QString& aData )
{
FUNCTION_CALL_TRACE;
LOG_DEBUG( "Processing item for replace:" << aItemId.iCmdId <<"/" << aItemId.iItemIndex );
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_DEBUG( "Could not find item, processing as Add" );
return addItem( aItemId, aPlugin, aLocalKey, aParentKey, aType, aFormat, aVersion, aData );
}
item->setParentKey( aParentKey );
item->setType( aType );
item->setFormat( aFormat );
item->setVersion( aVersion );
if( !item->write( 0, aData.toUtf8() ) ) {
delete item;
LOG_CRITICAL( "Could not write to item" );
return false;
}
iReplaceList.insert( aItemId, item );
LOG_DEBUG( "Item queued for replace" );
return true;
}
示例2: startLargeObjectReplace
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;
}
示例3: addItem
bool StorageHandler::addItem( const ItemId& aItemId,
StoragePlugin& aPlugin,
const SyncItemKey& aLocalKey,
const SyncItemKey& aParentKey,
const QString& aType,
const QString& aFormat,
const QString& aVersion,
const QString& aData )
{
FUNCTION_CALL_TRACE;
LOG_DEBUG( "Processing item for add:" << aItemId.iCmdId <<"/" << aItemId.iItemIndex );
if( iLargeObject ) {
LOG_CRITICAL( "Already processing large object, aborting" );
return false;
}
SyncItem* newItem = aPlugin.newItem();
if( !newItem ) {
LOG_CRITICAL( "Could not create new item" );
return false;
}
//Setting empty string as we dont have any local key for it.
newItem->setKey( aLocalKey );
newItem->setParentKey( aParentKey );
newItem->setType( aType );
newItem->setFormat( aFormat );
newItem->setVersion( aVersion );
if( !newItem->write( 0, aData.toUtf8() ) ) {
delete newItem;
LOG_CRITICAL( "Could not write to item" );
return false;
}
iAddList.insert( aItemId, newItem );
LOG_DEBUG( "Item queued for addition" );
return true;
}
示例4: startLargeObjectAdd
bool StorageHandler::startLargeObjectAdd( StoragePlugin& aPlugin,
const QString& aRemoteKey,
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* newItem = aPlugin.newItem();
if( !newItem ) {
LOG_CRITICAL( "Could not create new item for large object" );
return false;
}
//Setting empty string as we dont have any local key for it.
newItem->setKey(QString());
newItem->setParentKey( aParentKey );
newItem->setType( aType );
newItem->setFormat( aFormat );
newItem->setVersion( aVersion );
iLargeObject = newItem;
iLargeObjectSize = aSize;
iLargeObjectKey = aRemoteKey;
LOG_DEBUG( "Large object created for addition" );
return true;
}