本文整理汇总了C++中UMLClassifierList类的典型用法代码示例。如果您正苦于以下问题:C++ UMLClassifierList类的具体用法?C++ UMLClassifierList怎么用?C++ UMLClassifierList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UMLClassifierList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: stream
void TclWriter::writeHeaderFile(UMLClassifier * c, QFile & fileh)
{
// open stream for writing
QTextStream stream(&fileh);
mStream = &stream;
// reset the indent level
m_indentLevel = 0;
// write header blurb
QString str = getHeadingFile(".tcl");
if (!str.isEmpty()) {
str.replace(QRegExp("%filename%"), fileName_);
str.replace(QRegExp("%filepath%"), fileh.fileName());
writeCode(str);
}
// set current namespace
writeCode("namespace eval " + mNamespace + " {");
m_indentLevel++;
// check on already existing
writeComm("Do not load twice");
writeCode("if {[namespace exist " + className_ + "]} return");
// source used superclass files
UMLClassifierList superclasses = c->getSuperClasses();
if (superclasses.count() > 0) {
writeComm
("Source found and used class files and import class command if necessary");
foreach (UMLClassifier * classifier , superclasses ) {
writeUse(classifier);
}
示例3: uDebug
/**
* Call this method to generate C++ code for a UMLClassifier.
* @param c the class you want to generate code for
*/
void PythonWriter::writeClass(UMLClassifier *c)
{
if (!c) {
uDebug() << "Cannot write class of NULL concept!";
return;
}
QString classname = cleanName(c->name());
UMLClassifierList superclasses = c->getSuperClasses();
UMLAssociationList aggregations = c->getAggregations();
UMLAssociationList compositions = c->getCompositions();
m_bNeedPass = true;
//find an appropriate name for our file
QString fileName = findFileName(c, QLatin1String(".py"));
if (fileName.isEmpty()) {
emit codeGenerated(c, false);
return;
}
QFile fileh;
if (!openFile(fileh, fileName)) {
emit codeGenerated(c, false);
return;
}
QTextStream h(&fileh);
//////////////////////////////
//Start generating the code!!
/////////////////////////////
//try to find a heading file (license, coments, etc)
QString str;
str = getHeadingFile(QLatin1String(".py"));
if (!str.isEmpty()) {
str.replace(QRegExp(QLatin1String("%filename%")), fileName);
str.replace(QRegExp(QLatin1String("%filepath%")), fileh.fileName());
h<<str<<m_endl;
}
h << "# coding=" << h.codec()->name() << m_endl;
// generate import statement for superclasses and take packages into account
str = cleanName(c->name());
QString pkg = cleanName(c->package());
if (!pkg.isEmpty())
str.prepend(pkg + QLatin1Char('.'));
QStringList includesList = QStringList(str); //save imported classes
int i = superclasses.count();
foreach (UMLClassifier *classifier, superclasses) {
str = cleanName(classifier->name());
pkg = cleanName(classifier->package());
if (!pkg.isEmpty())
str.prepend(pkg + QLatin1Char('.'));
includesList.append(str);
h << "from " << str << " import *" << m_endl;
i--;
}
示例4: opl
void CSharpWriter::writeOverridesRecursive(UMLClassifierList *superclasses, QTextStream &cs) {
// oplist for implemented abstract operations
UMLOperationList opabstract;
opabstract.setAutoDelete(false);
UMLClassifier *obj;
for (obj = superclasses->first(); obj; obj = superclasses->next()) {
if (!obj->isInterface() && obj->hasAbstractOps()) {
// collect abstract ops
UMLOperationList opl(obj->getOpList());
for (UMLOperation *op = opl.first(); op ; op = opl.next()) {
if (op->getAbstract()) {
opabstract.append(op);
}
}
// write abstract implementations
cs << m_endl << m_container_indent << m_indentation << "#region " << obj->getName() << " members" << m_endl << m_endl;
writeOperations(opabstract,cs,false,true,true);
cs << m_container_indent << m_indentation << "#endregion" << m_endl << m_endl;
opabstract.clear();
}
// Recurse to parent superclasses
UMLClassifierList superRecursive = obj->getSuperClasses();
UMLClassifierList *superRecursivePtr =& superRecursive;
if (superRecursivePtr->count() > 0) {
writeOverridesRecursive(superRecursivePtr, cs);
}
}
}
示例5: setCommitPage
/**
* Slot for the generate button. Starts the code generation.
*/
void CodeGenStatusPage::generateCode()
{
ui_pushButtonGenerate->setEnabled(false);
setCommitPage(true); //:TODO: disable back and cancel button ?
CodeGenerator* codeGenerator = UMLApp::app()->generator();
UMLDoc* doc = UMLApp::app()->document();
if (codeGenerator) {
connect(codeGenerator, SIGNAL(codeGenerated(UMLClassifier*,bool)),
this, SLOT(classGenerated(UMLClassifier*,bool)));
connect(codeGenerator, SIGNAL(showGeneratedFile(QString)),
this, SLOT(showFileGenerated(QString)));
UMLClassifierList cList;
for (int row = 0; row < ui_tableWidgetStatus->rowCount(); ++row) {
QTableWidgetItem* item = ui_tableWidgetStatus->item(row, 0);
UMLClassifier *concept = doc->findUMLClassifier(item->text());
if (concept == NULL) {
uError() << "Could not find classifier " << item->text()
<< " - not included in generated code.";
continue;
}
cList.append(concept);
}
codeGenerator->writeCodeToFile(cList);
m_generationDone = true;
setFinalPage(true);
emit completeChanged();
}
}
示例6: insertTypesSorted
/**
* Inserts @p type into the type-combobox as well as its completion object.
*/
void UMLEntityAttributeDialog::insertTypesSorted(const QString& type)
{
QStringList types;
// add the data types
UMLDoc * pDoc = UMLApp::app()->document();
UMLClassifierList dataTypes = pDoc->datatypes();
if (dataTypes.count() == 0) {
// Switch to SQL as the active language if no datatypes are set.
UMLApp::app()->setActiveLanguage(Uml::ProgrammingLanguage::SQL);
pDoc->addDefaultDatatypes();
qApp->processEvents();
dataTypes = pDoc->datatypes();
}
foreach (UMLClassifier* dat, dataTypes) {
types << dat->name();
}
// add the given parameter
if (!types.contains(type)) {
types << type;
}
types.sort();
m_pTypeCB->clear();
m_pTypeCB->insertItems(-1, types);
// select the given parameter
int currentIndex = m_pTypeCB->findText(type);
if (currentIndex > -1) {
m_pTypeCB->setCurrentIndex(currentIndex);
}
m_pTypeCB->completionObject()->addItem(type);
}
示例7: setTemplateParams
void UMLAttribute::setTemplateParams(const QString& templateParam, UMLClassifierList &templateParamList) {
if (templateParam.isEmpty())
return;
QString type = templateParam.simplifyWhiteSpace();
int start = type.find(QChar('<'));
if (start >= 0 ) {
int end = start;
int count = 1;
int len = type.length();
while (count != 0 && ++end < len) {
QChar c = type.at(end);
if (c == QChar('<')) {
count++;
}
if (c == QChar('>')) {
count--;
}
}
if (count != 0) {
//The template is ill-formated, let's quit
return;
}
setTemplateParams(type.mid(start + 1, end - start - 1), templateParamList);
setTemplateParams(type.left(start) + type.right(len - end - 1), templateParamList);
} else {
QStringList paramsList = QStringList::split(QChar(','), type);
for ( QStringList::Iterator it = paramsList.begin(); it != paramsList.end(); ++it ) {
QString param = *it;
if (!param.isEmpty()) {
UMLDoc *pDoc = UMLApp::app()->getDocument();
UMLObject* obj = pDoc->findUMLObject(param);
if (obj == NULL ) {
obj = pDoc->findUMLObject(param.remove(QChar(' ')));
}
if (obj != NULL ) {
//We want to list only the params that already exist in this document
//If the param doesnt't already exist, we couldn't draw an association anyway
UMLClassifier* tmpClassifier = static_cast<UMLClassifier*>(obj);
if (templateParamList.findRef(tmpClassifier) == -1) {
templateParamList.append(tmpClassifier);
}
}
}
}
}
}
示例8: return
bool PerlWriter::GetUseStatements(UMLClassifier *c, QString &Ret,
QString &ThisPkgName)
{
if (!c){
return(false);
}
UMLPackageList includes;
findObjectsRelated(c,includes);
QString AV = QChar('@');
QString SV = QChar('$');
QString HV = QChar('%');
foreach (UMLPackage* conc, includes ) {
if (conc->baseType() == Uml::ot_Datatype)
continue;
QString neatName = cleanName(conc->name());
if (neatName != AV && neatName != SV && neatName != HV) {
QString OtherPkgName = conc->package(".");
OtherPkgName.replace(QRegExp("\\."),"::");
QString OtherName = OtherPkgName + "::" + cleanName(conc->name());
// Only print out the use statement if the other package isn't the
// same as the one we are working on. (This happens for the
// "Singleton" design pattern.)
if (OtherName != ThisPkgName){
Ret += "use ";
Ret += OtherName;
Ret += ';';
Ret += m_endl;
}
}
}
UMLClassifierList superclasses = c->getSuperClasses();
if (superclasses.count()) {
Ret += m_endl;
Ret += "use base qw( ";
foreach (UMLClassifier *obj , superclasses ) {
QString packageName = obj->package(".");
packageName.replace(QRegExp("\\."),"::");
Ret += packageName + "::" + cleanName(obj->name()) + ' ';
}
示例9: 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;
}
示例10: uError
/**
* Shows an operation dialog box.
*
* @param enableAutoIncrement Enable auto increment checkbox
*/
void FloatingTextWidget::showOperationDialog(bool enableAutoIncrement)
{
if (!m_linkWidget) {
uError() << "m_linkWidget is NULL";
return;
}
QString seqNum = m_linkWidget->sequenceNumber();
UMLClassifier* c = m_linkWidget->lwClassifier();
QString opText = m_linkWidget->lwOperationText();
if (!c) {
uError() << "m_linkWidget->lwClassifier() returns a NULL classifier";
return;
}
QPointer<SelectOperationDialog> selectDialog = new SelectOperationDialog(m_scene->activeView(), c, enableAutoIncrement);
if (enableAutoIncrement && m_scene->autoIncrementSequence()) {
seqNum = m_scene->autoIncrementSequenceValue();
selectDialog->setAutoIncrementSequence(true);
}
selectDialog->setSeqNumber(seqNum);
if (m_linkWidget->operation() == 0) {
selectDialog->setCustomOp(opText);
} else {
selectDialog->setClassOp(opText);
}
if (selectDialog->exec()) {
seqNum = selectDialog->getSeqNumber();
opText = selectDialog->getOpText();
if (selectDialog->isClassOp()) {
Model_Utils::OpDescriptor od;
Model_Utils::Parse_Status st = Model_Utils::parseOperation(opText, od, c);
if (st == Model_Utils::PS_OK) {
UMLClassifierList selfAndAncestors = c->findSuperClassConcepts();
selfAndAncestors.prepend(c);
UMLOperation *op = 0;
foreach (UMLClassifier *cl, selfAndAncestors) {
op = cl->findOperation(od.m_name, od.m_args);
if (op) {
break;
}
}
示例11: 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);
}
示例12: 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);
}
示例13: findAssocClassifierObjsInRoles
UMLClassifierList ClassifierInfo::findAssocClassifierObjsInRoles (UMLAssociationList * list)
{
UMLClassifierList classifiers;
for (UMLAssociation *a = list->first(); a; a = list->next()) {
// DONT accept a classifier IF the association role is empty, by
// convention, that means to ignore the classifier on that end of
// the association.
// We also ignore classifiers which are the same as the current one
// (e.g. id matches), we only want the "other" classifiers
if (a->getObjectId(Uml::A) == classifier_->getID() && !a->getRoleName(Uml::B).isEmpty()) {
UMLClassifier *c = dynamic_cast<UMLClassifier*>(a->getObject(Uml::B));
if(c)
classifiers.append(c);
} else if (a->getObjectId(Uml::B) == classifier_->getID() && !a->getRoleName(Uml::A).isEmpty()) {
UMLClassifier *c = dynamic_cast<UMLClassifier*>(a->getObject(Uml::A));
if(c)
classifiers.append(c);
}
}
return classifiers;
}
示例14: writeComplexTypeClassifierDecl
void XMLSchemaWriter::writeComplexTypeClassifierDecl (UMLClassifier *c,
UMLAssociationList associations,
UMLAssociationList aggregations,
UMLAssociationList compositions,
UMLClassifierList superclasses,
QTextStream &XMLschema)
{
// Preparations
//
// sort attributes by Scope
UMLAttributeList attribs = findAttributes(c);
QStringList attribGroups = findAttributeGroups(c);
// test for relevant associations
bool hasAssociations = determineIfHasChildNodes(c);
bool hasSuperclass = superclasses.count()> 0;
bool hasAttributes = attribs.count() > 0 || attribGroups.count() > 0;
// START WRITING
// start body of element
QString elementTypeName = getElementTypeName(c);
XMLschema<<getIndent()<<"<"<<makeSchemaTag("complexType")<<" name=\""<<elementTypeName<<"\"";
if(hasAssociations || hasAttributes || hasSuperclass)
{
XMLschema<<">"<<m_endl;
m_indentLevel++;
if(hasSuperclass)
{
QString superClassName = getElementTypeName(superclasses.first());
XMLschema<<getIndent()<<"<"<<makeSchemaTag("complexContent")<<">"<<m_endl;
//PROBLEM: we only treat ONE superclass for inheritence.. bah.
m_indentLevel++;
XMLschema<<getIndent()<<"<"<<makeSchemaTag("extension")<<" base=\""<<makePackageTag(superClassName)
<<"\"";
if(hasAssociations || hasAttributes )
XMLschema<<">"<<m_endl;
else
XMLschema<<"/>"<<m_endl;
m_indentLevel++;
}
if(hasAssociations)
{
// Child Elements (from most associations)
//
bool didFirstOne = false;
didFirstOne = writeAssociationDecls(associations, true, didFirstOne, c->getID(), XMLschema);
didFirstOne = writeAssociationDecls(aggregations, false, didFirstOne, c->getID(), XMLschema);
didFirstOne = writeAssociationDecls(compositions, false, didFirstOne, c->getID(), XMLschema);
if (didFirstOne) {
m_indentLevel--;
XMLschema<<getIndent()<<"</"<<makeSchemaTag("sequence")<<">"<<m_endl;
}
}
// ATTRIBUTES
//
if(hasAttributes)
{
writeAttributeDecls(attribs, XMLschema);
for(uint i= 0; i < attribGroups.count(); i++)
XMLschema<<getIndent()<<"<"<<makeSchemaTag("attributeGroup")<<" ref=\""
<<makePackageTag(attribGroups[i])<<"\"/>"<<m_endl;
}
if(hasSuperclass)
{
m_indentLevel--;
if(hasAssociations || hasAttributes )
XMLschema<<getIndent()<<"</"<<makeSchemaTag("extension")<<">"<<m_endl;
m_indentLevel--;
XMLschema<<getIndent()<<"</"<<makeSchemaTag("complexContent")<<">"<<m_endl;
}
// close this element decl
m_indentLevel--;
XMLschema<<getIndent()<<"</"<<makeSchemaTag("complexType")<<">"<<m_endl;
} else
XMLschema<<"/>"<<m_endl; // empty node. just close this element decl
}
示例15: getComment
/**
* update the start and end text for this hierarchicalcodeblock.
*/
void CPPHeaderClassDeclarationBlock::updateContent ()
{
CPPHeaderCodeDocument *parentDoc = dynamic_cast<CPPHeaderCodeDocument*>(getParentDocument());
UMLClassifier *c = parentDoc->getParentClassifier();
QString endLine = UMLApp::app()->commonPolicy()->getNewLineEndingChars();
bool isInterface = parentDoc->parentIsInterface(); // a little shortcut
QString CPPHeaderClassName = CodeGenerator::cleanName(c->name());
bool forceDoc = UMLApp::app()->commonPolicy()->getCodeVerboseDocumentComments();
// COMMENT
//check if class is abstract.. it should have abstract methods
if(!isInterface && c->isAbstract() && !c->hasAbstractOps())
{
getComment()->setText(QLatin1String("******************************* Abstract Class ****************************") + endLine
+ CPPHeaderClassName + QLatin1String(" does not have any pure virtual methods, but its author") + endLine
+ QLatin1String(" defined it as an abstract class, so you should not use it directly.") + endLine
+ QLatin1String(" Inherit from it instead and create only objects from the derived classes") + endLine
+ QLatin1String("*****************************************************************************"));
} else {
if(isInterface)
getComment()->setText(QLatin1String("Interface ") + CPPHeaderClassName + endLine + c->doc());
else
getComment()->setText(QLatin1String("Class ") + CPPHeaderClassName + endLine + c->doc());
}
if(forceDoc || !c->doc().isEmpty())
getComment()->setWriteOutText(true);
else
getComment()->setWriteOutText(false);
// Now set START/ENDING Text
QString startText;
/*
*/
/*
if(parentDoc->parentIsInterface())
startText.append(QLatin1String("interface "));
else
*/
startText.append(QLatin1String("class "));
startText.append(CPPHeaderClassName);
// write inheritances out
UMLClassifierList superclasses = c->findSuperClassConcepts();
int nrof_superclasses = superclasses.count();
// write out inheritance
int i = 0;
if(nrof_superclasses >0)
startText.append(QLatin1String(" : "));
foreach (UMLClassifier* concept, superclasses) {
startText.append(Uml::Visibility::toString(concept->visibility()) + QLatin1Char(' ') +
CodeGenerator::cleanName(concept->name()));
if(i != (nrof_superclasses-1))
startText.append(QLatin1String(", "));
i++;
}