本文整理汇总了C++中UMLClassifierList::next方法的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifierList::next方法的具体用法?C++ UMLClassifierList::next怎么用?C++ UMLClassifierList::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMLClassifierList
的用法示例。
在下文中一共展示了UMLClassifierList::next方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeConcreteClassifier
void XMLSchemaWriter::writeConcreteClassifier (UMLClassifier *c, QTextStream &XMLschema)
{
// preparations.. gather information about this classifier
//
UMLClassifierList superclasses = c->findSuperClassConcepts(); // list of what inherits from us
UMLClassifierList subclasses = c->findSubClassConcepts(); // list of what we inherit from
UMLAssociationList aggregations = c->getAggregations();
UMLAssociationList compositions = c->getCompositions();
// BAD! only way to get "general" associations.
UMLAssociationList associations = c->getSpecificAssocs(Uml::at_Association);
// write the main declaration
writeComplexTypeClassifierDecl(c, associations, aggregations, compositions, superclasses, XMLschema);
markAsWritten(c);
// Now write out any child def's
writeChildObjsInAssociation(c, associations, XMLschema);
writeChildObjsInAssociation(c, aggregations, XMLschema);
writeChildObjsInAssociation(c, compositions, XMLschema);
// write out any superclasses as needed
for(UMLClassifier *classifier = superclasses.first(); classifier; classifier = superclasses.next())
writeClassifier(classifier, XMLschema);
// write out any subclasses as needed
for(UMLClassifier *classifier = subclasses.first(); classifier; classifier = subclasses.next())
writeClassifier(classifier, XMLschema);
}
示例2: writeGroupClassifierDecl
void XMLSchemaWriter::writeGroupClassifierDecl (UMLClassifier *c,
UMLClassifierList subclasses,
QTextStream &XMLschema)
{
// name of class, subclassing classifiers
QString elementTypeName = getElementGroupTypeName(c);
// start Writing node but only if it has subclasses? Nah..right now put in empty group
XMLschema<<getIndent()<<"<"<<makeSchemaTag("group")<<" name=\""<<elementTypeName<<"\">"<<m_endl;
m_indentLevel++;
XMLschema<<getIndent()<<"<"<<makeSchemaTag("choice")<<">"<<m_endl;
m_indentLevel++;
for(UMLClassifier *classifier = subclasses.first(); classifier; classifier = subclasses.next()) {
writeAssociationRoleDecl(classifier, "1", XMLschema);
}
m_indentLevel--;
XMLschema<<getIndent()<<"</"<<makeSchemaTag("choice")<<">"<<m_endl;
m_indentLevel--;
// finish node
XMLschema<<getIndent()<<"</"<<makeSchemaTag("group")<<">"<<m_endl;
}
示例3: writeAbstractClassifier
void XMLSchemaWriter::writeAbstractClassifier (UMLClassifier *c, QTextStream &XMLschema)
{
// preparations
UMLClassifierList subclasses = c->findSubClassConcepts(); // list of what inherits from us
UMLClassifierList superclasses = c->findSuperClassConcepts(); // list of what we inherit from
// write the main declaration
writeConcreteClassifier (c, XMLschema);
writeGroupClassifierDecl (c, subclasses, XMLschema);
markAsWritten(c);
// now go back and make sure all sub-classing nodes are declared
if(subclasses.count() > 0)
{
QString elementName = getElementName(c);
UMLAttributeList attribs = findAttributes(c);
QStringList attribGroups = findAttributeGroups(c);
writeAttributeGroupDecl(elementName, attribs, XMLschema);
// now write out inheriting classes, as needed
for(UMLClassifier * classifier = subclasses.first(); classifier; classifier = subclasses.next())
writeClassifier(classifier, XMLschema);
}
// write out any superclasses as needed
for(UMLClassifier *classifier = superclasses.first(); classifier; classifier = superclasses.next())
writeClassifier(classifier, XMLschema);
}
示例4: findAttributeGroups
// these exist for abstract classes only (which become xs:group nodes)
QStringList XMLSchemaWriter::findAttributeGroups (UMLClassifier *c)
{
// we need to look for any class we inherit from. IF these
// have attributes, then we need to notice
QStringList list;
UMLClassifierList superclasses = c->findSuperClassConcepts(); // list of what inherits from us
for(UMLClassifier *classifier = superclasses.first(); classifier; classifier = superclasses.next())
{
if(classifier->getAbstract())
{
// only classes have attributes..
if (!classifier->isInterface()) {
UMLAttributeList attribs = c->getAttributeList();
if (attribs.count() > 0)
list.append(getElementName(classifier)+"AttribGroupType");
}
}
}
return list;
}
示例5: writeClass
//.........这里部分代码省略.........
cs << "namespace " << container->getFullyQualifiedName(".") << m_endl;
cs << "{" << m_endl << m_endl;
m_container_indent = m_indentation;
m_seenIncludes.append(container);
}
//Write class Documentation if there is somthing or if force option
if (forceDoc() || !c->getDoc().isEmpty()) {
cs << m_container_indent << "/// <summary>" << m_endl;
cs << formatDoc(c->getDoc(), m_container_indent + "/// " );
cs << m_container_indent << "/// </summary>" << m_endl ;
}
UMLClassifierList superclasses = c->getSuperClasses();
UMLAssociationList aggregations = c->getAggregations();
UMLAssociationList compositions = c->getCompositions();
UMLAssociationList realizations = c->getRealizations();
bool isInterface = c->isInterface();
m_unnamedRoles = 1;
cs << m_container_indent << "public ";
//check if it is an interface or regular class
if (isInterface) {
cs << "interface " << classname;
} else {
//check if class is abstract and / or has abstract methods
if (c->getAbstract() || c->hasAbstractOps())
cs << "abstract ";
cs << "class " << classname << (superclasses.count() > 0 ? " : ":"");
// write baseclass, ignore interfaces, write error on multiple inheritance
if (superclasses.count() > 0) {
UMLClassifier *obj;
int supers = 0;
for (obj = superclasses.first(); obj; obj = superclasses.next()) {
if (!obj->isInterface()) {
if (supers > 0) {
cs << " // AND ";
}
cs << cleanName(obj->getName());
supers++;
}
}
if (supers > 1) {
cs << m_endl << "//WARNING: C# does not support multiple inheritance but there is more than 1 superclass defined in your UML model!" << m_endl;
}
}
//check for realizations
UMLAssociationList realizations = c->getRealizations();
UMLAssociation *a;
if (!realizations.isEmpty()) {
for (a = realizations.first(); a; a = realizations.next()) {
UMLClassifier *real = (UMLClassifier*)a->getObject(Uml::B);
if(real != c) {
// write list of realizations
cs << ", " << real->getName();
}
}
}
}
cs << m_endl << m_container_indent << '{' << m_endl;
//associations
if (forceSections() || !aggregations.isEmpty()) {
cs << m_endl << m_container_indent << m_indentation << "#region Aggregations" << m_endl << m_endl;
writeAssociatedAttributes(aggregations, c, cs);
cs << m_endl << m_container_indent << m_indentation << "#endregion" << m_endl;
}
//compositions
if (forceSections() || !compositions.isEmpty()) {
cs << m_endl << m_container_indent << m_indentation << "#region Compositions" << m_endl << m_endl;
writeAssociatedAttributes(compositions, c, cs);
cs << m_endl << m_container_indent << m_indentation << "#endregion" << m_endl;
}
//attributes
// FIXME: C# allows Properties in interface!
if (!isInterface)
writeAttributes(c, cs);
//operations
writeOperations(c, cs);
//finish file
cs << m_endl << m_container_indent << "}" << m_endl << m_endl; // close class
if (container) {
cs << "} // end of namespace "
<< container->getFullyQualifiedName(".") << m_endl << m_endl;
}
//close files and notfiy we are done
filecs.close();
emit codeGenerated(c, true);
}
示例6: writeClass
void JSWriter::writeClass(UMLClassifier *c)
{
if(!c)
{
kDebug()<<"Cannot write class of NULL concept!" << endl;
return;
}
QString classname = cleanName(c->getName());
QString fileName = c->getName().lower();
//find an appropriate name for our file
fileName = findFileName(c,".js");
if (fileName.isEmpty())
{
emit codeGenerated(c, false);
return;
}
QFile filejs;
if(!openFile(filejs, fileName))
{
emit codeGenerated(c, false);
return;
}
QTextStream js(&filejs);
//////////////////////////////
//Start generating the code!!
/////////////////////////////
//try to find a heading file (license, coments, etc)
QString str;
str = getHeadingFile(".js");
if(!str.isEmpty())
{
str.replace(QRegExp("%filename%"),fileName);
str.replace(QRegExp("%filepath%"),filejs.name());
js << str << m_endl;
}
//write includes
UMLPackageList includes;
findObjectsRelated(c,includes);
for (UMLPackage *conc = includes.first(); conc; conc = includes.next())
{
QString headerName = findFileName(conc, ".js");
if ( !headerName.isEmpty() )
{
js << "#include \"" << headerName << "\"" << m_endl;
}
}
js << m_endl;
//Write class Documentation if there is somthing or if force option
if(forceDoc() || !c->getDoc().isEmpty())
{
js << m_endl << "/**" << m_endl;
js << " * class " << classname << m_endl;
js << formatDoc(c->getDoc()," * ");
js << " */" << m_endl << m_endl;
}
//check if class is abstract and / or has abstract methods
if(c->getAbstract() && !hasAbstractOps(c))
js << "/******************************* Abstract Class ****************************" << m_endl << " "
<< classname << " does not have any pure virtual methods, but its author" << m_endl
<< " defined it as an abstract class, so you should not use it directly." << m_endl
<< " Inherit from it instead and create only objects from the derived classes" << m_endl
<< "*****************************************************************************/" << m_endl << m_endl;
js << classname << " = function ()" << m_endl;
js << "{" << m_endl;
js << m_indentation << "this._init ();" << m_endl;
js << "}" << m_endl;
js << m_endl;
UMLClassifierList superclasses = c->getSuperClasses();
for (UMLClassifier *obj = superclasses.first();
obj; obj = superclasses.next()) {
js << classname << ".prototype = new " << cleanName(obj->getName()) << " ();" << m_endl;
}
js << m_endl;
if (! c->isInterface()) {
UMLAttributeList atl = c->getAttributeList();
js << "/**" << m_endl;
QString temp = "_init sets all " + classname + " attributes to their default value."
" Make sure to call this method within your class constructor";
js << formatDoc(temp, " * ");
js << " */" << m_endl;
js << classname << ".prototype._init = function ()" << m_endl;
js << "{" << m_endl;
for(UMLAttribute *at = atl.first(); at ; at = atl.next())
{
//.........这里部分代码省略.........
示例7: updateContent
// This method will cause the class to rebuild its text representation.
// based on the parent classifier object.
// For any situation in which this is called, we are either building the code
// document up, or replacing/regenerating the existing auto-generated parts. As
// such, we will want to insert everything we resonablely will want
// during creation. We can set various parts of the document (esp. the
// comments) to appear or not, as needed.
void CPPHeaderCodeDocument::updateContent( )
{
// Gather info on the various fields and parent objects of this class...
UMLClassifier * c = getParentClassifier();
CodeGenPolicyExt *pe = UMLApp::app()->getPolicyExt();
CPPCodeGenerationPolicy * policy = dynamic_cast<CPPCodeGenerationPolicy*>(pe);
// first, set the global flag on whether or not to show classfield info
CodeClassFieldList * cfList = getCodeClassFieldList();
for(CodeClassField * field = cfList->first(); field; field = cfList->next())
field->setWriteOutMethods(policy->getAutoGenerateAccessors());
// attribute-based ClassFields
// we do it this way to have the static fields sorted out from regular ones
CodeClassFieldList staticPublicAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Public );
CodeClassFieldList publicAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Public );
CodeClassFieldList staticProtectedAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Protected );
CodeClassFieldList protectedAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Protected );
CodeClassFieldList staticPrivateAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Private );
CodeClassFieldList privateAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Private);
// association-based ClassFields
// don't care if they are static or not..all are lumped together
CodeClassFieldList publicPlainAssocClassFields = getSpecificClassFields ( CodeClassField::PlainAssociation , Uml::Visibility::Public);
CodeClassFieldList publicAggregationClassFields = getSpecificClassFields ( CodeClassField::Aggregation, Uml::Visibility::Public);
CodeClassFieldList publicCompositionClassFields = getSpecificClassFields ( CodeClassField::Composition, Uml::Visibility::Public );
CodeClassFieldList protPlainAssocClassFields = getSpecificClassFields ( CodeClassField::PlainAssociation , Uml::Visibility::Protected);
CodeClassFieldList protAggregationClassFields = getSpecificClassFields ( CodeClassField::Aggregation, Uml::Visibility::Protected);
CodeClassFieldList protCompositionClassFields = getSpecificClassFields ( CodeClassField::Composition, Uml::Visibility::Protected);
CodeClassFieldList privPlainAssocClassFields = getSpecificClassFields ( CodeClassField::PlainAssociation , Uml::Visibility::Private);
CodeClassFieldList privAggregationClassFields = getSpecificClassFields ( CodeClassField::Aggregation, Uml::Visibility::Private);
CodeClassFieldList privCompositionClassFields = getSpecificClassFields ( CodeClassField::Composition, Uml::Visibility::Private);
bool hasOperationMethods = c->getOpList().last() ? true : false;
bool hasNamespace = false;
bool isEnumeration = false;
bool isInterface = parentIsInterface();
bool hasclassFields = hasClassFields();
bool forcedoc = UMLApp::app()->getCommonPolicy()->getCodeVerboseDocumentComments();
QString endLine = UMLApp::app()->getCommonPolicy()->getNewLineEndingChars();
UMLClassifierList superclasses = c->findSuperClassConcepts();
// START GENERATING CODE/TEXT BLOCKS and COMMENTS FOR THE DOCUMENT
//
// Write the hash define stuff to prevent multiple parsing/inclusion of header
QString cppClassName = CodeGenerator::cleanName(c->getName());
QString hashDefine = CodeGenerator::cleanName(c->getName().upper().simplifyWhiteSpace());
QString defText = "#ifndef "+hashDefine + "_H"+ endLine + "#define "+ hashDefine + "_H";
addOrUpdateTaggedCodeBlockWithComments("hashDefBlock", defText, "", 0, false);
// INCLUDE CODEBLOCK
//
// Q: Why all utils? Isnt just List and Vector the only classes we are using?
// A: doesn't matter at all; its more readable to just include '*' and cpp compilers
// don't slow down or anything. (TZ)
QString includeStatement = "";
bool stringGlobal = policy->stringIncludeIsGlobal();
QString sStartBrak = stringGlobal ? "<" : "\"";
QString sEndBrak = stringGlobal ? ">" : "\"";
includeStatement.append("#include "+sStartBrak+policy->getStringClassNameInclude()+sEndBrak+endLine);
if ( hasObjectVectorClassFields() )
{
bool vecGlobal = policy->vectorIncludeIsGlobal();
QString vStartBrak = vecGlobal ? "<" : "\"";
QString vEndBrak = vecGlobal ? ">" : "\"";
QString value ="#include "+vStartBrak+policy->getVectorClassNameInclude()+vEndBrak;
includeStatement.append(value+endLine);
}
//only include classes in a different package from this class
UMLPackageList includes;
QMap<UMLPackage *,QString> packageMap; // so we don't repeat packages
CodeGenerator::findObjectsRelated(c,includes);
for(UMLPackage *con = includes.first(); con ; con = includes.next())
if (con->getBaseType() != Uml::ot_Datatype && !packageMap.contains(con))
{
packageMap.insert(con,con->getPackage());
if(con != getParentClassifier())
includeStatement.append("#include \""+CodeGenerator::cleanName(con->getName().lower())+".h\""+endLine);
}
// now, add/update the includes codeblock
CodeBlockWithComments * inclBlock = addOrUpdateTaggedCodeBlockWithComments("includes", includeStatement, QString::null, 0, false);
if(includeStatement.isEmpty() && inclBlock->getContentType() == CodeBlock::AutoGenerated)
inclBlock->setWriteOutText(false);
else
inclBlock->setWriteOutText(true);
//.........这里部分代码省略.........
示例8: updateContent
/**
* update the start and end text for this ownedhierarchicalcodeblock.
*/
void JavaClassDeclarationBlock::updateContent ( )
{
JavaClassifierCodeDocument *parentDoc = dynamic_cast<JavaClassifierCodeDocument*>(getParentDocument());
UMLClassifier *c = parentDoc->getParentClassifier();
CodeGenerationPolicy *commonPolicy = UMLApp::app()->getCommonPolicy();
QString endLine = commonPolicy->getNewLineEndingChars();
bool isInterface = parentDoc->parentIsInterface(); // a little shortcut
QString JavaClassName = parentDoc->getJavaClassName(c->getName());
// COMMENT
if(isInterface)
getComment()->setText("Interface "+JavaClassName+endLine+c->getDoc());
else
getComment()->setText("Class "+JavaClassName+endLine+c->getDoc());
bool forceDoc = UMLApp::app()->getCommonPolicy()->getCodeVerboseDocumentComments();
if(forceDoc || !c->getDoc().isEmpty())
getComment()->setWriteOutText(true);
else
getComment()->setWriteOutText(false);
// Now set START/ENDING Text
QString startText = "";
// In Java, we need declare abstract only on classes
if (c->getAbstract() && !isInterface)
startText.append("abstract ");
if (c->getVisibility() != Uml::Visibility::Public) {
// We should probably emit a warning in here .. java doesn't like to allow
// private/protected classes. The best we can do (I believe)
// is to let these declarations default to "package visibility"
// which is a level between traditional "private" and "protected"
// scopes. To get this visibility level we just print nothing..
} else
startText.append("public ");
if(parentDoc->parentIsInterface())
startText.append("interface ");
else
startText.append("class ");
startText.append(JavaClassName);
// write inheritances out
UMLClassifierList superclasses =
c->findSuperClassConcepts(UMLClassifier::CLASS);
UMLClassifierList superinterfaces =
c->findSuperClassConcepts(UMLClassifier::INTERFACE);
int nrof_superclasses = superclasses.count();
int nrof_superinterfaces = superinterfaces.count();
// write out inheritance
int i = 0;
if(nrof_superclasses >0)
startText.append(" extends ");
for (UMLClassifier * concept= superclasses.first(); concept; concept = superclasses.next())
{
startText.append(parentDoc->cleanName(concept->getName()));
if(i != (nrof_superclasses-1))
startText.append(", ");
i++;
}
// write out what we 'implement'
i = 0;
if(nrof_superinterfaces >0)
{
// In Java interfaces "extend" other interfaces. Classes "implement" interfaces
if(isInterface)
startText.append(" extends ");
else
startText.append(" implements ");
}
for (UMLClassifier * concept= superinterfaces.first(); concept; concept = superinterfaces.next())
{
startText.append(parentDoc->cleanName(concept->getName()));
if(i != (nrof_superinterfaces-1))
startText.append(", ");
i++;
}
// Set the header and end text for the hier.codeblock
setStartText(startText+" {");
// setEndText("}"); // not needed
}
示例9: addClassifier
void RefactoringAssistant::addClassifier( UMLClassifier *classifier, QListViewItem *parent, bool addSuper, bool addSub, bool recurse)
{
QListViewItem *classifierItem, *item;
if( parent )
{
classifierItem = parent;
}
else
{
classifierItem= new KListViewItem( this, classifier->getName() );
m_umlObjectMap[classifierItem] = classifier;
}
connect( classifier, SIGNAL( modified() ), this, SLOT( umlObjectModified() ) );
UMLClassifier *klass = dynamic_cast<UMLClassifier*>(classifier);
if( klass )
{// only Classes have attributes...
connect( classifier, SIGNAL(attributeAdded(UMLClassifierListItem*)),
this, SLOT(attributeAdded(UMLClassifierListItem*)));
connect( classifier, SIGNAL(attributeRemoved(UMLClassifierListItem*)),
this, SLOT(attributeRemoved(UMLClassifierListItem*)));
QListViewItem *attsFolder = new KListViewItem( classifierItem, i18n("Attributes"), "attributes" );
attsFolder->setPixmap(0,SmallIcon("folder_green_open"));
attsFolder->setExpandable( true );
UMLAttributeList atts = klass->getAttributeList();
for( UMLAttribute *att = atts.first(); att; att = atts.next() )
{
attributeAdded( att );
}
}
// add operations
connect( classifier, SIGNAL(operationAdded(UMLClassifierListItem*)),
this, SLOT(operationAdded(UMLClassifierListItem*)));
connect( classifier, SIGNAL(operationRemoved(UMLClassifierListItem*)),
this, SLOT(operationRemoved(UMLClassifierListItem*)));
QListViewItem *opsFolder = new KListViewItem( classifierItem, i18n("Operations"), "operations" );
opsFolder->setPixmap(0,SmallIcon("folder_blue_open"));
opsFolder->setExpandable( true );
UMLOperationList ops(classifier->getOpList());
for( UMLOperation *op = ops.first(); op ; op = ops.next() )
{
operationAdded( op );
}
//if add parents
if(addSuper)
{
QListViewItem *superFolder = new KListViewItem( classifierItem, i18n("Base Classifiers") );
superFolder->setExpandable( true );
UMLClassifierList super = classifier->findSuperClassConcepts();
for( UMLClassifier *cl = super.first(); cl ; cl = super.next() )
{
item = new KListViewItem( superFolder, cl->getName() );
item->setPixmap(0,m_pixmaps.Generalization);
item->setExpandable( true );
m_umlObjectMap[item] = cl;
if( recurse )
{
addClassifier( cl, item, true, false, true);
}
}
}
if(addSub)
{
//add derived classifiers
QListViewItem *derivedFolder = new KListViewItem( classifierItem, i18n("Derived Classifiers") );
derivedFolder->setExpandable( true );
UMLClassifierList derived = classifier->findSubClassConcepts();
for( UMLClassifier *d = derived.first(); d ; d = derived.next() )
{
item = new KListViewItem( derivedFolder, d->getName() );
item->setPixmap(0,m_pixmaps.Subclass);
item->setExpandable( true );
m_umlObjectMap[item] = d;
if( recurse )
{
addClassifier( d, item, false, true, true);
}
}
}
}