本文整理汇总了C++中Sequence::append方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::append方法的具体用法?C++ Sequence::append怎么用?C++ Sequence::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: multi_comprehension_filtered_loop_next
static bool multi_comprehension_filtered_loop_next( VMachine* vm )
{
Sequence* self = dyncast<Sequence*>(vm->local(1)->asGCPointer());
Item& regA = vm->regA();
// do the last operation was an oob?
if( regA.isOob() )
{
// is it an integer?
if( regA.isInteger() )
{
// Request to stop?
if ( regA.asInteger() == 0 )
{
vm->retval( vm->self() );
return false;
}
else if ( regA.asInteger() != 1 )
{
self->append( vm->regA() );
}
}
else
self->append( vm->regA() );
}
else
self->append( vm->regA().isString() ? new CoreString( *vm->regA().asString() ) : vm->regA() );
return multi_comprehension_filtered_loop( vm );
}
示例2: Sequence
/** Build a contig from a branch. */
BranchRecord::operator Sequence() const
{
assert(!m_data.empty());
Sequence outseq;
outseq.reserve(m_data.front().first.length() + m_data.size() - 1);
if (m_dir == SENSE) {
BranchData::const_iterator iter = m_data.begin();
outseq = iter->first.str();
++iter;
for (; iter != m_data.end(); ++iter)
outseq.append(1, iter->first.getLastBaseChar());
} else {
BranchData::const_reverse_iterator iter = m_data.rbegin();
outseq = iter->first.str();
++iter;
for (; iter != m_data.rend(); ++iter)
outseq.append(1, iter->first.getLastBaseChar());
}
return outseq;
}
示例3: reverse
Sequence* WordAlphabet::reverse(const Sequence& sequence) const throw (AlphabetMismatchException, Exception)
{
if ((!hasUniqueAlphabet()) or
(sequence.getAlphabet()->getAlphabetType() != getAlphabetType()))
throw AlphabetMismatchException("No matching alphabets");
Sequence* pseq = new BasicSequence(sequence.getName(), "", getNAlphabet(0));
size_t s = sequence.size();
for (size_t i = 0; i < s; i++)
{
pseq->append(getPositions(sequence[i]));
}
return pseq;
}
示例4: multi_comprehension_generate_all
static void multi_comprehension_generate_all( VMachine* vm )
{
uint32 ssize = vm->currentFrame()->stackSize()-4;
Sequence* self = dyncast<Sequence*>(vm->local(1)->asGCPointer());
while( true )
{
// create the object to be added.
CoreArray* cret = new CoreArray( ssize );
for( uint32 elem = 0; elem < ssize; ++elem )
{
Iterator* seq = dyncast<Iterator*>(vm->local(elem+3)->asGCPointer());
if( ! seq->hasCurrent() )
return;
cret->append( seq->getCurrent().isString() ? new CoreString( *seq->getCurrent().asString() ) : seq->getCurrent() );
}
// append it
self->append( cret );
// advance
uint32 pos = ssize;
while( pos > 0 )
{
Iterator* seq = dyncast<Iterator*>(vm->local(pos-1+3)->asGCPointer());
// can we advance?
if( seq->next() )
break;
//--- no? reset this element,
seq->goTop();
//--- and advance the previous element.
--pos;
}
// did we reset the topmost element?
if ( pos == 0)
break;
}
vm->retval( vm->self() );
}
示例5: comp_get_all_items
// gets all the items that it can from a comprehension
static bool comp_get_all_items( VMachine *vm, const Item& cmp )
{
Sequence* sequence = dyncast<Sequence*>(vm->local(1)->asGCPointer());
if ( cmp.isRange() )
{
if ( cmp.asRangeIsOpen() )
{
throw new ParamError( ErrorParam( e_param_range, __LINE__ )
.origin( e_orig_runtime )
.extra( "open range" ) );
}
int64 start = cmp.asRangeStart();
int64 end = cmp.asRangeEnd();
int64 step = cmp.asRangeStep();
if ( start == end )
{
if ( step < 0 )
{
sequence->append( start );
}
return false; // all done.
}
if( start < end )
{
if ( step < 0 )
return true;
if ( step == 0 )
step = 1;
while( start < end )
{
sequence->append( start );
start += step;
}
}
else {
if ( step > 0 )
return false;
if ( step == 0 )
step = -1;
while( start >= end )
{
sequence->append( start );
start += step;
}
}
}
else if ( cmp.isCallable() )
{
// change the frame handler, so that instead of having
vm->returnHandler( comp_get_all_items_callable_next );
vm->callFrame( cmp, 0 );
// need more calls.
return true;
}
else if ( cmp.isArray() )
{
const CoreArray& arr = *cmp.asArray();
for( uint32 i = 0; i < arr.length(); i ++ )
{
sequence->append( arr[i].isString() ? new CoreString( *arr[i].asString() ) : arr[i] );
}
}
else if ( (cmp.isObject() && cmp.asObjectSafe()->getSequence() ) )
{
Sequence* origseq = cmp.asObjectSafe()->getSequence();
Iterator iter( origseq );
while( iter.hasCurrent() )
{
sequence->append( iter.getCurrent().isString() ? new CoreString( *iter.getCurrent().asString() ) : iter.getCurrent() );
iter.next();
}
}
else {
throw new ParamError( ErrorParam( e_inv_params, __LINE__ )
.origin( e_orig_runtime )
.extra( "A|C|R|Sequence, [C]" ) );
}
// we have processed all the sequence.
vm->retval( vm->self() );
return false;
}