本文整理汇总了C++中Keywords::find方法的典型用法代码示例。如果您正苦于以下问题:C++ Keywords::find方法的具体用法?C++ Keywords::find怎么用?C++ Keywords::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keywords
的用法示例。
在下文中一共展示了Keywords::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: input
void shade::FileAccumulator::add_file(const std::string& file)
{
if (file.empty())
return;
if (m_seen_files.find(file) == m_seen_files.end())
{
std::string content = m_resolver.load(file);
m_seen_files.insert(file);
typedef std::map<std::string, std::string> Keywords;
Keywords keywords;
std::istringstream input(content);
m_content += io::parse_input(input, keywords);
Keywords::const_iterator glsl_version = keywords.find("glsl_version");
if (glsl_version != keywords.end())
{
m_glsl_version = std::max(m_glsl_version, boost::lexical_cast<int>(glsl_version->second));
}
Keywords::const_iterator gpu_shader4_ext = keywords.find("GL_EXT_gpu_shader4");
if (gpu_shader4_ext != keywords.end())
{
if (gpu_shader4_ext->second == "require")
m_requires_gpu_shader4_ext = true;
}
}
}
示例2: FormatBlock
std::string FormatBlock(const ParserDefinition *pd, Keywords& keywords, const std::string &format)
{
std::stringstream ss;
std::vector<std::string> lines;
std::vector<std::string> params = keywords["$PARAM"];
std::string format_copy(format);
const char *eol = getEolStr();
// Replace keywords
stringReplace(format_copy, "[email protected]", pd->command_prefix);
stringReplace(format_copy, "$FILENAME", keywords["$FILENAME"][0]);
// $FUNCTION may not exist
if(keywords.find("$FUNCTION") != keywords.end())
stringReplace(format_copy, "$FUNCTION", keywords["$FUNCTION"][0]);
else
stringReplace(format_copy, "$FUNCTION", "");
lines = splitLines(format_copy, "\r\n");
for(unsigned int i = 0; i < lines.size(); ++i)
{
if(lines[i].find("$PARAM") != std::string::npos)
{
// Duplicate the current line for each $PARAM
std::vector<std::string> formatted_lines;
for(unsigned int j = 0; j < params.size(); ++j)
{
// Make a copy of lines[i] before calling stringReplace
std::string line = lines[i];
stringReplace(line, "$PARAM", params[j]);
formatted_lines.push_back(line);
}
// If the align flag is set, align the lines, else remove all "$|" flags
if(pd->align)
alignLines(formatted_lines);
else
for(unsigned int j = 0; j < formatted_lines.size(); ++j)
stringReplace(formatted_lines[j], "$|", "");
// Insert the lines
for(unsigned int j = 0; j < formatted_lines.size(); ++j)
{
if(i == 0 && j == 0)
ss << pd->doc_start << formatted_lines[j] << eol;
else if(i == lines.size() - 1 && j == formatted_lines.size() - 1)
ss << pd->doc_end << formatted_lines[j] << eol;
else
ss << pd->doc_line << formatted_lines[j] << eol;
}
}
else
{
if(i == 0)
ss << pd->doc_start << lines[i] << eol;
else if(i == lines.size() -1)
ss << pd->doc_end << lines[i];
else
ss << pd->doc_line << lines[i] << eol;
}
}
return ss.str();
}