umbrello API Documentation

Import_Utils Namespace Reference

Utilities for code import. More...


Functions

void putAtGlobalScope (bool yesno)
 Control whether an object which is newly created by createUMLObject() is put at the global scope.
void setRelatedClassifier (UMLClassifier *c)
 Set a related classifier for creation of dependencies on template parameters in createUMLObject().
void assignUniqueIdOnCreation (bool yesno)
 Control whether the creation methods solicit a new unique ID for the created object.
bool newUMLObjectWasCreated ()
 Returns whether the last createUMLObject() actually created a new object or just returned an existing one.
QString formatComment (const QString &comment)
 Strip comment lines of leading whitespace and stars.
UMLObjectcreateUMLObject (Uml::Object_Type type, const QString &inName, UMLPackage *parentPkg, const QString &comment, const QString &stereotype)
 Find or create a document object.
UMLOperationmakeOperation (UMLClassifier *parent, const QString &name)
 Create a UMLOperation.
UMLObjectinsertAttribute (UMLClassifier *owner, Uml::Visibility scope, const QString &name, UMLClassifier *attrType, const QString &comment, bool isStatic)
 Create a UMLAttribute and insert it into the document.
UMLObjectinsertAttribute (UMLClassifier *owner, Uml::Visibility scope, const QString &name, const QString &type, const QString &comment, bool isStatic)
 Create a UMLAttribute and insert it into the document.
void insertMethod (UMLClassifier *klass, UMLOperation *&op, Uml::Visibility scope, const QString &type, bool isStatic, bool isAbstract, bool isFriend, bool isConstructor, const QString &comment)
 Insert the UMLOperation into the given classifier.
UMLAttributeaddMethodParameter (UMLOperation *method, const QString &type, const QString &name)
 Add an argument to a UMLOperation.
void addEnumLiteral (UMLEnum *enumType, const QString &literal, const QString &comment)
 Add an enum literal to an UMLEnum.
void createGeneralization (UMLClassifier *child, UMLClassifier *parent)
 Create a generalization from the given child classifier to the given parent classifier.
void createGeneralization (UMLClassifier *child, const QString &parentName)
 Create a generalization from the existing child UMLObject to the given parent class name.
QStringList includePathList ()
 Return the list of paths set by previous calls to addIncludePath() and the environment variable UMBRELLO_INCPATH.
void addIncludePath (const QString &path)
 Add a path to the include path list.
bool isDatatype (const QString &name, UMLPackage *parentPkg)
 Returns true if a type is an actual Datatype.

Variables

bool bNewUMLObjectWasCreated = false
 Flag manipulated by createUMLObject().
UMLClassifiergRelatedClassifier = NULL
 Related classifier for creation of dependencies on template parameters in createUMLObject().
bool bPutAtGlobalScope = false
 On encountering a scoped typename string where the scopes have not yet been seen, we synthesize UML objects for the unknown scopes (using a question dialog to the user to decide whether to treat a scope as a class or as a package.) However, such an unknown scope is put at the global level.
QStringList incPathList
 The include path list (see addIncludePath() and includePathList()).


Detailed Description

Utilities for code import.

Author:
Oliver Kellogg Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org


Function Documentation

void Import_Utils::putAtGlobalScope bool  yesno  ) 
 

Control whether an object which is newly created by createUMLObject() is put at the global scope.

Parameters:
yesno When set to false, the object is created at the scope given by the parentPkg argument of createUMLObject().

Definition at line 69 of file import_utils.cpp.

References bPutAtGlobalScope.

void Import_Utils::setRelatedClassifier UMLClassifier c  ) 
 

Set a related classifier for creation of dependencies on template parameters in createUMLObject().

Definition at line 73 of file import_utils.cpp.

References gRelatedClassifier.

Referenced by UMLAttributeDialog::apply().

void Import_Utils::assignUniqueIdOnCreation bool  yesno  ) 
 

Control whether the creation methods solicit a new unique ID for the created object.

By default, unique ID generation is turned on.

Parameters:
yesno False turns UID generation off, true turns it on.

Definition at line 77 of file import_utils.cpp.

Referenced by Import_Rose::petalTree2Uml().

bool Import_Utils::newUMLObjectWasCreated  ) 
 

Returns whether the last createUMLObject() actually created a new object or just returned an existing one.

Definition at line 81 of file import_utils.cpp.

References bNewUMLObjectWasCreated.

QString Import_Utils::formatComment const QString &  comment  ) 
 

Strip comment lines of leading whitespace and stars.

Definition at line 85 of file import_utils.cpp.

Referenced by createUMLObject(), insertAttribute(), and insertMethod().

UMLObject * Import_Utils::createUMLObject Uml::Object_Type  type,
const QString &  name,
UMLPackage parentPkg = NULL,
const QString &  comment = QString::null,
const QString &  stereotype = QString::null
 

Find or create a document object.

Definition at line 127 of file import_utils.cpp.

References UMLDoc::addAssociation(), bNewUMLObjectWasCreated, bPutAtGlobalScope, UMLDoc::findAssociation(), UMLListView::findUMLObject(), UMLDoc::findUMLObject(), formatComment(), UMLApp::getActiveLanguage(), UMLObject::getBaseType(), UMLDoc::getDatatypeFolder(), UMLApp::getDocument(), UMLApp::getListView(), UMLDoc::getRootFolder(), UMLObject::getUMLPackage(), gRelatedClassifier, UMLPackage::removeObject(), UMLObject::setDoc(), UMLClassifier::setIsReference(), UMLClassifier::setOriginType(), UMLObject::setStereotype(), and UMLObject::setUMLPackage().

Referenced by addMethodParameter(), UMLAttributeDialog::apply(), createGeneralization(), insertAttribute(), insertMethod(), PythonImport::parseStmt(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), AdaImport::parseStmt(), JavaImport::resolveClass(), UMLObject::resolveRef(), UMLObject::setPackage(), and Import_Rose::umbrellify().

UMLOperation * Import_Utils::makeOperation UMLClassifier parent,
const QString &  name
 

Create a UMLOperation.

The reason for this method is to not generate any Qt signals. Instead, these are generated by insertMethod(). (If we generated a creation signal prematurely, i.e. without the method parameters being known yet, then that would lead to a conflict with a pre-existing parameterless method of the same name.)

Definition at line 277 of file import_utils.cpp.

Referenced by PythonImport::parseStmt(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), and AdaImport::parseStmt().

UMLObject * Import_Utils::insertAttribute UMLClassifier klass,
Uml::Visibility  scope,
const QString &  name,
UMLClassifier attrType,
const QString &  comment,
bool  isStatic
 

Create a UMLAttribute and insert it into the document.

Use the specified existing attrType.

Definition at line 282 of file import_utils.cpp.

References formatComment(), UMLApp::getActiveLanguage(), UMLObject::getBaseType(), UMLApp::getDocument(), UMLObject::setDoc(), UMLDoc::setModified(), and UMLObject::setStatic().

Referenced by insertAttribute(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), and AdaImport::parseStmt().

UMLObject * Import_Utils::insertAttribute UMLClassifier klass,
Uml::Visibility  scope,
const QString &  name,
const QString &  type,
const QString &  comment = QString::null,
bool  isStatic = false
 

Create a UMLAttribute and insert it into the document.

Definition at line 311 of file import_utils.cpp.

References bPutAtGlobalScope, createUMLObject(), gRelatedClassifier, and insertAttribute().

void Import_Utils::insertMethod UMLClassifier klass,
UMLOperation *&  op,
Uml::Visibility  scope,
const QString &  type,
bool  isStatic,
bool  isAbstract,
bool  isFriend = false,
bool  isConstructor = false,
const QString &  comment = QString::null
 

Insert the UMLOperation into the given classifier.

Parameters:
klass The classifier into which the operation shall be added.
op Reference to pointer to the temporary UMLOperation for insertion. The caller relinquishes ownership of the object pointed to. If an UMLOperation of same signature already exists at the classifier then the incoming UMLOperation is deleted and the pointer is set to the existing UMLOperation.

Definition at line 329 of file import_utils.cpp.

References bPutAtGlobalScope, UMLClassifier::checkOperationSignature(), createUMLObject(), formatComment(), UMLObject::getAbstract(), UMLObject::getDoc(), UMLAttribute::getInitialValue(), UMLObject::getName(), UMLAttribute::getParmKind(), UMLOperation::getParmList(), UMLObject::getStatic(), UMLObject::getVisibility(), gRelatedClassifier, UMLObject::setAbstract(), UMLObject::setDoc(), UMLObject::setStatic(), UMLObject::setStereotype(), and UMLObject::setVisibility().

Referenced by PythonImport::parseStmt(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), and AdaImport::parseStmt().

UMLAttribute * Import_Utils::addMethodParameter UMLOperation method,
const QString &  type,
const QString &  name
 

Add an argument to a UMLOperation.

The parentPkg arg is only used for resolving possible scope prefixes in the `type'.

Definition at line 396 of file import_utils.cpp.

References bPutAtGlobalScope, createUMLObject(), UMLClassifier::findTemplate(), and gRelatedClassifier.

Referenced by PythonImport::parseStmt(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), and AdaImport::parseStmt().

void Import_Utils::addEnumLiteral UMLEnum enumType,
const QString &  literal,
const QString &  comment = QString()
 

Add an enum literal to an UMLEnum.

Definition at line 413 of file import_utils.cpp.

References UMLObject::setDoc().

Referenced by PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), and AdaImport::parseStmt().

void Import_Utils::createGeneralization UMLClassifier child,
UMLClassifier parent
 

Create a generalization from the given child classifier to the given parent classifier.

Definition at line 418 of file import_utils.cpp.

References UMLDoc::addAssociation(), UMLApp::getDocument(), UMLDoc::getRootFolder(), UMLObject::setBaseType(), and UMLObject::setUMLPackage().

Referenced by createGeneralization(), PythonImport::parseStmt(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), and AdaImport::parseStmt().

void Import_Utils::createGeneralization UMLClassifier child,
const QString &  parentName
 

Create a generalization from the existing child UMLObject to the given parent class name.

Definition at line 436 of file import_utils.cpp.

References createGeneralization(), and createUMLObject().

QStringList Import_Utils::includePathList  ) 
 

Return the list of paths set by previous calls to addIncludePath() and the environment variable UMBRELLO_INCPATH.

This list can be used for finding #included (or Ada with'ed or...) files.

Definition at line 442 of file import_utils.cpp.

References includePathList(), and incPathList.

Referenced by includePathList(), CppImport::initialize(), NativeImportBase::parseFile(), and IDLImport::parseFile().

void Import_Utils::addIncludePath const QString &  path  ) 
 

Add a path to the include path list.

Definition at line 451 of file import_utils.cpp.

References incPathList.

Referenced by NativeImportBase::parseFile(), and IDLImport::parseFile().

bool Import_Utils::isDatatype const QString &  name,
UMLPackage parentPkg = NULL
 

Returns true if a type is an actual Datatype.

Definition at line 457 of file import_utils.cpp.

References UMLDoc::findUMLObject(), and UMLApp::getDocument().


Variable Documentation

bool Import_Utils::bNewUMLObjectWasCreated = false
 

Flag manipulated by createUMLObject().

Global state is generally bad, I know. It would be cleaner to make this into a return value from createUMLObject().

Definition at line 46 of file import_utils.cpp.

Referenced by createUMLObject(), and newUMLObjectWasCreated().

UMLClassifier* Import_Utils::gRelatedClassifier = NULL
 

Related classifier for creation of dependencies on template parameters in createUMLObject().

Definition at line 52 of file import_utils.cpp.

Referenced by addMethodParameter(), createUMLObject(), insertAttribute(), insertMethod(), and setRelatedClassifier().

bool Import_Utils::bPutAtGlobalScope = false
 

On encountering a scoped typename string where the scopes have not yet been seen, we synthesize UML objects for the unknown scopes (using a question dialog to the user to decide whether to treat a scope as a class or as a package.) However, such an unknown scope is put at the global level.

I.e. before calling createUMLObject() we set this flag to true.

Definition at line 62 of file import_utils.cpp.

Referenced by addMethodParameter(), createUMLObject(), insertAttribute(), insertMethod(), and putAtGlobalScope().

QStringList Import_Utils::incPathList
 

The include path list (see addIncludePath() and includePathList()).

Definition at line 67 of file import_utils.cpp.

Referenced by addIncludePath(), and includePathList().

KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:09 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003