本文整理汇总了C++中match_state::bos方法的典型用法代码示例。如果您正苦于以下问题:C++ match_state::bos方法的具体用法?C++ match_state::bos怎么用?C++ match_state::bos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类match_state
的用法示例。
在下文中一共展示了match_state::bos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
if(state.bos())
{
if(!state.flags_.match_bol_)
{
return false;
}
}
else
{
char_type ch = *boost::prior(state.cur_);
// If the previous character is not a newline, we're not at the start of a line
if(!traits_cast<Traits>(state).isctype(ch, this->newline_))
{
return false;
}
// There is no line-break between \r and \n
else if(ch == this->cr_ && !state.eos() && *state.cur_ == this->nl_)
{
return false;
}
}
return next.match(state);
}
示例2: eval
static bool eval(bool prevword, bool thisword, match_state<BidiIter> &state)
{
if(state.flags_.match_not_bow_ && state.bos())
{
return false;
}
return !prevword && thisword;
}
示例3: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
BidiIter cur = state.cur_;
bool const thisword = !state.eos() && this->is_word(traits_cast<Traits>(state), *cur);
bool const prevword = (!state.bos() || state.flags_.match_prev_avail_)
&& this->is_word(traits_cast<Traits>(state), *--cur);
return Cond::eval(prevword, thisword, state) && next.match(state);
}
示例4: operator
bool operator ()(match_state<BidiIter> &state) const
{
if(state.bos() && state.flags_.match_bol_)
{
return true;
}
BidiIter cur = state.cur_;
BidiIter const end = state.end_;
std::advance(cur, static_cast<diff_type>(-!state.bos()));
for(; cur != end; ++cur)
{
if(this->bits_[static_cast<unsigned char>(*cur)])
{
state.cur_ = ++cur;
return true;
}
}
return false;
}
示例5: is_line_break
bool is_line_break(match_state<BidiIter> &state) const
{
BOOST_ASSERT(!state.bos() || state.flags_.match_prev_avail_);
BidiIter tmp = state.cur_;
char_type ch = *--tmp;
if(traits_cast<Traits>(state).isctype(ch, this->newline_))
{
// there is no line-break between \r and \n
if(this->cr_ != ch || state.eos() || this->nl_ != *state.cur_)
{
return true;
}
}
return false;
}