本文整理汇总了C++中collapse函数的典型用法代码示例。如果您正苦于以下问题:C++ collapse函数的具体用法?C++ collapse怎么用?C++ collapse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了collapse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DOM_DOMException
void RangeImpl::setEndAfter(const DOM_Node& refNode)
{
if( fDetached) {
throw DOM_DOMException(
DOM_DOMException::INVALID_STATE_ERR, null);
}
if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) {
throw DOM_RangeException(
DOM_RangeException::INVALID_NODE_TYPE_ERR, null);
}
fEndContainer = refNode.getParentNode();
unsigned int i = 0;
for (DOM_Node n = refNode; n!=null; n = n.getPreviousSibling(), i++) ;
if (i ==0)
fEndOffset = 0;
else
fEndOffset = i;
if ((fDocument != refNode.getOwnerDocument() )
&& (refNode.getOwnerDocument().fImpl != 0) )
{
fDocument = refNode.getOwnerDocument();
collapse(true);
}
//compare the start and end boundary point
//collapse if start point is after the end point
if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1)
collapse(false); //collapse the range positions to end
else
fCollapsed = false;
}
开发者ID:mydw,项目名称:mydw,代码行数:34,代码来源:RangeImpl.cpp
示例2: m
void MarkerWidget::contextMenuEvent( QContextMenuEvent *e )
{
QPopupMenu m( 0, "editor_breakpointsmenu" );
int toggleBreakPoint = 0;
// int editBreakpoints = 0;
QTextParagraph *p = ( (Editor*)viewManager->currentView() )->document()->firstParagraph();
int yOffset = ( (Editor*)viewManager->currentView() )->contentsY();
bool supports = ( (Editor*)viewManager->currentView() )->supportsBreakPoints();
while ( p && supports ) {
if ( e->y() >= p->rect().y() - yOffset && e->y() <= p->rect().y() + p->rect().height() - yOffset ) {
if ( ( (ParagData*)p->extraData() )->marker == ParagData::Breakpoint )
toggleBreakPoint = m.insertItem( tr( "Clear Breakpoint\tF9" ) );
else
toggleBreakPoint = m.insertItem( tr( "Set Breakpoint\tF9" ) );
// editBreakpoints = m.insertItem( tr( "Edit Breakpoints..." ) );
m.insertSeparator();
break;
}
p = p->next();
}
const int collapseAll = m.insertItem( tr( "Collapse All" ) );
const int expandAll = m.insertItem( tr( "Expand All" ) );
const int collapseFunctions = m.insertItem( tr( "Collapse all Functions" ) );
const int expandFunctions = m.insertItem( tr( "Expand all Functions" ) );
int res = m.exec( e->globalPos() );
if ( res == -1)
return;
if ( res == collapseAll ) {
emit collapse( TRUE );
} else if ( res == collapseFunctions ) {
emit collapse( FALSE );
} else if ( res == expandAll ) {
emit expand( TRUE );
} else if ( res == expandFunctions ) {
emit expand( FALSE );
} else if ( res == toggleBreakPoint ) {
if ( ( (ParagData*)p->extraData() )->marker == ParagData::Breakpoint ) {
( (ParagData*)p->extraData() )->marker = ParagData::NoMarker;
} else {
bool ok;
isBreakpointPossible( ok, ( (Editor*)viewManager->currentView() )->text(), p->paragId() );
if ( ok )
( (ParagData*)p->extraData() )->marker = ParagData::Breakpoint;
else
emit showMessage( tr( "<font color=red>Can't set breakpoint here!</font>" ) );
}
// } else if ( res == editBreakpoints ) {
// emit editBreakPoints();
}
doRepaint();
emit markersChanged();
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:57,代码来源:markerwidget.cpp
示例3: start_random_number
void start_random_number(
int seed_a,
int seed_b
){
/*
* This procedure initialises the state table u for a lagged
* Fibonacci sequence generator, filling it with random bits
* from a small multiplicative congruential sequence.
* The auxilliaries c, ni, and nj are also initialized.
* The seeds are transformed into an initial state in such a way that
* identical results are guaranteed across a wide variety of machines.
*/
double s, bit;
unsigned int ii, jj, kk, mm;
unsigned int ll;
unsigned int sd;
unsigned int elt, bit_number;
sd = collapse(seed_a, PM1 * PM1);
ii = 1 + sd / PM1;
jj = 1 + sd % PM1;
sd = collapse(seed_b, PM1 * Q);
kk = 1 + sd / PM1;
ll = sd % Q;
if (ii == 1 && jj == 1 && kk == 1) ii = 2;
ni = STATE_SIZE - 1;
nj = STATE_SIZE / 3;
c = INIT_C;
c /= RANDOM_REALS; /* compiler might mung the division itself */
cd = INIT_CD;
cd /= RANDOM_REALS;
cm = INIT_CM;
cm /= RANDOM_REALS;
for (elt = 0; elt < STATE_SIZE; elt += 1) {
s = 0.0;
bit = 1.0 / RANDOM_REALS;
for (bit_number = 0; bit_number < MANTISSA_SIZE; bit_number += 1) {
mm = (((ii * jj) % P) * kk) % P;
ii = jj;
jj = kk;
kk = mm;
ll = (53 * ll + 1) % Q;
if (((ll * mm) % 64) >= 32) s += bit;
bit += bit;
}
u[elt] = s;
}
}
开发者ID:pangtouyu,项目名称:cpp-utils,代码行数:51,代码来源:Random_Number.C
示例4: goto_normal_form
void goto_normal_form ( void )
{
TRACEIN;
bool finished = false;
int x, y, val;
while (wait_curr > waitinglist) {
assert (wait_curr >= waitinglist+2);
y = *(--wait_curr); /* pop y first, see pushing */
x = *(--wait_curr);
val = cboard[x*ydim+y];
#ifdef TRACE
if ((terminal_mode != false) && (anim_level >= 2))
printf ("We popped B[%d,%d]=%d\n", x, y, val);
#endif /* TRACE */
if (val > 3) {
collapse(x,y);
} else if (terminal_mode) {
printf ("! False positive in waitinglist: x=%d y=%d val=%d\n",
x, y, cboard[x*ydim+y]);
}
}
#ifndef NDEBUG
// FIXME: REMOVE LATER
// CHECK FOR SAFETY:
int count = 0;
do {
finished = true; /* tentatively */
for (x = xmin; x <= xmax; x++) {
for (y = xmin; y <= ymax; y++) {
if (cboard[x*ydim+y] > 3) {
finished = false;
count++;
fprintf (stdout, "! Safety check has to collapse (%d,%d) val=%d\n", x, y, cboard[x*ydim+y]);
collapse(x,y);
}
}
}
} while (finished == false);
if (count > 0) {
fprintf (stdout, "ERROR: %s: Safety check had to collapse %d times\n", __func__, count);
fprintf (stderr, "ERROR: %s: Safety check had to collapse %d times\n", __func__, count);
fail();
}
#endif /* NDEBUG */
handle_terminated_board ();
TRACEOUT;
}
开发者ID:remyGarnier,项目名称:Tas-de-sable,代码行数:50,代码来源:board.c
示例5: processChar
void processChar( char item, MyStack<Token> &stack, string &operations, bool &OK )
{
// Note:
// I could check top of stack before adding tokens
// and catch many errors "now" instead of later.
// I'd rather be lazy and let collapse() catch the errors.
Token token = toToken(item);
switch (token)
{
case TOKEN_VALUE:
if ( stack.isEmpty() ) { stack << token; return; }
switch ( stack.top() )
{
case TOKEN_LEFT_GROUP: stack << token; break;
case TOKEN_ADDITION: stack << token; break; // don't collapse yet
case TOKEN_MULTIPLICATION: collapse( stack << token, operations, OK ); break;
default: OK = false; break;
}
break;
case TOKEN_ADDITION:
collapse( stack, operations, OK);
stack << TOKEN_ADDITION;
break;
case TOKEN_MULTIPLICATION:
case TOKEN_LEFT_GROUP:
stack << token;
break;
case TOKEN_RIGHT_GROUP:
// clear any pending addidion
collapse( stack, operations, OK );
if ( !OK ) return;
// convert ( value ) to value
if ( !stack.isEmpty() && TOKEN_VALUE == stack.pop()
&& !stack.isEmpty() && TOKEN_LEFT_GROUP == stack.pop() )
stack << TOKEN_VALUE;
else
OK = false;
break;
case TOKEN_UNKNOWN:
OK = false;
break;
}
}
开发者ID:nguyenkristie,项目名称:cpp-projects,代码行数:49,代码来源:ExpressionTester.cpp
示例6: Widget
FLUIQ::CollapsibleWidget::CollapsibleWidget( Qt::Orientation _or,
Widget * _parent ) :
Widget( _parent ),
m_orientation( _or ),
m_origMinSize(),
m_origMaxSize(),
m_masterLayout( NULL )
{
if( m_orientation == Qt::Horizontal )
{
m_masterLayout = new QHBoxLayout( this );
}
else
{
m_masterLayout = new QVBoxLayout( this );
}
m_masterLayout->setMargin( 0 );
m_masterLayout->setSpacing( 0 );
setSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Expanding );
m_header = new CollapsibleWidgetHeader( this );
m_masterLayout->addWidget( m_header );
m_masterLayout->insertStretch( 100, 0 );
connect( m_header, SIGNAL( expanded() ),
this, SLOT( expand() ) );
connect( m_header, SIGNAL( collapsed() ),
this, SLOT( collapse() ) );
}
开发者ID:Orpheon,项目名称:lmms,代码行数:30,代码来源:collapsible_widget.cpp
示例7: on_toggle
void on_toggle()
{
if(is_collapsed())
expand();
else
collapse();
}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:7,代码来源:collapsible_frame.cpp
示例8: Move
bool Move(int di)
{
//std::cerr <<p_[0]<<p_[1]<< "\n";
auto tmp = p_;
if (di == 0) {
tmp[0]++;
} else if (di < 0) {
tmp[1]--;
} else {
tmp[1]++;
}
if (is_collision(vmat_, tmp, smat_)) {
if (di == 0) {
or_assign(vmat_, p_, smat_);
auto sv = get_shape(vmat_);
auto sa = get_shape(smat_);
collapse(std::min(p_[0]+sa[0], sv[0]-1), std::max(0, p_[0]));
}
return false;
}
// std::cerr << V2d(tmp) <<" not collis\n";
p_ = tmp; //std::cerr << V2d(p_) << "\n";
if (di == 0) {
td_ = time(0);
}
return true;
}
开发者ID:hyz,项目名称:cpp-snippets,代码行数:29,代码来源:multi_array_tetris.cpp
示例9: removePiece
int Game::tick()
{
if(stopped_) {
return -1;
}
removePiece(piece_, px_, py_);
int ny = py_ - 1;
if(!doesPieceFit(piece_, px_, ny)) {
// Must finish off with this piece
placePiece(piece_, px_, py_);
if(py_ >= board_height_) {
// you lose.
stopped_ = true;
return -1;
} else {
int rm = collapse();
generateNewPiece();
return rm;
}
} else {
placePiece(piece_, px_, ny);
py_ = ny;
return 0;
}
}
开发者ID:ray0sunshine,项目名称:Tetris,代码行数:27,代码来源:game.cpp
示例10: ms_links
/*
* ms_links - server message handler
*
* parv[0] = sender prefix
* parv[1] = servername mask
*
* or
*
* parv[0] = sender prefix
* parv[1] = server to query
* parv[2] = servername mask
*/
int
ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
char *mask;
struct Client *acptr;
if (parc > 2)
{
if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) !=
HUNTED_ISME)
return 0;
mask = parv[2];
}
else
mask = parc < 2 ? 0 : parv[1];
for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr))
{
if (!IsServer(acptr) && !IsMe(acptr))
continue;
if (!BadPtr(mask) && match(mask, cli_name(acptr)))
continue;
send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up),
cli_hopcount(acptr), cli_serv(acptr)->prot,
((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)"));
}
send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask);
return 0;
}
开发者ID:Niichan,项目名称:snircd,代码行数:42,代码来源:m_links.c
示例11: collapse
static void collapse(ivType *liv, object lo, int deep, object save_pointer)
{
object self = liv->iPrevious;
ivType *iv = ivPtr(self);
if (liv->iType == 2) {
if (deep || liv->iType == 1)
gDeepDispose(lo);
else
gDispose(lo);
if (!iv->iPrevious)
if (iv->iUsed == 1) {
gSetTopNode(iv->iBTree, iv->iObjects[iv->iObjects[0] == lo]);
iv->iObjects[0] = iv->iObjects[1] = NULL;
gDeepDispose(self);
} else
delete_intermediate_pointer(iv, lo);
else
if (iv->iUsed == 1) {
object save = iv->iObjects[0] == lo ? iv->iObjects[1] : iv->iObjects[0];
iv->iObjects[0] = iv->iObjects[1] = NULL;
collapse(iv, self, deep, save);
} else
delete_intermediate_pointer(iv, lo);
} else {
int idx;
for (idx=0 ; iv->iObjects[idx] != lo ; idx++);
iv->iObjects[idx] = save_pointer;
gDeepDispose(lo);
}
}
开发者ID:blakemcbride,项目名称:Dynace,代码行数:32,代码来源:BTreeNode.c
示例12: traverseLeftBoundary
/**
* Visits the nodes selected by this range when we know
* a-priori that the start and end containers are not the
* same, but the end container is an ancestor of the start container
*
*/
DOM_DocumentFragment RangeImpl::traverseCommonEndContainer( DOM_Node startAncestor, int how )
{
DOM_DocumentFragment frag = null;
if ( how!=DELETE_CONTENTS)
frag = fDocument.createDocumentFragment();
DOM_Node n = traverseLeftBoundary( startAncestor, how );
if ( frag!=null )
frag.appendChild( n );
int startIdx = indexOf( startAncestor, fEndContainer );
++startIdx; // Because we already traversed it....
int cnt = fEndOffset - startIdx;
n = startAncestor.getNextSibling();
while( cnt > 0 )
{
DOM_Node sibling = n.getNextSibling();
DOM_Node xferNode = traverseFullySelected( n, how );
if ( frag!=null )
frag.appendChild( xferNode );
--cnt;
n = sibling;
}
if ( how != CLONE_CONTENTS )
{
setStartAfter( startAncestor );
collapse( true );
}
return frag;
}
开发者ID:mydw,项目名称:mydw,代码行数:37,代码来源:RangeImpl.cpp
示例13: UT_ASSERT
bool fl_FrameLayout::doclistener_changeStrux(const PX_ChangeRecord_StruxChange * pcrxc)
{
UT_ASSERT(pcrxc->getType()==PX_ChangeRecord::PXT_ChangeStrux);
fp_FrameContainer * pFrameC = static_cast<fp_FrameContainer *>(getFirstContainer());
UT_GenericVector<fl_ContainerLayout *> AllLayouts;
AllLayouts.clear();
fp_Page * pPage = NULL;
UT_sint32 i = 0;
if(pFrameC)
{
pPage = pFrameC->getPage();
UT_return_val_if_fail(pPage, false);
pPage->getAllLayouts(AllLayouts);
for(i=0; i< AllLayouts.getItemCount();i++)
{
fl_ContainerLayout * pCL = AllLayouts.getNthItem(i);
pCL->collapse();
}
}
setAttrPropIndex(pcrxc->getIndexAP());
collapse();
lookupProperties();
format();
for(i=0; i< AllLayouts.getItemCount();i++)
{
fl_ContainerLayout * pCL = AllLayouts.getNthItem(i);
pCL->format();
xxx_UT_DEBUGMSG(("Format block %x \n",pBL));
pCL->markAllRunsDirty();
}
getDocSectionLayout()->markAllRunsDirty();
return true;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:33,代码来源:fl_FrameLayout.cpp
示例14: rmap_alloc
/*
* rmap_alloc()
* Allocate some space from a resource map
*
* Returns 0 on failure. Thus, you can't store index 0 in a resource map
*/
uint
rmap_alloc(struct rmap *rmap, uint size)
{
struct rmap *r, *rlim;
uint idx;
ASSERT_DEBUG(size > 0, "rmap_alloc: zero size");
/*
* Find first slot with a fit, return failure if we run
* off the end of the list without finding a fit.
*/
rlim = &rmap[rmap->r_off];
for (r = &rmap[1]; r <= rlim; ++r) {
if (r->r_size >= size)
break;
}
if (r > rlim) {
return(0);
}
/*
* Trim the resource element if it still has some left,
* otherwise delete from the list.
*/
idx = r->r_off;
if (r->r_size > size) {
r->r_off += size;
r->r_size -= size;
} else {
collapse(rmap, r);
}
return(idx);
}
开发者ID:JamesLinus,项目名称:vsta,代码行数:39,代码来源:rmap.c
示例15: collapse
void TreeView::CollapseWithParents(const QModelIndex &ind)
{
if(ind.isValid()){
collapse(ind);
CollapseWithParents(ind.parent());
}
}
开发者ID:karagog,项目名称:gutil,代码行数:7,代码来源:treeview.cpp
示例16: rect
void SdDurationCanvas::merge(Q3PtrList<SdDurationCanvas> & l) {
l.removeRef(this);
QRect r = rect();
int vmin = r.top();
int vmax = r.bottom();
SdDurationCanvas * d;
for (d = l.first(); d != 0; d = l.next()) {
QRect dr = d->rect();
if (dr.top() < vmin)
vmin = dr.top();
if (dr.bottom() > vmax)
vmax = dr.bottom();
collapse(d);
}
if (vmin < r.top())
Q3CanvasItem::moveBy(0, vmin - r.top());
resize(r.width(), vmax - vmin + 1);
update_self();
}
开发者ID:kralf,项目名称:bouml,代码行数:25,代码来源:SdDurationCanvas.cpp
示例17: collapse
void WPanel::undoExpand()
{
if (wasCollapsed_)
collapse();
expandedSS_.emit(false);
}
开发者ID:NovaWova,项目名称:wt,代码行数:7,代码来源:WPanel.C
示例18: flask_response_handler
/*
* flask_response_handler - Handles sending response to client and does
* necessary clean up.
*
* @param i client socket identifier
* @return 1 when successful. Simply exits when fatal error occurs.
*/
int flask_response_handler(int i)
{
int errnoSave;
int ret;
tcp_connection *curr_connection = &((engine.connections)[i]);
ret = send(i, curr_connection->response, curr_connection->response_index, MSG_NOSIGNAL);
if (ret < 1)
{
errnoSave = errno;
if (errnoSave != EPIPE && errnoSave != ECONNRESET)
{
close(i);
close(engine.udp_sock);
close(engine.tcp_sock);
collapse(&gol);
exit(EXIT_FAILURE);
}
}
init_connection(curr_connection);
FD_CLR(i, &(engine.rfds));
FD_CLR(i, &(engine.wfds));
close(i);
return 1;
}
开发者ID:hongjaic,项目名称:15-441-p2,代码行数:36,代码来源:flask_engine.c
示例19: debugList
void Machine::step()
{
// fetch the next instruction
debugList();
int opcode = IP->getOpcode();
switch(opcode) {
case OPCODE_STARTLIST:
case OPCODE_EVALUATED:
case OPCODE_NOOP:
IP++;
break;
case OPCODE_ENDLIST:
collapse();
break;
case OPCODE_PAIR:
expandPair();
break;
case OPCODE_PROCEDURE:
applySkipVector();
break;
case OPCODE_SYMBOL:
replaceSymbol();
break;
case OPCODE_ATOM:
lexCurrent();
break;
}
}
开发者ID:eeeeaaii,项目名称:rcm,代码行数:28,代码来源:Machine.cpp
示例20: m_who
/** The /who command: retrieves information from users. */
DLLFUNC int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
aChannel *target_channel;
char *mask = parv[1];
char star[] = "*";
int i = 0;
who_flags = 0;
memset(&wfl, 0, sizeof(wfl));
if (parc > 1)
{
i = parse_who_options(sptr, parc - 1, parv + 1);
if (i < 0)
{
sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
return 0;
}
}
if (parc-i < 2 || strcmp(parv[1 + i], "0") == 0)
mask = star;
else
mask = parv[1 + i];
if (!i && parc > 2 && *parv[2] == 'o')
who_flags |= WF_OPERONLY;
collapse(mask);
if (*mask == '\0')
{
/* no mask given */
sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], "*");
return 0;
}
if ((target_channel = find_channel(mask, NULL)) != NULL)
{
do_channel_who(sptr, target_channel, mask);
sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
return 0;
}
if (wfl.channel && wfl.want_channel == WHO_WANT &&
(target_channel = find_channel(wfl.channel, NULL)) != NULL)
{
do_channel_who(sptr, target_channel, mask);
sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
return 0;
}
else
{
do_other_who(sptr, mask);
sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
return 0;
}
return 0;
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:61,代码来源:m_who.c
注:本文中的collapse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论