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


C++ Q3ValueList::begin方法代码示例

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


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

示例1:

K3BookmarkDrag::K3BookmarkDrag( const Q3ValueList<KBookmark> & bookmarks, const Q3StrList & urls,
                  QWidget * dragSource, const char * name )
    : Q3UriDrag( urls, dragSource, name ), m_bookmarks( bookmarks ), m_doc("xbel")
{
    // We need to create the XML for this drag right now and not
    // in encodedData because when cutting a folder, the children
    // wouldn't be part of the bookmarks anymore, when encodedData
    // is requested.
    QDomElement elem = m_doc.createElement("xbel");
    m_doc.appendChild( elem );
    for ( Q3ValueListConstIterator<KBookmark> it = bookmarks.begin(); it != bookmarks.end(); ++it ) {
       elem.appendChild( (*it).internalElement().cloneNode( true /* deep */ ) );
    }
    //kDebug(7043) << "K3BookmarkDrag::K3BookmarkDrag " << m_doc.toString();
}
开发者ID:ssj-gz,项目名称:emscripten-kdelibs,代码行数:15,代码来源:k3bookmarkdrag.cpp

示例2: serializeImage

void NoteDrag::serializeImage(NoteSelection *noteList, K3MultipleDrag *multipleDrag)
{
	Q3ValueList<QPixmap> pixmaps;
	QPixmap pixmap;
	for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) {
		pixmap = node->note->content()->toPixmap();
		if (!pixmap.isNull())
			pixmaps.append(pixmap);
	}
	if (!pixmaps.isEmpty()) {
		QPixmap pixmapEquivalent;
		if (pixmaps.count() == 1)
			pixmapEquivalent = pixmaps[0];
		else {
			// Search the total size:
			int height = 0;
			int width  = 0;
			for (Q3ValueList<QPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) {
				height += (*it).height();
				if ((*it).width() > width)
					width = (*it).width();
			}
			// Create the image by painting all image into one big image:
			pixmapEquivalent.resize(width, height);
			pixmapEquivalent.fill(Qt::white);
			QPainter painter(&pixmapEquivalent);
			height = 0;
			for (Q3ValueList<QPixmap>::iterator it = pixmaps.begin(); it != pixmaps.end(); ++it) {
				painter.drawPixmap(0, height, *it);
				height += (*it).height();
			}
		}
		Q3ImageDrag *imageDrag = new Q3ImageDrag(pixmapEquivalent.convertToImage());
		multipleDrag->addDragObject(imageDrag);
	}
}
开发者ID:tytycoon,项目名称:basket,代码行数:36,代码来源:notedrag.cpp

示例3: delete

void
dSelectRole::setData( aUser *user )
{
 usr = user;
 listBox1->clear();
 listId.clear();
 Q3ValueList<aRole*> list = user->getRoles(false);
 Q3ValueList<aRole*>::iterator it;
 for ( it = list.begin(); it != list.end(); ++it )
 {
  listBox1->insertItem( (*it)->sysValue("name").toString() );
  listId.append((*it)->sysValue("id").toString());
  delete (*it);
 }
// delete list;
}
开发者ID:K-Be,项目名称:ananas-labs-qt4,代码行数:16,代码来源:dselectrole.cpp

示例4: QCOMPARE

void tst_Q3ValueList::remove()
{
    {
        Q3ValueList<int> a;
        a.append( 1 );
        a.append( 10 );
        a.append( 100 );
        a.append( 1000 );
        a.append( 1000 );
        a.append( 10000 );

        QCOMPARE( (uint)a.remove(100), (uint)1 );
        QCOMPARE( (uint)a.remove(1000), (uint)2 );
        QCOMPARE( (int)a.first(), 1 );
        QCOMPARE( (int)a.last(), 10000 );

        a.remove( a.at(0) );
        QCOMPARE( (int)a.first(), 10 );
        QCOMPARE( (int)a.last(), 10000 );

        a.remove( a.at(1) );
        QCOMPARE( (int)a.first(), 10 );
        QCOMPARE( (int)a.last(), 10 );
    }
    {
        Q3ValueList<int> a;
        a.append( 1 );
        a.append( 10 );
        a.append( 100 );
        a.append( 1000 );
        a.append( 10000 );

        Q3ValueList<int>::Iterator it = a.begin();
        ++it;
        QVERIFY(*it == 10);
        it = a.remove(it);
        QVERIFY(*it == 100);
        it = a.remove(it);
        QVERIFY(*it == 1000);
        it = a.remove(it);
        QVERIFY(*it == 10000);
        it = a.remove(it);
        QVERIFY(it == a.end());
    }
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:45,代码来源:tst_q3valuelist.cpp

示例5: table

/*!\en
 * Mark deleted group with child elements and groups.
 * \param idg (in) - id mark deleted group.
 * \param listDelId (in,out) - list of id mark deleted elements and groups.
 \_en \ru
 * Выделяет удаляемую группу с дочерними элементами и группами.
 * При первом вызове параметр listDelId должен быть пустой, он не обнуляется
 * автоматически при вызове этой функции.
 * Функция рекурсивно вызывает сама себя для всех дочерних подгрупп и
 * добавляет их id в список. Также туда добавляются и id элементов,
 * содержащихся в этих группах. Для изменения атрибута удаления используте функции
 * setElementMarkDeleted(id)(для элементов) и setGroupMarkDeleted(id) (для групп)
 * \param idg (in) - идентификационный номер выделенной для удаления группы.
 * \param listDelId (in,out) - список идентификационных номеров выделенных для удаления элементов и групп.
  *\_ru
 */
void
aCatalogue::getMarkDeletedList(qulonglong idg,
				Q3ValueList<qulonglong> &listDelId)
{
	Q3ValueList<qulonglong> lst;
	aSQLTable * tg = table ( md_group );
	if ( !tg ) return;
	qulonglong tmp;
	if ( idg )
	{

	//	delete elements in group;
			if(selectByGroup(idg)==err_noerror)
			{
				do
				{
					listDelId << sysValue("id").toULongLong();
				}
				while(Next());
			}
			if (groupByParent(idg)==err_noerror)
			{
				do
				{
				lst << GroupSysValue("id").toULongLong();
				}while(NextInGroupTable());

				Q3ValueList<qulonglong>::iterator it = lst.begin();
				while(it!= lst.end())
				{
					getMarkDeletedList((*it),listDelId);
					++it;
				}
			}

	}
	tg->select(QString("id=%1").arg(idg),false);
	if(tg->first())
	{
		listDelId << idg;
	}
	return;
}
开发者ID:K-Be,项目名称:ananas-labs-qt4,代码行数:59,代码来源:acatalogue.cpp

示例6:

GpsimDebugger::~GpsimDebugger()
{
	Q3ValueList<DebugLine*> debugLinesToDelete;

	for ( unsigned i = 0; i < m_addressSize; ++i )
	{
		DebugLine * dl = m_addressToLineMap[i];
		if ( !dl || dl->markedAsDeleted() )
			continue;

		dl->markAsDeleted();
		debugLinesToDelete += dl;
	}

	const Q3ValueList<DebugLine*>::iterator end = debugLinesToDelete.end();
	for ( Q3ValueList<DebugLine*>::iterator it = debugLinesToDelete.begin(); it != end; ++it )
		delete *it;

	delete [] m_addressToLineMap;
}
开发者ID:appillai,项目名称:ktechlab,代码行数:20,代码来源:gpsimprocessor.cpp

示例7: write_exceptions

void UmlOperation::write_exceptions(FileOut & out)
{
    const Q3ValueList<UmlTypeSpec> excpts = exceptions();
    Q3ValueList<UmlTypeSpec>::ConstIterator iter;

    for (iter = excpts.begin(); iter != excpts.end(); ++iter) {
        const UmlTypeSpec & e = *iter;

        if (e.type != 0) {
            out.indent();
            out << "<raisedException";
            out.idref(e.type);
            out << "/>\n";
        }
        else if (!e.explicit_type.isEmpty()) {
            out.indent();
            out << "<raisedException";
            out.idref_datatype(e.explicit_type);
            out << "/>\n";
        }
    }
}
开发者ID:bleakxanadu,项目名称:douml,代码行数:22,代码来源:UmlOperation.cpp

示例8: bs

ClassListDialog::ClassListDialog(const char * m,
				 const Q3ValueList<BrowserClass *> & l)
    : QDialog(0, m, TRUE) {
  setCaption(m);
  move(QCursor::pos());
 
  Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
  Q3HBoxLayout * hbox;
 
  vbox->setMargin(5);
 
  cb = new Q3ComboBox(FALSE, this);
  vbox->addWidget(cb);
  
  Q3ValueList<BrowserClass *>::ConstIterator end = l.end();
  Q3ValueList<BrowserClass *>::ConstIterator it;
  
    for (it = l.begin(); it != end; ++it)
      if (!(*it)->deletedp())
	cb->insertItem((*it)->full_name(TRUE));
  
  hbox = new Q3HBoxLayout(vbox); 
  hbox->setMargin(5);
  QPushButton * ok = new QPushButton(TR("&OK"), this);
  QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
  QSize bs(cancel->sizeHint());
  
  ok->setDefault(TRUE);  
  ok->setFixedSize(bs);
  cancel->setFixedSize(bs);
  
  hbox->addWidget(ok);
  hbox->addWidget(cancel);
  
  connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
  connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
  
  UmlDesktop::limitsize_center(this, previous_size, 0.8, 0.8);
}
开发者ID:SciBoy,项目名称:douml,代码行数:39,代码来源:ClassListDialog.cpp

示例9: findRecipes

void IngredientMatcherDialog::findRecipes( void )
{
	KApplication::setOverrideCursor( Qt::WaitCursor );

	START_TIMER("Ingredient Matcher: loading database data");

	RecipeList rlist;
	database->loadRecipes( &rlist, RecipeDB::Title | RecipeDB::NamesOnly | RecipeDB::Ingredients | RecipeDB::IngredientAmounts );

	END_TIMER();
	START_TIMER("Ingredient Matcher: analyzing data for matching recipes");

	// Clear the list
	recipeListView->listView() ->clear();

	// Now show the recipes with ingredients that are contained in the previous set
	// of ingredients
	RecipeList incompleteRecipes;
	QList <int> missingNumbers;
	Q3ValueList <IngredientList> missingIngredients;

	RecipeList::Iterator it;
	for ( it = rlist.begin();it != rlist.end();++it ) {
		IngredientList il = ( *it ).ingList;
		if ( il.isEmpty() )
			continue;

		IngredientList missing;
		if ( m_ingredientList.containsSubSet( il, missing, true, database ) ) {
			new CustomRecipeListItem( recipeListView->listView(), *it );
		}
		else {
			incompleteRecipes.append( *it );
			missingIngredients.append( missing );
			missingNumbers.append( missing.count() );
		}
	}
	END_TIMER();

	//Check if the user wants to show missing ingredients

	if ( missingNumberSpinBox->value() == 0 ) {
		KApplication::restoreOverrideCursor();
		return ;
	} //"None"



	START_TIMER("Ingredient Matcher: searching for and displaying partial matches");

	IngredientList requiredIngredients;
	for ( Q3ListViewItem *it = ingListView->listView()->firstChild(); it; it = it->nextSibling() ) {
		if ( ((Q3CheckListItem*)it)->isOn() )
			requiredIngredients << *m_item_ing_map[it];
	}

	// Classify recipes with missing ingredients in different lists by amount
	QList<int>::Iterator nit;
	Q3ValueList<IngredientList>::Iterator ilit;
	int missingNoAllowed = missingNumberSpinBox->value();

	if ( missingNoAllowed == -1 )  // "Any"
	{
		for ( nit = missingNumbers.begin();nit != missingNumbers.end();++nit )
			if ( ( *nit ) > missingNoAllowed )
				missingNoAllowed = ( *nit );
	}


	for ( int missingNo = 1; missingNo <= missingNoAllowed; missingNo++ ) {
		nit = missingNumbers.begin();
		ilit = missingIngredients.begin();

		bool titleShownYet = false;

		for ( it = incompleteRecipes.begin();it != incompleteRecipes.end();++it, ++nit, ++ilit ) {
			if ( !( *it ).ingList.containsAny( m_ingredientList ) )
				continue;

			if ( !( *it ).ingList.containsSubSet( requiredIngredients ) )
				continue;

			if ( ( *nit ) == missingNo ) {
				if ( !titleShownYet ) {
					new SectionItem( recipeListView->listView(), i18ncp( "@label:textbox", "You are missing 1 ingredient for:", "You are missing %1 ingredients for:", missingNo ) );
					titleShownYet = true;
				}
				new CustomRecipeListItem( recipeListView->listView(), *it, *ilit );
			}
		}
	}
	END_TIMER();

	KApplication::restoreOverrideCursor();
}
开发者ID:KDE,项目名称:krecipes,代码行数:95,代码来源:ingredientmatcherdialog.cpp

示例10: drawTree

QRect CEdge::drawTree( Q3Canvas* canvas, int left, int depth, StringToString* filter )
{
	int X_PADDING = 10;
	int Y_SPACING = 30;

//	int X_MARGIN = 10; unused variable 'X_Margin'
	int Y_MARGIN = 10;

	//================================================

	Q3CanvasItem* edge = new Q3CanvasText( LHS(), canvas ),
			   * leaf = NULL;
	Q3CanvasLine* line;

	m_CanvasItems.clear();
	m_CanvasItems.append( edge );

	int myLeft = left,
		myTop = ( depth * Y_SPACING ) + Y_MARGIN,
		myCenterX,
		myBottom,
		childCenterX,
		childLeft,
		childTop,
		shiftAmount;

	Q3ValueList<QRect> daughterBoundingRectangles;
	Q3ValueList<QRect>::iterator it;

	QRect myBoundingRect, rectangle;
	myBoundingRect.setTop( myTop );
	myBoundingRect.setLeft( myLeft );
	myBoundingRect.setBottom( myTop + edge->boundingRect().height() - 1 );
	myBoundingRect.setRight( myLeft + edge->boundingRect().width() - 1 );
	
	int count = 0;
//	bool first = TRUE; unused variable 'first'

	CEdge* daughter;
	for( daughter = m_Daughters.first(); daughter; daughter = m_Daughters.next() )
	{
		daughterBoundingRectangles.append( rectangle );

		daughterBoundingRectangles[count] = daughter->drawTree( canvas, left, depth + 1, filter );

		// Adjust left position based on bounding rectangle of last daughter
		left = daughterBoundingRectangles[count].right() + X_PADDING;

		count++;
	}

	if( m_Daughters.isEmpty() )
	{
		// Create leaf node
		childLeft = myLeft;
		childTop = ( ( depth + 1 ) * Y_SPACING ) + Y_MARGIN;

		leaf = new Q3CanvasText( Filter( filter, RHS() ), canvas );
		m_CanvasItems.append( leaf );

		leaf->move( childLeft, childTop );
		leaf->show();

		// Adjust my bounding rect
		if( leaf->boundingRect().right() > myBoundingRect.right() ) myBoundingRect.setRight( leaf->boundingRect().right() );
		myBoundingRect.setBottom( leaf->boundingRect().bottom() );
	}
	else
	{
		for( it = daughterBoundingRectangles.begin(); it != daughterBoundingRectangles.end(); ++it )
		{
			// Adjust my bounding rect
			if( (*it).right() > myBoundingRect.right() ) myBoundingRect.setRight( (*it).right() );
			if( (*it).bottom() > myBoundingRect.bottom() ) myBoundingRect.setBottom( (*it).bottom() );
		}
	}
	
	if( myBoundingRect.width() == edge->boundingRect().width() ) 
	{
		// Shift all children to the right
		if( m_Daughters.isEmpty() )
		{
			shiftAmount = int (( myBoundingRect.width() - leaf->boundingRect().width() ) / 2.0);

			leaf->move( leaf->boundingRect().left() + shiftAmount, leaf->boundingRect().top() );
			leaf->show();
		}
		else
		{
			shiftAmount = int (( myBoundingRect.width() - ( daughterBoundingRectangles.last().right() - daughterBoundingRectangles.first().left() ) ) / 2.0);
			
			for( daughter = m_Daughters.first(); daughter; daughter = m_Daughters.next() )
			{
				daughter->shiftTree( canvas, shiftAmount, 0 );
			}

			for( it = daughterBoundingRectangles.begin(); it != daughterBoundingRectangles.end(); ++it )
			{
				// Adjust the bounding rect position
				(*it).setLeft( (*it).left() + shiftAmount );
//.........这里部分代码省略.........
开发者ID:JohnAGoldsmith,项目名称:lxa420,代码行数:101,代码来源:Edge.cpp

示例11: generate_extends

void UmlRelation::generate_extends(const char *& sep, QTextOStream & f,
                                   const Q3ValueList<UmlActualParameter> & actuals,
                                   const Q3CString & cl_stereotype) {
    switch (relationKind()) {
    default:
        return;
    case aGeneralisation:
    case aRealization:
        if (javaDecl().isEmpty())
            return;

        UmlClass * role_type = roleType();
        const Q3CString & other_stereotype = role_type->java_stereotype();

        if ((cl_stereotype == "interface") || (cl_stereotype == "@interface")) {
            if ((other_stereotype != "interface") && (other_stereotype != "@interface")) {
                write_trace_header();
                UmlCom::trace(Q3CString("&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"red\"><b>cannot extends a <i>")
                              + other_stereotype + "</i></b></font><br>");
                incr_warning();
                return;
            }
        }
        else if ((other_stereotype != "interface") && (other_stereotype != "@interface")) {
            if ((cl_stereotype == "union") || (cl_stereotype == "enum_pattern")) {
                write_trace_header();
                UmlCom::trace(Q3CString("&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"red\"><b>an <i>")
                              + cl_stereotype + "</i> cannot extends</b></font><br>");
                incr_warning();
                return;
            }
            else if ((other_stereotype == "union") ||
                     (other_stereotype == "enum") ||
                     (other_stereotype == "enum_pattern")) {
                write_trace_header();
                UmlCom::trace(Q3CString("&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"red\"><b>cannot extends an <i>")
                              + other_stereotype + "</i></b></font><br>");
                incr_warning();
                return;
            }
            else if (*sep == ',') {
                write_trace_header();
                UmlCom::trace("&nbsp;&nbsp;&nbsp;&nbsp;<font color=\"red\"><b>extend several classes</b></font><br>");
                incr_warning();
                return;
            }
        }
        else
            return;

        // here the code is legal
        f << sep;
        sep = ", ";

        const char * p = javaDecl();

        while (*p) {
            if (!strncmp(p, "${type}", 7)) {
                role_type->write(f);
                p += 7;

                if (!actuals.isEmpty()) {
                    Q3ValueList<UmlActualParameter>::ConstIterator ita;
                    bool used = FALSE;

                    for (ita = actuals.begin(); ita != actuals.end(); ++ita) {
                        if ((*ita).superClass() == role_type) {
                            used = TRUE;
                            (*ita).generate(f);
                        }
                    }

                    if (used) {
                        f << ">";
                    }
                }
            }
            else if (*p == '@')
                manage_alias(p, f);
            else
                f << *p++;
        }
    }
}
开发者ID:SciBoy,项目名称:douml,代码行数:84,代码来源:UmlRelation.cpp

示例12: generate_decl

void UmlClass::generate_decl(QTextOStream & f_h, Q3CString indent) {
  context.append(this);
  
  bool removed = FALSE;
  Q3PtrVector<UmlItem> ch = children();
  const unsigned sup = ch.size();
  const Q3CString & stereotype = cpp_stereotype();
  bool a_typedef = (stereotype == "typedef");
  bool an_enum = (stereotype == "enum");
  const Q3ValueList<UmlFormalParameter> formals = this->formals();
  const Q3ValueList<UmlActualParameter> actuals = this->actuals();  
  unsigned index;
  const char * p = cppDecl();
  const char * pp = 0;
  const char * sep;
  bool nestedp = parent()->kind() == aClass;
  
  if (nestedp)
    indent += "    ";
  
  while ((*p == ' ') || (*p == '\t'))
    indent += *p++;
  
  if (*p != '#')
    f_h << indent;
    
  for (;;) {
    if (*p == 0) {
      if (pp == 0)
	break;
      
      // comment management done
      p = pp;
      pp = 0;
      if (*p == 0)
	break;
      if (*p != '#')
	f_h << indent;
    }

    if (*p == '\n') {
      f_h << *p++;
      if (*p && (*p != '#') &&
	  strncmp(p, "${members}", 10) &&
	  strncmp(p, "${items}", 8))
	f_h << indent;
    }
    else if (*p == '@')
      manage_alias(p, f_h);
    else if (*p != '$')
      f_h << *p++;
    else if (!strncmp(p, "${comment}", 10))
      manage_comment(p, pp, CppSettings::isGenerateJavadocStyleComment());
    else if (!strncmp(p, "${description}", 14))
      manage_description(p, pp);
    else if (! strncmp(p, "${name}", 7)) {
      p += 7;
      f_h << name();
    }
    else if (a_typedef) {
      if (!strncmp(p, "${type}", 7)) {
	p += 7;
	UmlClass::write(f_h, baseType(), FALSE);
	
	UmlClass * cl = baseType().type;
	
	if ((cl != 0) && !actuals.isEmpty()) {
	  Q3ValueList<UmlActualParameter>::ConstIterator ita;
	  BooL need_space = FALSE;
    
	  for (ita = actuals.begin(); ita != actuals.end(); ++ita)
	    if ((*ita).superClass() == cl)
	      if (! (*ita).generate(f_h, need_space))
		// no specified value
		break;
	  
	  if (need_space)
	    f_h << " >";
	  else
	    f_h << '>';
	}
      }
      else
	// strange
	f_h << *p++;
    }
    else if (an_enum) {
      if (!strncmp(p, "${items}", 8)) {
	p += 8;
	
	// items declaration
	
	aVisibility current_visibility = DefaultVisibility;
	unsigned max = sup - 1;
	BooL first = TRUE;
	
	for (index = 0; index < sup; index += 1) {
	  UmlItem * it = ch[index];
	  
	  switch (it->kind()) {
//.........这里部分代码省略.........
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:UmlClass.cpp

示例13: write

void UmlClass::write(QTextOStream & f, bool with_formals, BooL * is_template,
		     const Q3ValueList<UmlActualParameter> & actuals) {
  if (context.findRef(this) == -1) {
    if (parent()->kind() == aClass) {
      if (context.findRef((UmlClass *) parent()) == -1) {
	// parent cannot have formals, but may have actuals
	((UmlClass *) parent())->write(f, FALSE, 0, actuals);
	f << "::";
      }
    }
    else {
      UmlArtifact * cp = associatedArtifact();
      Q3CString nasp = ((UmlPackage *)
		       ((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package())
	->cppNamespace();
      
      if (CppSettings::isForceNamespacePrefixGeneration() ||
	  (nasp != UmlArtifact::generation_package()->cppNamespace()))
	f << nasp << "::";
    }
  }
  
  Q3CString s;
  
  if (isCppExternal()) {
    s = cppDecl();
    
    int index = s.find('\n');
    
    s = (index == -1) ? s.stripWhiteSpace()
		      : s.left(index).stripWhiteSpace();
      
    if ((index = s.find("${name}")) != -1)
      s.replace(index, 7, name());
    else if ((index = s.find("${Name}")) != -1)
      s.replace(index, 7, capitalize(name()));
    else if ((index = s.find("${NAME}")) != -1)
      s.replace(index, 7, name().upper());
    else if ((index = s.find("${nAME}")) != -1)
      s.replace(index, 7, name().lower());
  }
  else 
    s = name();	// true_name
  
  if (! s.isEmpty()){
    f << s;
    
    if (is_template != 0)
      *is_template = (s.at(s.length() - 1) == '>');
  }
  else if (is_template != 0)
    *is_template = FALSE;
    
  if (with_formals) {
    Q3ValueList<UmlFormalParameter> formals = this->formals();
    
    if (! formals.isEmpty()) {
      const char * sep = "<";
      Q3ValueList<UmlFormalParameter>::ConstIterator it;
      
      for (it = formals.begin(); it != formals.end(); ++it) {
	f << sep << (*it).name();
	sep = ", ";
      }
      
      f << '>';
      
      if (is_template != 0)
	*is_template = TRUE;
    }
  }
  else if (!actuals.isEmpty()) {
    Q3ValueList<UmlActualParameter>::ConstIterator ita;
    BooL need_space = FALSE;
    bool used = FALSE;
    
    for (ita = actuals.begin(); ita != actuals.end(); ++ita) {
      if ((*ita).superClass() == this) {
	used = TRUE;
	(*ita).generate(f, need_space);
      }
    }
    
    if (used) {
      if (need_space)
	f << " >";
      else
	f << '>';
      
      if (is_template != 0)
	*is_template = TRUE;
    }
  }
}
开发者ID:SciBoy,项目名称:douml,代码行数:94,代码来源:UmlClass.cpp

示例14: compute_type

void ClassContainer::compute_type(Q3CString type, UmlTypeSpec & typespec,
				  Q3CString & typeform,
				  bool get_first_template_actual,
				  const Q3ValueList<FormalParameterList> & tmplts) {
  typespec.type = 0;
  typespec.explicit_type = 0;
  
  if (!strncmp((const char *) type, "struct ", 7) ||
      !strncmp((const char *) type, "union ", 6) ||
      !strncmp((const char *) type, "enum ", 5)) {
    typespec.explicit_type = "<complex type>";
    typeform = type;
    return;
  }
    
  int index;
  
  if (get_first_template_actual && ((index = type.find('<')) != -1)) {
    type = Lex::normalize(type);
    index = type.find('<');
    
    const char * p = type;
    
    if (strncmp(p + index + 1, "const ", 6) == 0)
      index += 6;
    
    // look at each actual in <>
    unsigned level = 1;
    int index2;
    Q3CString tf1;
    Q3CString t1;
    
    for (;;) {
      // earch for the current arg end
      for (index2 = index + 1; p[index2]; index2 += 1) {
	char c = p[index2];
	
	if ((c == ',') || (c == '*') || (c == '[') || (c == '&')) {
	  if (level == 1)
	    break;
	}
	else if (c == '<')
	  level += 1;
	else if ((c == '>') && (--level == 0))
	  break;
      }
      
      if (p[index2]) {
	Q3CString tf = type.left(index + 1) + typeform + type.mid(index2);
	Q3CString t = type.mid(index + 1, index2 - index - 1).stripWhiteSpace();
#ifdef DEBUG_BOUML
	cout << "typeform '" << tf << "' type '" << t << "'\n";
#endif
	UmlTypeSpec ts;
	
	Q3CString normalized = Lex::normalize(t);
  
	if (!find_type(normalized, ts) &&
	     (Namespace::current().isEmpty() ||
	      (normalized.at(0) == ':') || 
	      !find_type("::" + normalized, ts))) {
	  if (get_first_template_actual) {
	    get_first_template_actual = FALSE;
	    tf1 = tf;
	    t1 = t;
	  }
	  index = index2;
	}
	else {
	  // find a class
	  typeform = tf;
	  type = t;
	  typespec.type = ts.type;
	  break;
	}
      }
      else if (!get_first_template_actual) {
	// has first actual
	typeform = tf1;
	type = t1;
	break;
      }
      else {
	typespec.explicit_type = type;
	return;
      }
    }
  }

  if (! tmplts.isEmpty()) {
    Q3ValueList<FormalParameterList>::ConstIterator it1;
    
    for (it1 = tmplts.begin(); it1 != tmplts.end(); ++it1) {
      FormalParameterList::ConstIterator it2;
    
      for (it2 = (*it1).begin(); it2 != (*it1).end(); ++it2) {
	if ((*it2).name() == type) {
	  typespec.type = 0;
	  typespec.explicit_type = type;
	  return;
//.........这里部分代码省略.........
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:ClassContainer.cpp

示例15: main

int main( int argc, char** argv ) {

  KAboutData aboutData( "test_cryptoconfig", 0, ki18n("CryptoConfig Test"), "0.1" );
  KCmdLineArgs::init( argc, argv, &aboutData );
  KApplication app( false );

  Kleo::CryptoConfig * config = new QGpgMECryptoConfig();

  // Dynamic querying of the options
  cout << "Components:" << endl;
  QStringList components = config->componentList();

  for( QStringList::Iterator compit = components.begin(); compit != components.end(); ++compit ) {
    cout << "Component " << (*compit).toLocal8Bit().constData() << ":" << endl;
    const Kleo::CryptoConfigComponent* comp = config->component( *compit );
    assert( comp );
    QStringList groups = comp->groupList();
    for( QStringList::Iterator groupit = groups.begin(); groupit != groups.end(); ++groupit ) {
      const Kleo::CryptoConfigGroup* group = comp->group( *groupit );
      assert( group );
      cout << " Group " << (*groupit).toLocal8Bit().constData() << ": descr=\"" << group->description().toLocal8Bit().constData() << "\""
           << " level=" << group->level() << endl;
      QStringList entries = group->entryList();
      for( QStringList::Iterator entryit = entries.begin(); entryit != entries.end(); ++entryit ) {
        const Kleo::CryptoConfigEntry* entry = group->entry( *entryit );
        assert( entry );
        cout << "  Entry " << (*entryit).toLocal8Bit().constData() << ":"
             << " descr=\"" << entry->description().toLocal8Bit().constData() << "\""
             << " " << ( entry->isSet() ? "is set" : "is not set" );
        if ( !entry->isList() )
          switch( entry->argType() ) {
          case Kleo::CryptoConfigEntry::ArgType_None:
            break;
          case Kleo::CryptoConfigEntry::ArgType_Int:
            cout << " int value=" << entry->intValue();
            break;
          case Kleo::CryptoConfigEntry::ArgType_UInt:
            cout << " uint value=" << entry->uintValue();
            break;
          case Kleo::CryptoConfigEntry::ArgType_LDAPURL:
          case Kleo::CryptoConfigEntry::ArgType_URL:
            cout << " URL value=" << entry->urlValue().prettyUrl().toLocal8Bit().constData();
            // fallthrough
          case Kleo::CryptoConfigEntry::ArgType_Path:
            // fallthrough
          case Kleo::CryptoConfigEntry::ArgType_DirPath:
            // fallthrough
          case Kleo::CryptoConfigEntry::ArgType_String:

            cout << " string value=" << entry->stringValue().toLocal8Bit().constData();
            break;
          case Kleo::CryptoConfigEntry::NumArgType:
            // just metadata and should never actually occur in the switch
            break;
          }
        else // lists
        {
          switch( entry->argType() ) {
          case Kleo::CryptoConfigEntry::ArgType_None: {
            cout << " set " << entry->numberOfTimesSet() << " times";
            break;
          }
          case Kleo::CryptoConfigEntry::ArgType_Int: {
            assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
            Q3ValueList<int> lst = entry->intValueList();
            QString str;
            for( Q3ValueList<int>::Iterator it = lst.begin(); it != lst.end(); ++it ) {
              str += QString::number( *it );
            }
            cout << " int values=" << str.toLocal8Bit().constData();
            break;
          }
          case Kleo::CryptoConfigEntry::ArgType_UInt: {
            assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
            Q3ValueList<uint> lst = entry->uintValueList();
            QString str;
            for( Q3ValueList<uint>::Iterator it = lst.begin(); it != lst.end(); ++it ) {
              str += QString::number( *it );
            }
            cout << " uint values=" << str.toLocal8Bit().constData();
            break;
          }
          case Kleo::CryptoConfigEntry::ArgType_LDAPURL:
          case Kleo::CryptoConfigEntry::ArgType_URL: {
              assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
              KUrl::List urls = entry->urlValueList();
              cout << " url values=" << urls.toStringList().join(" ").toLocal8Bit().constData() << "\n    ";
          }
            // fallthrough
          case Kleo::CryptoConfigEntry::ArgType_Path:
            // fallthrough
          case Kleo::CryptoConfigEntry::ArgType_DirPath:
            // fallthrough
          case Kleo::CryptoConfigEntry::ArgType_String: {
            assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
            QStringList lst = entry->stringValueList();
            cout << " string values=" << lst.join(" ").toLocal8Bit().constData();
            break;
          }
          case Kleo::CryptoConfigEntry::NumArgType:
//.........这里部分代码省略.........
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:101,代码来源:test_cryptoconfig.cpp


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