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


C++ CatalogItemPtr类代码示例

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


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

示例1: Check

int QAChecker::Check(CatalogItemPtr item)
{
    int issues = 0;

    for (auto& c: m_checks)
    {
        if (item->GetString().empty() || (item->HasPlural() && item->GetPluralString().empty()))
            continue;

        if (c->CheckItem(item))
            issues++;
    }

    return issues;
}
开发者ID:vslavik,项目名称:poedit,代码行数:15,代码来源:qa_checks.cpp

示例2: Update

 void Update(const CatalogItemPtr& item) override
 {
     auto text = CommentDialog::RemoveStartHash(item->GetComment());
     text.Trim();
     m_comment->SetLanguage(m_parent->GetCurrentLanguage());
     m_comment->SetAndWrapText(text);
 }
开发者ID:BenKeyFSI,项目名称:poedit,代码行数:7,代码来源:sidebar.cpp

示例3: CheckString

    bool CheckString(CatalogItemPtr item, const wxString& source, const wxString& translation) override
    {
        if (u_isupper(source[0]) && u_islower(translation[0]))
        {
            item->SetIssue(CatalogItem::Issue::Warning, _("The translation should start as a sentence."));
            return true;
        }

        if (u_islower(source[0]) && u_isupper(translation[0]))
        {
            if (m_lang != "de")
            {
                item->SetIssue(CatalogItem::Issue::Warning, _("The translation should start with a lowercase character."));
                return true;
            }
            // else: German nouns start uppercased, this would cause too many false positives
        }

        return false;
    }
开发者ID:vslavik,项目名称:poedit,代码行数:20,代码来源:qa_checks.cpp

示例4: Update

 void Update(const CatalogItemPtr& item) override
 {
 #ifdef __WXMSW__
     auto add = _("Add comment");
     auto edit = _("Edit comment");
 #else
     auto add = _("Add Comment");
     auto edit = _("Edit Comment");
 #endif
     m_btn->SetLabel(item->HasComment() ? edit : add);
 }
开发者ID:ryoon,项目名称:poedit,代码行数:11,代码来源:sidebar.cpp

示例5: CheckItem

    bool CheckItem(CatalogItemPtr item) override
    {
        if (!item->HasPlural())
            return false;

        bool foundTranslated = false;
        bool foundEmpty = false;
        for (auto& s: item->GetTranslations())
        {
            if (s.empty())
                foundEmpty = true;
            else
                foundTranslated = true;
        }

        if (foundEmpty && foundTranslated)
        {
            item->SetIssue(CatalogItem::Issue::Warning, _("Not all plural forms are translated."));
            return true;
        }

        return false;
    }
开发者ID:vslavik,项目名称:poedit,代码行数:23,代码来源:qa_checks.cpp

示例6: QueryProvider

void SuggestionsSidebarBlock::QueryProvider(SuggestionsBackend& backend, const CatalogItemPtr& item, uint64_t queryId)
{
    m_pendingQueries++;

    // we need something to talk to GUI thread through that is guaranteed
    // to exist, and the app object is a good choice:
    auto backendPtr = &backend;
    std::weak_ptr<SuggestionsSidebarBlock> weakSelf = std::dynamic_pointer_cast<SuggestionsSidebarBlock>(shared_from_this());

    m_provider->SuggestTranslation
    (
        backend,
        m_parent->GetCurrentSourceLanguage(),
        m_parent->GetCurrentLanguage(),
        item->GetString().ToStdWstring(),

        // when receiving data
        [=](const SuggestionsList& hits){
            call_on_main_thread([weakSelf,queryId,hits]{
                auto self = weakSelf.lock();
                // maybe this call is already out of date:
                if (!self || self->m_latestQueryId != queryId)
                    return;
                self->UpdateSuggestions(hits);
                if (--self->m_pendingQueries == 0)
                    self->OnQueriesFinished();
            });
        },

        // on error:
        [=](std::exception_ptr e){
            call_on_main_thread([weakSelf,queryId,backendPtr,e]{
                auto self = weakSelf.lock();
                // maybe this call is already out of date:
                if (!self || self->m_latestQueryId != queryId)
                    return;
                self->ReportError(backendPtr, e);
                if (--self->m_pendingQueries == 0)
                    self->OnQueriesFinished();
            });
        }
    );
}
开发者ID:ryoon,项目名称:poedit,代码行数:43,代码来源:sidebar.cpp

示例7: ShouldShowForItem

 bool ShouldShowForItem(const CatalogItemPtr& item) const override
 {
     return item->HasComment();
 }
开发者ID:ryoon,项目名称:poedit,代码行数:4,代码来源:sidebar.cpp


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