本文整理汇总了C++中Next类的典型用法代码示例。如果您正苦于以下问题:C++ Next类的具体用法?C++ Next怎么用?C++ Next使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Next类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
if(state.eos())
{
return false;
}
char_type ch = *state.cur_;
if(traits_cast<Traits>(state).isctype(ch, this->newline_))
{
++state.cur_;
if(this->cr_ == ch && !state.eos() && this->nl_ == *state.cur_)
{
++state.cur_;
if(next.match(state))
{
return true;
}
--state.cur_;
}
else if(next.match(state))
{
return true;
}
--state.cur_;
}
return false;
}
示例2: match_
bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
{
typedef typename iterator_difference<BidiIter>::type difference_type;
BidiIter const tmp = state.cur_;
if(!detail::advance_to(state.cur_, -static_cast<difference_type>(this->width_), state.begin_))
{
state.cur_ = tmp;
return this->not_ ? next.match(state) : false;
}
// matching xpr could produce side-effects, save state
memento<BidiIter> mem = save_sub_matches(state);
if(this->not_)
{
// negative look-ahead assertions do not trigger partial matches.
save_restore<bool> partial_match(state.found_partial_match_);
detail::ignore_unused(partial_match);
if(this->xpr_.match(state))
{
restore_action_queue(mem, state);
restore_sub_matches(mem, state);
BOOST_ASSERT(state.cur_ == tmp);
return false;
}
state.cur_ = tmp;
restore_action_queue(mem, state);
if(next.match(state))
{
reclaim_sub_matches(mem, state, true);
return true;
}
reclaim_sub_matches(mem, state, false);
}
else
{
if(!this->xpr_.match(state))
{
state.cur_ = tmp;
restore_action_queue(mem, state);
reclaim_sub_matches(mem, state, false);
return false;
}
BOOST_ASSERT(state.cur_ == tmp);
restore_action_queue(mem, state);
if(next.match(state))
{
reclaim_sub_matches(mem, state, true);
return true;
}
restore_sub_matches(mem, state);
}
BOOST_ASSERT(state.cur_ == tmp);
return false;
}
示例3: match_
bool match_(match_state<BidiIter> &state, Next const &next, mpl::false_) const
{
BidiIter const tmp = state.cur_;
// matching xpr could produce side-effects, save state
memento<BidiIter> mem = save_sub_matches(state);
if(this->not_)
{
// negative look-ahead assertions do not trigger partial matches.
save_restore<bool> partial_match(state.found_partial_match_);
detail::ignore_unused(partial_match);
if(this->xpr_.match(state))
{
restore_action_queue(mem, state);
restore_sub_matches(mem, state);
state.cur_ = tmp;
return false;
}
restore_action_queue(mem, state);
if(next.match(state))
{
reclaim_sub_matches(mem, state, true);
return true;
}
reclaim_sub_matches(mem, state, false);
}
else
{
if(!this->xpr_.match(state))
{
restore_action_queue(mem, state);
reclaim_sub_matches(mem, state, false);
return false;
}
state.cur_ = tmp;
restore_action_queue(mem, state);
if(next.match(state))
{
reclaim_sub_matches(mem, state, true);
return true;
}
restore_sub_matches(mem, state);
}
BOOST_ASSERT(state.cur_ == tmp);
return false;
}
示例4: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
BOOST_ASSERT(this->mark_number_ < static_cast<int>(state.mark_count_));
sub_match_impl<BidiIter> const &br = state.sub_match(this->mark_number_);
if(!br.matched)
{
return false;
}
BidiIter const tmp = state.cur_;
for(BidiIter begin = br.first, end = br.second; begin != end; ++begin, ++state.cur_)
{
if(state.eos()
|| detail::translate(*state.cur_, traits_cast<Traits>(state), icase_type())
!= detail::translate(*begin, traits_cast<Traits>(state), icase_type()))
{
state.cur_ = tmp;
return false;
}
}
if(next.match(state))
{
return true;
}
state.cur_ = tmp;
return false;
}
示例5: match_
bool match_(match_state<BidiIter> &state, Next const &next, non_greedy_tag) const
{
BOOST_ASSERT(!this->leading_);
BidiIter const tmp = state.cur_;
unsigned int matches = 0;
for(; matches < this->min_; ++matches)
{
if(!this->xpr_.match(state))
{
state.cur_ = tmp;
return false;
}
}
do
{
if(next.match(state))
{
return true;
}
}
while(matches++ < this->max_ && this->xpr_.match(state));
state.cur_ = tmp;
return false;
}
示例6: 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);
}
示例7: search
static void search( Field &field, Next &next, int level, int lim ){
const Tumo TUMO = next.get(level);
const int LOOP = (TUMO.first==TUMO.second) ? 11 : 22; // 同色なら半分
for( int i=0; i<LOOP; ++i ){
// 1手置いた新しいフィールドの作成
Field new_field = field;
const Plan PLAN = getPlan(i);
if( setTumo( new_field, TUMO, PLAN ) == -1 ) continue;
// 初手をメモる
if( level==0 ) plan_first = PLAN;
// 発火する
InfoFire info;
fireField( new_field, info );
// 窒息確認
if( new_field.get(3,12)!=BRANK ) continue;
// フィールドを評価して過去最高ならメモ
int score = eval_field( new_field, next ); // フィールド形の評価
if( score>max_score ){
max_score = score;
plan_best = plan_first;
}
// さらなる深みへ
if( level<lim ) search( new_field, next, level+1, lim );
}
}
示例8: 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);
}
示例9: match_
bool match_(match_state<BidiIter> &state, Next const &next, mpl::true_) const
{
sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
if(this->max_ > br.repeat_count_)
{
++br.repeat_count_;
// loop back to the expression "pushed" in repeat_begin_matcher::match
if(next.top_match(state, this->back_))
{
return true;
}
else if(--br.repeat_count_ < this->min_)
{
return false;
}
}
// looping finished, continue matching the rest of the pattern
return next.skip_match(state);
}
示例10: match
static bool match(match_state<BidiIter> &state, Next const &next)
{
attr_context old_attr_context = state.attr_context_;
state.attr_context_ = *old_attr_context.prev_attr_context_;
if(next.match(state))
{
return true;
}
state.attr_context_ = old_attr_context;
return false;
}
示例11: match
bool match(match_state<BidiIter> &state, Next const &next) const
{
if(state.eos() || this->not_ == this->in_set(traits_cast<Traits>(state), *state.cur_))
{
return false;
}
if(++state.cur_, next.match(state))
{
return true;
}
return --state.cur_, false;
}
示例12: match
bool match(state_type<BidiIter> &state, Next const &next) const
{
sub_match_impl<BidiIter> &br = state.sub_match(this->mark_number_);
BidiIter old_begin = br.begin_;
br.begin_ = state.cur_;
if(next.match(state))
{
return true;
}
br.begin_ = old_begin;
return false;
}
示例13: match_next
inline bool match_next(match_state<BidiIter> &state, Next const &next, int mark_number)
{
sub_match_impl<BidiIter> &br = state.sub_match(mark_number);
bool old_matched = br.matched;
br.matched = false;
if(next.match(state))
{
return true;
}
br.matched = old_matched;
return false;
}
示例14: match
bool match(state_type<BidiIter> &state, Next const &next) const
{
if(state.eos() || !this->charset_.test(*state.cur_, traits_cast<Traits>(state), icase_type()))
{
return false;
}
++state.cur_;
if(next.match(state))
{
return true;
}
--state.cur_;
return false;
}
示例15: match
static bool match(state_type<BidiIter> &state, Next const &next)
{
if(state.eos())
{
return false;
}
++state.cur_;
if(next.match(state))
{
return true;
}
--state.cur_;
return false;
}