本文整理汇总了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);