本文整理汇总了C++中UMLDoc类的典型用法代码示例。如果您正苦于以下问题:C++ UMLDoc类的具体用法?C++ UMLDoc怎么用?C++ UMLDoc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UMLDoc类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: kWarning
bool UMLClipboard::pasteChildren(UMLListViewItem *parent, IDChangeLog *chgLog) {
if (!parent) {
kWarning() << "Paste Children Error, parent missing" << endl;
return false;
}
UMLDoc *doc = UMLApp::app()->getDocument();
UMLListView *listView = UMLApp::app()->getListView();
UMLListViewItem *childItem = static_cast<UMLListViewItem*>(parent->firstChild());
while (childItem) {
Uml::IDType oldID = childItem->getID();
Uml::IDType newID = chgLog->findNewID(oldID);
UMLListViewItem *shouldNotExist = listView->findItem(newID);
if (shouldNotExist) {
kError() << "UMLClipboard::pasteChildren: new list view item " << ID2STR(newID)
<< " already exists (internal error)" << endl;
childItem = static_cast<UMLListViewItem*>(childItem->nextSibling());
continue;
}
UMLObject *newObj = doc->findObjectById(newID);
if (newObj) {
kDebug() << "UMLClipboard::pasteChildren: adjusting lvitem(" << ID2STR(oldID)
<< ") to new UMLObject(" << ID2STR(newID) << ")" << endl;
childItem->setUMLObject(newObj);
childItem->setText(newObj->getName());
} else {
kDebug() << "UMLClipboard::pasteChildren: no UMLObject found for lvitem "
<< ID2STR(newID) << endl;
}
childItem = static_cast<UMLListViewItem*>(childItem->nextSibling());
}
return true;
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:32,代码来源:umlclipboard.cpp
示例2: paste
bool UMLClipboard::paste(QMimeSource* data) {
UMLDoc *doc = UMLApp::app()->getDocument();
bool result = false;
doc->beginPaste();
switch(UMLDrag::getCodingType(data)) {
case 1:
result = pasteClip1(data);
break;
case 2:
result = pasteClip2(data);
break;
case 3:
result = pasteClip3(data);
break;
case 4:
result = pasteClip4(data);
break;
case 5:
result = pasteClip5(data);
break;
default:
break;
}
doc->endPaste();
return result;
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:26,代码来源:umlclipboard.cpp
示例3: 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);
}
开发者ID:Nephos,项目名称:umbrello,代码行数:35,代码来源:umlentityattributedialog.cpp
示例4: it
/** If clipboard has mime type application/x-uml-clip3,
Pastes the data from the clipboard into the current Doc */
bool UMLClipboard::pasteClip3(QMimeSource* data) {
UMLDoc *doc = UMLApp::app()->getDocument();
UMLListViewItemList itemdatalist;
UMLListViewItem* item = 0;
UMLListViewItem* itemdata = 0;
IDChangeLog* idchanges = doc->getChangeLog();
if(!idchanges) {
return false;
}
UMLListView *listView = UMLApp::app()->getListView();
bool result = UMLDrag::decodeClip3(data, itemdatalist, listView);
if(!result) {
return false;
}
UMLListViewItemListIt it(itemdatalist);
while ( (itemdata=it.current()) != 0 ) {
item = listView->createItem(*itemdata, *idchanges);
if(itemdata -> childCount()) {
if(!pasteChildren(item, idchanges)) {
return false;
}
}
++it;
}
return result;
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:31,代码来源:umlclipboard.cpp
示例5: loadStereotype
/**
* Analyzes the given QDomElement for a reference to a stereotype.
*
* @param element QDomElement to analyze.
* @return True if a stereotype reference was found, else false.
*/
bool UMLObject::loadStereotype(QDomElement & element)
{
QString tag = element.tagName();
if (!UMLDoc::tagEq(tag, QLatin1String("stereotype")))
return false;
QString stereo = element.attribute(QLatin1String("xmi.value"));
if (stereo.isEmpty() && element.hasChildNodes()) {
/* like so:
<UML:ModelElement.stereotype>
<UML:Stereotype xmi.idref = '07CD'/>
</UML:ModelElement.stereotype>
*/
QDomNode stereoNode = element.firstChild();
QDomElement stereoElem = stereoNode.toElement();
tag = stereoElem.tagName();
if (UMLDoc::tagEq(tag, QLatin1String("Stereotype"))) {
stereo = stereoElem.attribute(QLatin1String("xmi.idref"));
}
}
if (stereo.isEmpty())
return false;
Uml::ID::Type stereoID = Uml::ID::fromString(stereo);
UMLDoc *pDoc = UMLApp::app()->document();
m_pStereotype = pDoc->findStereotypeById(stereoID);
if (m_pStereotype)
m_pStereotype->incrRefCount();
else
m_SecondaryId = stereo; // leave it to resolveRef()
return true;
}
开发者ID:evaldobarbosa,项目名称:umbrello,代码行数:36,代码来源:umlobject.cpp
示例6: 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();
}
}
开发者ID:behlingc,项目名称:umbrello-behlingc,代码行数:36,代码来源:codegenstatuspage.cpp
示例7: insertTypesSorted
/**
* Inserts @p type into the type-combobox.
* The combobox is cleared and all types together with the optional new one
* sorted and then added again.
* @param type a new type to add and selected
*/
void UMLTemplateDialog::insertTypesSorted(const QString& type)
{
QStringList types;
// "class" is the nominal type of template parameter
types << "class";
// add the active data types to combo box
UMLDoc *pDoc = UMLApp::app()->document();
UMLClassifierList namesList( pDoc->concepts() );
foreach (UMLClassifier* obj, namesList) {
types << obj->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);
}
}
开发者ID:Elv13,项目名称:Umbrello-ng,代码行数:32,代码来源:umltemplatedialog.cpp
示例8: checkItemForCopyType
void UMLClipboard::checkItemForCopyType(UMLListViewItem* Item, bool & WithDiagrams, bool &WithObjects,
bool &OnlyAttsOps) {
if(!Item) {
return;
}
UMLDoc *doc = UMLApp::app()->getDocument();
OnlyAttsOps = true;
UMLView * view = 0;
UMLListViewItem * child = 0;
Uml::ListView_Type type = Item->getType();
if ( Model_Utils::typeIsCanvasWidget(type) ) {
WithObjects = true;
OnlyAttsOps = false;
} else if ( Model_Utils::typeIsDiagram(type) ) {
WithDiagrams = true;
OnlyAttsOps = false;
view = doc->findView( Item->getID() );
m_ViewList.append( view );
} else if ( Model_Utils::typeIsFolder(type) ) {
OnlyAttsOps = false;
if(Item->childCount()) {
child = (UMLListViewItem*)Item->firstChild();
while(child) {
checkItemForCopyType(child, WithDiagrams, WithObjects, OnlyAttsOps);
child = (UMLListViewItem*)child->nextSibling();
}
}
}
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:29,代码来源:umlclipboard.cpp
示例9: xsltFileName
void Docbook2XhtmlGeneratorJob::run()
{
UMLDoc* umlDoc = UMLApp::app()->document();
xsltStylesheetPtr cur = NULL;
xmlDocPtr doc, res;
const char *params[16 + 1];
int nbparams = 0;
params[nbparams] = NULL;
umlDoc->writeToStatusBar(i18n("Exporting to XHTML..."));
QString xsltFileName(KGlobal::dirs()->findResource("appdata", QLatin1String("docbook2xhtml.xsl")));
uDebug() << "XSLT file is'" << xsltFileName << "'";
QFile xsltFile(xsltFileName);
xsltFile.open(QIODevice::ReadOnly);
QString xslt = QString::fromLatin1(xsltFile.readAll());
uDebug() << "XSLT is'" << xslt << "'";
xsltFile.close();
QString localXsl = KGlobal::dirs()->findResource("data", QLatin1String("ksgmltools2/docbook/xsl/html/docbook.xsl"));
uDebug() << "Local xsl is'" << localXsl << "'";
if (!localXsl.isEmpty())
{
localXsl = QLatin1String("href=\"file://") + localXsl + QLatin1String("\"");
xslt.replace(QRegExp(QLatin1String("href=\"http://[^\"]*\"")), localXsl);
}
KTemporaryFile tmpXsl;
tmpXsl.setAutoRemove(false);
tmpXsl.open();
QTextStream str (&tmpXsl);
str << xslt;
str.flush();
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
uDebug() << "Parsing stylesheet " << tmpXsl.fileName();
cur = xsltParseStylesheetFile((const xmlChar *)tmpXsl.fileName().toLatin1().constData());
uDebug() << "Parsing file " << m_docbookUrl.path();
doc = xmlParseFile((const char*)(m_docbookUrl.path().toUtf8()));
uDebug() << "Applying stylesheet ";
res = xsltApplyStylesheet(cur, doc, params);
KTemporaryFile tmpXhtml;
tmpXhtml.setAutoRemove(false);
tmpXhtml.open();
uDebug() << "Writing HTML result to temp file: " << tmpXhtml.fileName();
xsltSaveResultToFd(tmpXhtml.handle(), res, cur);
xsltFreeStylesheet(cur);
xmlFreeDoc(res);
xmlFreeDoc(doc);
xsltCleanupGlobals();
xmlCleanupParser();
emit xhtmlGenerated(tmpXhtml.fileName());
}
开发者ID:behlingc,项目名称:umbrello-behlingc,代码行数:59,代码来源:docbook2xhtmlgeneratorjob.cpp
示例10: doMouseDoubleClick
void NoteWidgetController::doMouseDoubleClick(QMouseEvent *me) {
//TODO Copied from old code. What it does?
if (m_noteWidget->m_DiagramLink == Uml::id_None) {
m_noteWidget->slotMenuSelection(ListPopupMenu::mt_Rename);
} else {
UMLDoc *umldoc = UMLApp::app()->getDocument();
umldoc->changeCurrentView(m_noteWidget->m_DiagramLink);
}
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:9,代码来源:notewidgetcontroller.cpp
示例11: createCppStereotypes
/**
* Add C++ stereotypes.
*/
void createCppStereotypes()
{
UMLDoc *umldoc = UMLApp::app()->document();
umldoc->findOrCreateStereotype("constructor");
// declares an operation as friend
umldoc->findOrCreateStereotype("friend");
// to use in methods that aren't abstract
umldoc->findOrCreateStereotype("virtual");
}
开发者ID:Elv13,项目名称:Umbrello-ng,代码行数:12,代码来源:codegen_utils.cpp
示例12: object
UMLObject* CmdBaseObjectCommand::object()
{
UMLDoc *doc = UMLApp::app()->document();
UMLObject *umlObject = doc->findObjectById(m_objectId);
if (!umlObject)
umlObject = m_object;
return umlObject;
}
开发者ID:Salmista-94,项目名称:umbrello,代码行数:10,代码来源:cmd_baseObjectCommand.cpp
示例13: setUMLStereotype
void UMLObject::setStereotypeCmd(const QString& name)
{
if (name.isEmpty()) {
setUMLStereotype(NULL);
return;
}
UMLDoc *pDoc = UMLApp::app()->document();
UMLStereotype *s = pDoc->findOrCreateStereotype(name);
setUMLStereotype(s);
}
开发者ID:evaldobarbosa,项目名称:umbrello,代码行数:10,代码来源:umlobject.cpp
示例14: maybeSignalObjectCreated
/**
* Calls UMLDoc::signalUMLObjectCreated() if m_BaseType affords
* doing so.
*/
void UMLObject::maybeSignalObjectCreated()
{
if (!m_bCreationWasSignalled &&
m_BaseType != ot_Stereotype &&
m_BaseType != ot_Association &&
m_BaseType != ot_Role) {
m_bCreationWasSignalled = true;
UMLDoc* umldoc = UMLApp::app()->document();
umldoc->signalUMLObjectCreated(this);
}
}
开发者ID:evaldobarbosa,项目名称:umbrello,代码行数:15,代码来源:umlobject.cpp
示例15: object_it
/** If clipboard has mime type application/x-uml-clip2,
Pastes the data from the clipboard into the current Doc */
bool UMLClipboard::pasteClip2(QMimeSource* data) {
UMLDoc *doc = UMLApp::app()->getDocument();
UMLListViewItemList itemdatalist;
UMLObjectList objects;
objects.setAutoDelete(false);
UMLViewList views;
IDChangeLog* idchanges = 0;
bool result = UMLDrag::decodeClip2(data, objects, itemdatalist, views);
if(!result) {
return false;
}
UMLObject *obj = 0;
UMLObjectListIt object_it(objects);
idchanges = doc->getChangeLog();
if(!idchanges) {
return false;
}
while ( (obj=object_it.current()) != 0 ) {
++object_it;
if(!doc->assignNewIDs(obj)) {
kDebug()<<"UMLClipboard: error adding umlobject"<<endl;
return false;
}
}
UMLView * pView = 0;
UMLViewListIt view_it( views );
while ( ( pView =view_it.current()) != 0 ) {
++view_it;
if( !doc->addUMLView( pView ) ) {
return false;
}
}
UMLListView *listView = UMLApp::app()->getListView();
UMLListViewItem* item = 0;
UMLListViewItem* itemdata = 0;
UMLListViewItemListIt it(itemdatalist);
while ( (itemdata=it.current()) != 0 ) {
item = listView->createItem(*itemdata, *idchanges);
if(!item) {
return false;
}
if(itemdata -> childCount()) {
if(!pasteChildren(item, idchanges)) {
return false;
}
}
++it;
}
return result;
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:56,代码来源:umlclipboard.cpp
示例16: setUMLStereotype
/**
* Sets the classes stereotype name.
* Internally uses setUMLStereotype().
*
* @param _name Sets the classes stereotype name.
*/
void UMLObject::setStereotype(const QString &_name)
{
// UMLDoc* pDoc = UMLApp::app()->document();
// pDoc->executeCommand(new cmdSetStereotype(this,_name));
if (_name.isEmpty()) {
setUMLStereotype(NULL);
return;
}
UMLDoc *pDoc = UMLApp::app()->document();
UMLStereotype *s = pDoc->findOrCreateStereotype(_name);
setUMLStereotype(s);
}
开发者ID:jpleclerc,项目名称:Umbrello-ng2,代码行数:18,代码来源:umlobject.cpp
示例17: setDiagramLink
/**
* Set the ID of the diagram hyperlinked to this note.
* To switch off the hyperlink, set this to Uml::id_None.
*
* @param viewID ID of an UMLScene.
*/
void NoteWidget::setDiagramLink(Uml::ID::Type viewID)
{
UMLDoc *umldoc = UMLApp::app()->document();
UMLView *view = umldoc->findView(viewID);
if (view == NULL) {
uError() << "no view found for viewID " << Uml::ID::toString(viewID);
return;
}
QString linkText(QLatin1String("Diagram: ") + view->umlScene()->name());
setDocumentation(linkText);
m_diagramLink = viewID;
update();
}
开发者ID:behlingc,项目名称:umbrello-behlingc,代码行数:19,代码来源:notewidget.cpp
示例18: initialize
/**
* Import files.
* @param fileNames List of files to import.
*/
bool ClassImport::importFiles(const QStringList& fileNames)
{
initialize();
UMLDoc *umldoc = UMLApp::app()->document();
uint processedFilesCount = 0;
bool result = true;
umldoc->setLoading(true);
foreach (const QString& fileName, fileNames) {
umldoc->writeToStatusBar(i18n("Importing file: %1 Progress: %2/%3",
fileName, processedFilesCount, fileNames.size()));
if (!importFile(fileName))
result = false;
processedFilesCount++;
}
开发者ID:Nephos,项目名称:umbrello,代码行数:18,代码来源:classimport.cpp
示例19: uniqChildName
/**
* Creates a Unique Constraint for this Entity.
* @param name an optional name
* @return the UniqueConstraint created
*/
UMLUniqueConstraint* UMLEntity::createUniqueConstraint(const QString &name )
{
Uml::IDType id = UniqueID::gen();
QString currentName;
if (name.isNull()) {
/**
* @todo check parameter
*/
currentName = uniqChildName(UMLObject::ot_UniqueConstraint);
} else {
currentName = name;
}
UMLUniqueConstraint* newUniqueConstraint = new UMLUniqueConstraint(this, currentName, id);
int button = KDialog::Accepted;
bool goodName = false;
//check for name.isNull() stops dialog being shown
//when creating attribute via list view
while (button == KDialog::Accepted && !goodName && name.isNull()) {
QPointer<UMLUniqueConstraintDialog> dialog = new UMLUniqueConstraintDialog(0, newUniqueConstraint);
button = dialog->exec();
QString name = newUniqueConstraint->name();
if (name.length() == 0) {
KMessageBox::error(0, i18n("That is an invalid name."), i18n("Invalid Name"));
} else if ( findChildObject(name) != NULL ) {
KMessageBox::error(0, i18n("That name is already being used."), i18n("Not a Unique Name"));
} else {
goodName = true;
}
delete dialog;
}
if (button != KDialog::Accepted) {
delete newUniqueConstraint;
return NULL;
}
addConstraint(newUniqueConstraint);
UMLDoc *umldoc = UMLApp::app()->document();
umldoc->signalUMLObjectCreated(newUniqueConstraint);
emitModified();
return newUniqueConstraint;
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:53,代码来源:entity.cpp
示例20: redo
// Create the UMLObject
void CmdCreateUMLObject::redo()
{
// This object was removed from it's package when it was deleted
// so add it back to it's package ( if it belonged to one )
UMLPackage *pkg = m_obj->umlPackage();
if (pkg) {
// add this object to its parent package
pkg->addObject(m_obj);
} else {
// object does not belong to any package
}
UMLDoc *doc = UMLApp::app()->document();
doc->signalUMLObjectCreated(m_obj);
}
开发者ID:jpleclerc,项目名称:Umbrello-ng2,代码行数:17,代码来源:cmd_createUMLObject.cpp
注:本文中的UMLDoc类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论