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


C++ ArtworkMetadata::appendKeywords方法代码示例

本文整理汇总了C++中models::ArtworkMetadata::appendKeywords方法的典型用法代码示例。如果您正苦于以下问题:C++ ArtworkMetadata::appendKeywords方法的具体用法?C++ ArtworkMetadata::appendKeywords怎么用?C++ ArtworkMetadata::appendKeywords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models::ArtworkMetadata的用法示例。


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

示例1: modifyArtworksItem

std::shared_ptr<Commands::ICommandResult> Commands::PasteKeywordsCommand::execute(const ICommandManager *commandManagerInterface) const {
    LOG_INFO << "Pasting" << m_KeywordsList.length() << "keywords to" << m_MetadataElements.size() << "item(s)";

    CommandManager *commandManager = (CommandManager*)commandManagerInterface;

    QVector<int> indicesToUpdate;
    std::vector<UndoRedo::ArtworkMetadataBackup> artworksBackups;
    QVector<Models::ArtworkMetadata*> itemsToSave;
    size_t size = m_MetadataElements.size();
    indicesToUpdate.reserve((int)size);
    artworksBackups.reserve(size);
    itemsToSave.reserve((int)size);

    for (size_t i = 0; i < size; ++i) {
        const Models::MetadataElement &element = m_MetadataElements.at(i);
        Models::ArtworkMetadata *metadata = element.getOrigin();

        indicesToUpdate.append(element.getOriginalIndex());
        artworksBackups.emplace_back(metadata);

        metadata->appendKeywords(m_KeywordsList);
        itemsToSave.append(metadata);
    }

    if (size > 0) {
        commandManager->submitForSpellCheck(itemsToSave);
        commandManager->submitForWarningsCheck(itemsToSave);
        commandManager->saveArtworksBackups(itemsToSave);

        std::unique_ptr<UndoRedo::IHistoryItem> modifyArtworksItem(new UndoRedo::ModifyArtworksHistoryItem(artworksBackups, indicesToUpdate,
                                                                                                           UndoRedo::PasteModificationType));
        commandManager->recordHistoryItem(modifyArtworksItem);
    } else {
        LOG_WARNING << "Pasted zero real words!";
    }

    std::shared_ptr<PasteKeywordsCommandResult> result(new PasteKeywordsCommandResult(indicesToUpdate));
    return result;
}
开发者ID:RostaTasha,项目名称:xpiks,代码行数:39,代码来源:pastekeywordscommand.cpp


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