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


C++ AttributeList::clear方法代码示例

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


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

示例1:

void
StandardIMInstance::imm_update_candidates_list (const IME_InputContext   *ic,
                                                const IME_CandidatesList *candidates)
{
    if (ic && ic->id >= 0 && candidates) {
        StandardIMInstance *inst = __global->find_instance (ic->id);
        if (inst) {
            inst->m_lookup_table.clear ();
            if (candidates->nr_candidates > 0 && candidates->candidates) {

                std::vector <WideString> labels;
                AttributeList attrs;
                WideString wstr;

                if ((candidates->page_state & IME_FIRST_PAGE) == 0)
                    inst->m_lookup_table.append_candidate ((ucs4_t) 0x20);

                for (int i = 0; i < candidates->nr_candidates; ++i) {
                    labels.push_back (inst->m_factory->convert_string (String (candidates->candidates [i].label)));

                    attrs.clear ();

                    for (int j = 0; j < candidates->candidates [i].content.nr_attributes; ++j)
                        attrs.push_back (convert_attribute (candidates->candidates [i].content.attributes [j]));

                    wstr = inst->m_factory->convert_string (String (candidates->candidates [i].content.string));
                    inst->m_lookup_table.append_candidate (wstr, attrs);
                }

                if ((candidates->page_state & IME_LAST_PAGE) == 0)
                    inst->m_lookup_table.append_candidate ((ucs4_t) 0x20);

                if ((candidates->page_state & IME_FIRST_PAGE) == 0) {
                    inst->m_lookup_table.set_page_size (1);
                    inst->m_lookup_table.page_down ();
                }

                inst->m_lookup_table.set_page_size (candidates->nr_candidates);
                inst->m_lookup_table.set_candidate_labels (labels);

                if (candidates->focused_candidate >= 0 && candidates->focused_candidate < candidates->nr_candidates)
                    inst->m_lookup_table.set_cursor_pos_in_current_page (candidates->focused_candidate);
            }

            inst->update_lookup_table (inst->m_lookup_table);
        }
    }
}
开发者ID:Linuxese,项目名称:clsi,代码行数:48,代码来源:standard_im_imengine.cpp


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