当前位置: 首页>>代码示例>>C++>>正文


C++ Q3PtrList::count方法代码示例

本文整理汇总了C++中Q3PtrList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrList::count方法的具体用法?C++ Q3PtrList::count怎么用?C++ Q3PtrList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q3PtrList的用法示例。


在下文中一共展示了Q3PtrList::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: send

void SubjectCanvas::send(ToolCom * com, Q3CanvasItemList & all)
{
  Q3PtrList<SubjectCanvas> subjects;
  Q3CanvasItemList::Iterator cit;

  for (cit = all.begin(); cit != all.end(); ++cit) {
    DiagramItem *di = QCanvasItemToDiagramItem(*cit);
    
    if ((di != 0) && 
	(*cit)->visible() &&
	(di->type() == UmlSubject))
      subjects.append((SubjectCanvas *) di);
  }
  
  com->write_unsigned(subjects.count());
  
  SubjectCanvas * sc;
  
  for (sc = subjects.first(); sc != 0; sc = subjects.next()) {
    Q3CString s = fromUnicode(sc->name);
    
    com->write_string((const char *) s);
    com->write(sc->rect());
  }
}
开发者ID:SciBoy,项目名称:douml,代码行数:25,代码来源:SubjectCanvas.cpp

示例2: slotCursorLeft

// -----------------------------------------------------------
void QucsApp::slotCursorLeft(bool left)
{
  int sign = 1;
  if(left){
    sign = -1;
  }
  if(!editText->isHidden()) return;  // for edit of component property ?

  Q3PtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) {
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerLeftRight(left, &movingElements);
    } else if(left) {
      if(Doc->scrollLeft(Doc->horizontalScrollBar()->singleStep()))
        Doc->scrollBy(-Doc->horizontalScrollBar()->singleStep(), 0);
    }else{ // right
      if(Doc->scrollRight(-Doc->horizontalScrollBar()->singleStep()))
        Doc->scrollBy(Doc->horizontalScrollBar()->singleStep(), 0);
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  } else { // random selection. move all of them
    view->moveElements(&movingElements, sign*Doc->GridX, 0);
    view->MAx3 = 1;  // sign for moved elements
    view->endElementMoving(Doc, &movingElements);
  }
}
开发者ID:Qucs,项目名称:qucs,代码行数:33,代码来源:qucs_actions.cpp

示例3: slotCursorRight

// -----------------------------------------------------------
void QucsApp::slotCursorRight()
{
  if(!editText->isHidden()) return;  // for edit of component property ?

  Q3PtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentPage();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) {
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerLeftRight(false, &movingElements);
      movingElements.clear();
    }
    else {
      if(Doc->scrollRight(-Doc->horizontalScrollBar()->lineStep()))
        Doc->scrollBy(Doc->horizontalScrollBar()->lineStep(), 0);
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  }

  view->moveElements(&movingElements, Doc->GridX, 0);  // move "GridX" to right
  view->MAx3 = 1;  // sign for moved elements
  view->endElementMoving(Doc, &movingElements);
}
开发者ID:ClemensFMN,项目名称:qucs,代码行数:28,代码来源:qucs_actions.cpp

示例4: pop

void RuleStack::pop( Q3PtrList<KScoringRule> &l )
{
  top( l );
  drop();
  kDebug(5100) <<"RuleStack::pop pops list with" << l.count() <<" rules";
  kDebug(5100) <<"now there are" << stack.count() <<" lists on the stack";
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:7,代码来源:kscoring.cpp

示例5: push

void RuleStack::push( Q3PtrList<KScoringRule> &l )
{
  kDebug(5100) <<"RuleStack::push pushing list with" << l.count() <<" rules";
  KScoringManager::ScoringRuleList *l1 = new KScoringManager::ScoringRuleList;
  for ( KScoringRule *r=l.first(); r != 0; r=l.next() ) {
    l1->append( new KScoringRule( *r ) );
  }
  stack.push( l1 );
  kDebug(5100) <<"now there are" << stack.count() <<" lists on the stack";
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:10,代码来源:kscoring.cpp

示例6: QCOMPARE

void tst_Q3PtrList::replace()
{
    Q3PtrList<int> list;
    int foo = 4;
    list.setAutoDelete( TRUE );
    QCOMPARE( list.insert(0, new int(1)), (bool)TRUE );
    QCOMPARE( list.insert(1, new int(2)), (bool)TRUE );
    QCOMPARE( list.insert(2, new int(4)), (bool)TRUE );

    QCOMPARE( *(list.at(2)), 4 );
    QCOMPARE( list.replace(2, new int(3)), (bool)TRUE );
    QCOMPARE( *(list.at(2)), 3 );
    uint count = list.count();
    QCOMPARE( list.replace(3, &foo), (bool)FALSE );
    QCOMPARE( list.count(), count );

    int *p = new int(7);
    QCOMPARE( list.insert(2, p), (bool)TRUE );
    QCOMPARE( list.replace(2, p), (bool)TRUE );
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:20,代码来源:tst_q3ptrlist.cpp

示例7: getSINWAV

Indicator * SINWAV::calculate ()
{
  Indicator *output = new Indicator;
  output->setDateFlag(dateFlag);
  output->setLogScale(logScale);

  Q3PtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getSINWAV(pll);

  int loop;
  for (loop = 0; loop < (int) pll.count(); loop++)
    output->addLine(pll.at(loop));

  return output;
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:16,代码来源:SINWAV.cpp

示例8: slotCursorDown

// -----------------------------------------------------------
void QucsApp::slotCursorDown()
{
  if(!editText->isHidden()) {  // for edit of component property ?
    if(view->MAx3 == 0) return;  // edit component namen ?
    Component *pc = (Component*)view->focusElement;
    Property *pp = pc->Props.at(view->MAx3-1);  // current property
    int Pos = pp->Description.find('[');
    if(Pos < 0) return;  // no selection list ?
    Pos = pp->Description.find(editText->text(), Pos); // current list item
    if(Pos < 0) return;  // should never happen
    Pos = pp->Description.find(',', Pos);
    if(Pos < 0) return;  // was last item ?
    Pos++;
    if(pp->Description.at(Pos) == ' ') Pos++; // remove leading space
    int End = pp->Description.find(',', Pos);
    if(End < 0) {  // is last item ?
      End = pp->Description.find(']', Pos);
      if(End < 0) return;  // should never happen
    }
    editText->setText(pp->Description.mid(Pos, End-Pos));
    editText->selectAll();
    return;
  }

  Q3PtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentPage();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) {
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerUpDown(false, &movingElements);
      movingElements.clear();
    }
    else {
      if(Doc->scrollDown(-Doc->verticalScrollBar()->lineStep()))
        Doc->scrollBy(0, Doc->verticalScrollBar()->lineStep());
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  }

  view->moveElements(&movingElements, 0, Doc->GridY);  // move "GridY" down
  view->MAx3 = 1;  // sign for moved elements
  view->endElementMoving(Doc, &movingElements);
}
开发者ID:ClemensFMN,项目名称:qucs,代码行数:48,代码来源:qucs_actions.cpp

示例9: send

void CodClassInstCanvas::send(ToolCom * com, Q3CanvasItemList & all)
{
  Q3PtrList<CodClassInstCanvas> l;
  Q3CanvasItemList::Iterator cit;

  for (cit = all.begin(); cit != all.end(); ++cit) {
    DiagramItem *di = QCanvasItemToDiagramItem(*cit);
    
    if ((di != 0) && (*cit)->visible()) {
       switch (di->type()) {
       case UmlClass:
       case UmlClassInstance:
	 l.append((CodClassInstCanvas *) di);
	 break;
       default:
	 break;
       }
    }
  }

  com->write_unsigned(l.count());
  
  Q3PtrListIterator<CodClassInstCanvas> it(l);
  
  for (; it.current(); ++it) {
    CodClassInstCanvas * i = it.current();
    
    com->write_unsigned((unsigned) i->get_ident());
    if (i->browser_node->get_type() == UmlClass) {      
      com->write_id(0);
      
      Q3CString s = fromUnicode(i->iname);
      
      com->write_string((const char *) s);
    }
    i->browser_node->write_id(com);
  }
}
开发者ID:kralf,项目名称:bouml,代码行数:38,代码来源:CodClassInstCanvas.cpp

示例10: QString

void tst_Q3PtrList::removeType()
{
    Q3PtrList<QString> items;
    items.append(new QString("first"));
    QString *second = new QString("second");
    items.append(second);
    QString *third = new QString("third");
    items.append(third);
    QString *fourth = new QString("fourth");
    items.append(fourth);

    QVERIFY(items.current() == fourth);
    items.setAutoDelete(FALSE);

    // this test an undocumented feature of remove( NULL )
    // in QGList::remove if the ptr is 0 it removes the current item
    // ie. it removes the fourth item from the list in this case
    QString *nullPointer = NULL;
    items.remove( nullPointer );
    QVERIFY(items.count() == 3);
    QVERIFY(items.current() == third);

    // this tests that remove updates the current item also
    // when it removes the _end_ item in the list
    items.remove(third);
    QVERIFY(items.current() == second);

    // test that the removed items are not in the list, then deletes them
    QVERIFY(third && items.find(third) == -1 );
    QVERIFY(fourth && items.find(fourth) == -1);
    delete third;
    delete fourth;
    fourth = third = 0;

    items.setAutoDelete(TRUE);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:36,代码来源:tst_q3ptrlist.cpp

示例11: slotCursorUp

// -----------------------------------------------------------
void QucsApp::slotCursorUp(bool up)
{
  if(editText->isHidden()) {  // for edit of component property ?
  }else if(up){
    if(view->MAx3 == 0) return;  // edit component namen ?
    Component *pc = (Component*)view->focusElement;
    Property *pp = pc->Props.at(view->MAx3-1);  // current property
    int Begin = pp->Description.indexOf('[');
    if(Begin < 0) return;  // no selection list ?
    int End = pp->Description.indexOf(editText->text(), Begin); // current
    if(End < 0) return;  // should never happen
    End = pp->Description.lastIndexOf(',', End);
    if(End < Begin) return;  // was first item ?
    End--;
    int Pos = pp->Description.lastIndexOf(',', End);
    if(Pos < Begin) Pos = Begin;   // is first item ?
    Pos++;
    if(pp->Description.at(Pos) == ' ') Pos++; // remove leading space
    editText->setText(pp->Description.mid(Pos, End-Pos+1));
    editText->selectAll();
    return;
  }else{ // down
    if(view->MAx3 == 0) return;  // edit component namen ?
    Component *pc = (Component*)view->focusElement;
    Property *pp = pc->Props.at(view->MAx3-1);  // current property
    int Pos = pp->Description.indexOf('[');
    if(Pos < 0) return;  // no selection list ?
    Pos = pp->Description.indexOf(editText->text(), Pos); // current list item
    if(Pos < 0) return;  // should never happen
    Pos = pp->Description.indexOf(',', Pos);
    if(Pos < 0) return;  // was last item ?
    Pos++;
    if(pp->Description.at(Pos) == ' ') Pos++; // remove leading space
    int End = pp->Description.indexOf(',', Pos);
    if(End < 0) {  // is last item ?
      End = pp->Description.indexOf(']', Pos);
      if(End < 0) return;  // should never happen
    }
    editText->setText(pp->Description.mid(Pos, End-Pos));
    editText->selectAll();
    return;
  }

  Q3PtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentWidget();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) { // all selections are markers
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerUpDown(up, &movingElements);
    } else if(up) { // nothing selected at all
      if(Doc->scrollUp(Doc->verticalScrollBar()->singleStep()))
        Doc->scrollBy(0, -Doc->verticalScrollBar()->singleStep());
    } else { // down
      if(Doc->scrollDown(-Doc->verticalScrollBar()->singleStep()))
        Doc->scrollBy(0, Doc->verticalScrollBar()->singleStep());
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  }else{ // some random selection, put it back
    view->moveElements(&movingElements, 0, ((up)?-1:1) * Doc->GridY);
    view->MAx3 = 1;  // sign for moved elements
    view->endElementMoving(Doc, &movingElements);
  }
}
开发者ID:Qucs,项目名称:qucs,代码行数:68,代码来源:qucs_actions.cpp

示例12: createSummary

void TesterReport::createSummary (Q3PtrList<TradeItem> &trades, double account)
{
  int shortTrades = 0;
  int longTrades = 0;
  int winLongTrades = 0;
  int loseLongTrades = 0;
  int winShortTrades = 0;
  int loseShortTrades = 0;
  double totalWinLongTrades = 0;
  double totalLoseLongTrades = 0;
  double totalWinShortTrades = 0;
  double totalLoseShortTrades = 0;
  double largestWin = 0;
  double largestLose = 0;
  double accountDrawdown = account;
  double commission = 0;
  double balance = account;

  int loop;
  for (loop = 0; loop < (int) trades.count(); loop++)
  {
    TradeItem *trade = trades.at(loop);

    // get long/short trades
    if (trade->getTradePosition() == TradeItem::Long)
    {
      longTrades++;

      if (trade->getProfit() < 0)
      {
        loseLongTrades++;
	totalLoseLongTrades = totalLoseLongTrades + trade->getProfit();

	if (trade->getProfit() < largestLose)
	  largestLose = trade->getProfit();
      }
      else
      {
        winLongTrades++;
	totalWinLongTrades = totalWinLongTrades + trade->getProfit();

	if (trade->getProfit() > largestWin)
	  largestWin = trade->getProfit();
      }
    }
    else
    {
      shortTrades++;

      if (trade->getProfit() < 0)
      {
        loseShortTrades++;
	totalLoseShortTrades = totalLoseShortTrades + trade->getProfit();

	if (trade->getProfit() < largestLose)
	  largestLose = trade->getProfit();
      }
      else
      {
        winShortTrades++;
	totalWinShortTrades = totalWinShortTrades + trade->getProfit();

	if (trade->getProfit() > largestWin)
	  largestWin = trade->getProfit();
      }
    }

    commission = commission + trade->getEntryCom() + trade->getExitCom();
    balance = trade->getBalance();

    if (trade->getBalance() < accountDrawdown)
      accountDrawdown = trade->getBalance();

    tradeTable->setNumRows(tradeTable->numRows() + 1);
    QString ts;
    trade->getTradePositionString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 0, ts);
    trade->getEnterDateString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 1, ts);
    tradeTable->setText(tradeTable->numRows() - 1, 2, QString::number(trade->getEnterPrice(), 'f', 2));
    trade->getExitDateString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 3, ts);
    tradeTable->setText(tradeTable->numRows() - 1, 4, QString::number(trade->getExitPrice(), 'f', 2));
    trade->getExitSignalString(ts);
    tradeTable->setText(tradeTable->numRows() - 1, 5, ts);
    tradeTable->setText(tradeTable->numRows() - 1, 6, QString::number(trade->getProfit(), 'f', 2));
    tradeTable->setText(tradeTable->numRows() - 1, 7, QString::number(trade->getBalance(), 'f', 2));
    tradeTable->setText(tradeTable->numRows() - 1, 8, QString::number(trade->getVolume()));
  }

  // test summary
  summaryBalance->setNum(balance);
  summaryNetProfit->setNum(balance - account);
  summaryNetPercentage->setNum(((balance - account) / account) * 100);
  summaryInvestment->setNum(account);
  summaryCommission->setNum(commission);
  summaryDrawdown->setNum(accountDrawdown - account);
  summaryTrades->setNum(longTrades + shortTrades);
  summaryLongTrades->setNum(longTrades);
  summaryShortTrades->setNum(shortTrades);
//.........这里部分代码省略.........
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:101,代码来源:TesterReport.cpp

示例13: update

void BrowserView::update(const Q3PtrList<BrowserView> & lv)
{
  Q3Dict<Use> all_nodes(DICT_SIZE);
  Q3PtrListIterator<BrowserView> itv(lv);
  
  all_nodes.setAutoDelete(TRUE);
  
  // look at the revision in each view
  
  for (; itv.current(); ++itv) {
    Q3DictIterator<BrowserNode> itd(itv.current()->nodes);

    for (; itd.current(); ++itd) {
      BrowserNode * bn = itd.current();
      int rev = bn->get_rev();
      Use * use = all_nodes.find(itd.currentKey());
      
      if (use == 0)
	all_nodes.insert(itd.currentKey(), new Use(rev));
      else {
	if (rev < use->rev_min)
	  use->rev_min = rev;
	if (rev > use->rev_max)
	  use->rev_max = rev;
	use->count += 1;
      }
    }
  }
  
  // first solve step
  // only the package existing in all the view are solved
  
  int nviews = lv.count();
  QStringList deleted_or_new;
  
  Q3DictIterator<Use> itu(all_nodes);
  
  for (; itu.current(); ++itu) {
    QString who = itu.currentKey();
    Use * use = itu.current();
	    
    if (use->count == nviews) {
      // exist in all views : solve the state
      if (use->rev_min == use->rev_max) {
	// up to date in all views
	for (itv.toFirst(); itv.current(); ++itv)
	  itv.current()->nodes.find(who)->set_state(UpToDate);
      }
      else {
	int max = use->rev_max;
	
	for (itv.toFirst(); itv.current(); ++itv) {
	  BrowserNode * pack = itv.current()->nodes.find(who);
	  
	  pack->set_state((pack->get_rev() == max) ? Young : Old);
	}
      }
    }
    else {
      // deleted or new, mark it unknown for this step
      deleted_or_new.append(who);
      
      for (itv.toFirst(); itv.current(); ++itv) {
	BrowserNode * pack = itv.current()->nodes.find(who);
	
	if (pack != 0)
	  pack->set_state(Unknown);
      }
    }
  }
  
  all_nodes.clear();
  
  // solve packages marked unknown
  // a package is deleted if its parent is never 'Young'
  
  QStringList::Iterator it;
  
  for (it = deleted_or_new.begin(); it != deleted_or_new.end(); ++it) {
    QString who = *it;
    Q3PtrList<BrowserNode> images;
    bool young = FALSE;
    
    // set the state in each view without looking at the others
    for (itv.toFirst(); itv.current(); ++itv) {
      BrowserNode * pack = itv.current()->nodes.find(who);
      
      if (pack != 0) {
	images.append(pack);
	if (pack->solve())
	  young = TRUE;
      }
    }
    
    // set the final state if young, else all already marked deleted
    if (young) {
      BrowserNode * pack;
      
      for (pack = images.first(); pack != 0; pack = images.next())
	pack->set_state(Young);
//.........这里部分代码省略.........
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:BrowserView.cpp

示例14: tool_cmd

bool ClassInstanceData::tool_cmd(ToolCom * com, const char * args,
				 BrowserNode * bn, const QString & comment) {
  if (((unsigned char) args[-1]) >= firstSetCmd) {
    if (!bn->is_writable() && !root_permission())
      com->write_ack(FALSE);
    else {
      switch ((unsigned char) args[-1]) {
      case setTypeCmd:
	set_class((BrowserClass *) com->get_id(args));
	break;
      case setAttributeCmd:
	{
	  BrowserAttribute * at = (BrowserAttribute *) com->get_id(args);
	  bool find = FALSE;
	  Q3ValueList<SlotAttr>::Iterator it_attr;
	  
	  for (it_attr = attributes.begin(); it_attr != attributes.end(); ++it_attr) {
	    SlotAttr & slot_attr = *it_attr;
	    
	    if (slot_attr.att == at) {
	      find = TRUE;
	      if (*args == 0)
		// remove it
		attributes.remove(it_attr);
	      else
		// replace it
		slot_attr.value = args;
	      break;
	    }
	  }
	  
	  if (! find) {
	    // add it
	    Q3PtrList<BrowserClass> l;
	    
	    cl->get_all_parents(l);
	    l.append(cl);
	    
	    if (at->deletedp() ||
		(l.findRef((BrowserClass *) at->parent())  == -1)) {
	      // illegal
	      com->write_ack(FALSE);
	      return TRUE;
	    }
	    attributes.append(SlotAttr(at, args));
	  }
	}
	break;
      case addRelationCmd:
	if (! change_rel(com, args, TRUE))
	  return TRUE;
	break;
      case removeRelationCmd:
	if (! change_rel(com, args, FALSE))
	  return TRUE;
	break;
      default:
	return BasicData::tool_cmd(com, args, bn, comment);
      }
      
      // ok case
      bn->modified();
      modified();
      com->write_ack(TRUE);
    }
  }
  else {
    switch ((unsigned char) args[-1]) {
    case attributesCmd:
      if (args[0] == 0) {
	com->write_unsigned(attributes.count());
	
	Q3ValueList<SlotAttr>::Iterator it;
	
	for (it = attributes.begin(); it != attributes.end(); ++it) {
	  const SlotAttr & slot = *it;
	  
	  slot.att->write_id(com);
	  com->write_string(slot.value);
	}
      }
      else {
	// get all available attributes
	BrowserNodeList l;
	BrowserNode * bn;
	
	cl->get_attrs(l);
	com->write_unsigned(l.count());
	
	for (bn = l.first(); bn != 0; bn = l.next())
	  bn->write_id(com);
      }
      break;
    case relationsCmd:
      {
	BrowserClassInstance * other =
	  (BrowserClassInstance *) com->get_id(args);
	
	if (other == 0) {
	  com->write_unsigned(relations.count());
//.........这里部分代码省略.........
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:ClassInstanceData.cpp

示例15: send

void SdLifeLineCanvas::send(ToolCom * com, const Q3CanvasItemList & l,
			    Q3PtrList<FragmentCanvas> & fragments,
			    Q3PtrList<FragmentCanvas> & refs)
{
  int api_format = com->api_format();
  Q3PtrDict<SdLifeLineCanvas> used_refs; // the key is the fragment ref
  Q3PtrList<SdLifeLineCanvas> lls;
  Q3CanvasItemList::ConstIterator cit;
  unsigned n = 0;
  
  // count msgs
  
  for (cit = l.begin(); cit != l.end(); ++cit) {
    DiagramItem * it = QCanvasItemToDiagramItem(*cit);
      
    if ((it != 0) && // an uml canvas item
	(*cit)->visible() &&
	(it->type() == UmlLifeLine)) {
      SdLifeLineCanvas * ll = (SdLifeLineCanvas *) it;

      lls.append(ll);
      
      Q3PtrListIterator<SdDurationCanvas> iter(ll->durations);
      
      // standard msgs
      for (; iter.current(); ++iter)
	n += iter.current()->count_msg(api_format);
      
      if (com->api_format() >= 41) {
	if (ll->end != LIFE_LINE_HEIGHT)
	  // deletion message, ll can't masked by user
	  n += 1;
      
	FragmentCanvas * f;
	
	for (f = refs.first(); f != 0; f = refs.next()) {
	  if (f->collidesWith(ll)) {
	    // interaction use message
	    if (used_refs.find((void *) f) == 0) {
	      n += 1;
	      used_refs.insert((void *) f, ll);
	    }
	  }
	}
      }
    }
  }
  
  // write messages
  
  com->write_unsigned(n);
  
  SdLifeLineCanvas * ll;
  
  for (ll = lls.first(); ll != 0; ll = lls.next()) {
    int id = ll->obj->get_ident();
    Q3PtrListIterator<SdDurationCanvas> iter(ll->durations);
  
    // write standard messages
    for (; iter.current(); ++iter)
      iter.current()->send(com, id);
    
    if ((ll->end != LIFE_LINE_HEIGHT) && (com->api_format() >= 41)) {
      // deletion message, lf can't masked by user
      int m = ll->width()/2;
      
      SdMsgBaseCanvas::send(com, id, (unsigned) ll->x() + m,
			    (unsigned) ll->end + m, aDestruction, "", "", "");
    }
  }
  
  if (com->api_format() >= 41) {
    // interaction use messages
    Q3PtrDictIterator<SdLifeLineCanvas>itref(used_refs);
    
    while ((ll = itref.current()) != 0) {
      FragmentCanvas * f = (FragmentCanvas *) itref.currentKey();
      int m = ll->width()/2;
      
      SdMsgBaseCanvas::send(com, ll->obj->get_ident(),
			    (unsigned) ll->x() + m, (unsigned) f->center().y(),
			    anInteractionUse, "", "", f->arguments());
      
      ++itref;
    }
    
    // send life lines covered by fragment
    FragmentCanvas * f;
    
    for (f = fragments.first(); f != 0; f = fragments.next()) {
      Q3PtrList<SdLifeLineCanvas> covered;
      
      for (ll = lls.first(); ll != 0; ll = lls.next())
	if (f->collidesWith(ll))
	  covered.append(ll);
      
      com->write_unsigned(covered.count());
      
      for (ll = covered.first(); ll != 0; ll = covered.next())
	com->write_unsigned((unsigned) ll->obj->get_ident());
//.........这里部分代码省略.........
开发者ID:kralf,项目名称:bouml,代码行数:101,代码来源:SdLifeLineCanvas.cpp


注:本文中的Q3PtrList::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。