本文整理汇总了C++中state::has_empty_line方法的典型用法代码示例。如果您正苦于以下问题:C++ state::has_empty_line方法的具体用法?C++ state::has_empty_line怎么用?C++ state::has_empty_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类state
的用法示例。
在下文中一共展示了state::has_empty_line方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: log_line
/** \brief Parse one line of log.
*
* This function reads one line of log. Note that one line of log may appear
* on multiple lines in the changelog file. One line ends when there is an
* empty line, a line that does not start with at least 2 spaces, a line
* that starts with an asterisk after the 2 spaces.
*
* \param[in] s The state describing the input parameters.
* \param[in] group Whether this log is a group entry.
*
* \return true if the end of the file was not yet reached.
*/
bool changelog_file::version::log::parse(state& s, bool& group)
{
f_filename = s.get_filename();
f_line = s.get_line();
f_is_group = group;
group = false;
if(s.space_count() != 2)
{
// invalid log entry; must start with 2 spaces
return false;
}
std::string log_line(s.last_line());
if(log_line[0] != '*')
{
// a new log entry must starts with an asterisk
wpkg_output::log("changelog:%1:%2: a changelog log entry must start with an asterisk")
.arg(f_filename)
.arg(f_line)
.level(wpkg_output::level_error)
.module(wpkg_output::module_build_package)
.action("changelog");
return false;
}
for(;;)
{
// right trim the f_log (it automatically is left trimmed)
std::string::size_type p(f_log.find_last_not_of(" \t\n\r\v\f"));
if(p != std::string::npos)
{
f_log = f_log.substr(0, p + 1);
}
// check whether there is more data that should be added to the log
// line; if not, leave it there and return, it should be an empty line
// a new log, or the maintainer information.
if(!s.next_line())
{
break;
}
if(s.has_empty_line())
{
// we bumped in an empty line, we are starting a new group.
group = true;
break;
}
// really we should have exactly 4 spaces...
if(s.space_count() < 2)
{
break;
}
std::string new_line(s.last_line());
if(new_line[0] == '*')
{
break;
}
f_log += " ";
f_log += new_line;
}
f_log = log_line;
// TODO: find the bugs stuff
return true;
}