本文整理汇总了C++中dkwmap类的典型用法代码示例。如果您正苦于以下问题:C++ dkwmap类的具体用法?C++ dkwmap怎么用?C++ dkwmap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了dkwmap类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: print_keywords
void print_keywords(FILE *pfile)
{
for (dkwmap::iterator it = dkwm.begin(); it != dkwm.end(); ++it)
{
c_token_t tt = (*it).second;
if (tt == CT_TYPE)
{
fprintf(pfile, "type %*.s%s\n",
cpd.max_option_name_len - 4, " ", (*it).first.c_str());
}
else if (tt == CT_MACRO_OPEN)
{
fprintf(pfile, "macro-open %*.s%s\n",
cpd.max_option_name_len - 11, " ", (*it).first.c_str());
}
else if (tt == CT_MACRO_CLOSE)
{
fprintf(pfile, "macro-close %*.s%s\n",
cpd.max_option_name_len - 12, " ", (*it).first.c_str());
}
else if (tt == CT_MACRO_ELSE)
{
fprintf(pfile, "macro-else %*.s%s\n",
cpd.max_option_name_len - 11, " ", (*it).first.c_str());
}
else
{
const char *tn = get_token_name(tt);
fprintf(pfile, "set %s %*.s%s\n", tn,
int(cpd.max_option_name_len - (4 + strlen(tn))), " ", (*it).first.c_str());
}
}
}
开发者ID:Harshi3030,项目名称:uncrustify,代码行数:34,代码来源:keywords.cpp
示例2: find_keyword_type
/**
* Search first the dynamic and then the static table for a matching keyword
*
* @param word Pointer to the text -- NOT zero terminated
* @param len The length of the text
* @return CT_WORD (no match) or the keyword token
*/
c_token_t find_keyword_type(const char *word, int len)
{
string ss(word, len);
chunk_tag_t key;
const chunk_tag_t *p_ret;
if (len <= 0)
{
return(CT_NONE);
}
/* check the dynamic word list first */
dkwmap::iterator it = dkwm.find(ss);
if (it != dkwm.end())
{
return((*it).second);
}
key.tag = ss.c_str();
/* check the static word list */
p_ret = (const chunk_tag_t *)bsearch(&key, keywords, ARRAY_SIZE(keywords),
sizeof(keywords[0]), kw_compare);
if (p_ret != NULL)
{
p_ret = kw_static_match(p_ret);
}
return((p_ret != NULL) ? p_ret->type : CT_WORD);
}
开发者ID:Harshi3030,项目名称:uncrustify,代码行数:36,代码来源:keywords.cpp
示例3: output_types
void output_types(FILE *pfile)
{
if (dkwm.size() > 0)
{
fprintf(pfile, "-== User Types ==-\n");
for (dkwmap::iterator it = dkwm.begin(); it != dkwm.end(); ++it)
{
fprintf(pfile, "%s\n", (*it).first.c_str());
}
}
}
开发者ID:EvilOne,项目名称:uncrustify,代码行数:11,代码来源:keywords.cpp
示例4: add_keyword
/**
* Adds a keyword to the list of dynamic keywords
*
* @param tag The tag (string) must be zero terminated
* @param type The type, usually CT_TYPE
*/
void add_keyword(const char *tag, c_token_t type)
{
string ss = tag;
/* See if the keyword has already been added */
dkwmap::iterator it = dkwm.find(ss);
if (it != dkwm.end())
{
LOG_FMT(LDYNKW, "%s: changed '%s' to %d\n", __func__, tag, type);
(*it).second = type;
return;
}
/* Insert the keyword */
dkwm.insert(dkwmap::value_type(ss, type));
LOG_FMT(LDYNKW, "%s: added '%s' as %d\n", __func__, tag, type);
}
开发者ID:Harshi3030,项目名称:uncrustify,代码行数:23,代码来源:keywords.cpp
示例5: clear_keyword_file
void clear_keyword_file(void)
{
dkwm.clear();
}
开发者ID:Harshi3030,项目名称:uncrustify,代码行数:4,代码来源:keywords.cpp
注:本文中的dkwmap类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论