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


C++ SymTab::find方法代码示例

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


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

示例1: visit


//.........这里部分代码省略.........
    fdc.docsList = &(attr->docsList);
    fdc.traverse(n, preorder);

    bool inexact = false;
    bool innerFound = false;




    /* The first pass finds declarations in the AST, adds them to a
     * rudimentary symbol table and attaches any doxygen comments situated next
     * to the declaration.  The advantage of building our own symbol table
     * is that we do not need to know the exact type of overloaded functions.
     * This comes in handy when doing inexact matches (3rd pass).
     */

    /* The following loop executes exactly two times, during which inexact is first false then true. If inexact is true then matches are based on function name only. */
    do
    {
        for (list<DoxygenComment *>::iterator i = commentList.begin(); i != commentList.end(); )
        {
            DoxygenComment *comm = *i;
            if (!comm->entry.hasPrototype())
            {
                list<DoxygenComment *>::iterator ii = i;
                ++i;
                commentList.erase(ii);
                continue;
            }
            //SymTab::mapped_type *protos = &(symTab[DoxygenEntry::getProtoName(comm->entry.prototype())]);
            //AS(09/24/07) Make the lookup in the symbol table explicit
            SymTab::mapped_type *protos;

            SymTab::iterator    symTabLookup = symTab.find(DoxygenEntry::getProtoName(comm->entry.prototype()));

            if (symTabLookup != symTab.end())
                protos = &(symTabLookup->second);
            else {
                std::cout << "creating new symTab for : " << comm->originalComment->getString()
                          << " \n";
                protos = new SymTab::mapped_type();
            }



            //pair<SymTab::iterator, SymTab::iterator> bounds = symTab.equal_range(DoxygenEntry::getProtoName(comm->entry.prototype()));
            int lowestDist = INT_MAX;
            SymTab::mapped_type::iterator lowestCommentList;
            for (SymTab::mapped_type::iterator j = protos->begin(); j != protos->end(); )
            {
                string s1 = removeWhitespace(comm->entry.prototype());
                string s2 = removeWhitespace(getQualifiedPrototype((*j).first));
                //printf("s1 = \"%s\"\ns2 = \"%s\"\n", s1.c_str(), s2.c_str());
                if (inexact)
                {
                    int dist = lDistance(s1, s2);
                    if (dist < lowestDist)
                    {
                        lowestDist = dist;
                        lowestCommentList = j;
                    }
                    ++j;
                }
                else if (s1 == s2)
                {
                    (*j).second->push_back(comm);
开发者ID:rose-compiler,项目名称:rose-edg3,代码行数:67,代码来源:sageDoxygen.C


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