umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Functions | Variables
Import_Utils Namespace Reference

Functions

void putAtGlobalScope (bool yesno)
 
void setRelatedClassifier (UMLClassifier *c)
 
void assignUniqueIdOnCreation (bool yesno)
 
bool newUMLObjectWasCreated ()
 
QString formatComment (const QString &comment)
 
void checkStdString (QString &typeName)
 
UMLObjectcreateUMLObject (UMLObject::ObjectType type, const QString &inName, UMLPackage *parentPkg, const QString &comment, const QString &stereotype, bool searchInParentPackageOnly, bool remapParent)
 
UMLObjectcreateUMLObjectHierarchy (UMLObject::ObjectType type, const QString &name, UMLPackage *topLevelParent)
 
UMLOperationmakeOperation (UMLClassifier *parent, const QString &name)
 
UMLAttributeinsertAttribute (UMLClassifier *owner, Uml::Visibility::Enum scope, const QString &name, UMLClassifier *attrType, const QString &comment, bool isStatic)
 
UMLAttributeinsertAttribute (UMLClassifier *owner, Uml::Visibility::Enum scope, const QString &name, const QString &type, const QString &comment, bool isStatic)
 
void insertMethod (UMLClassifier *klass, UMLOperation *&op, Uml::Visibility::Enum scope, const QString &type, bool isStatic, bool isAbstract, bool isFriend, bool isConstructor, bool isDestructor, const QString &comment)
 
UMLAttributeaddMethodParameter (UMLOperation *method, const QString &type, const QString &name)
 
void addEnumLiteral (UMLEnum *enumType, const QString &literal, const QString &comment, const QString &value)
 
UMLAssociationcreateGeneralization (UMLClassifier *child, UMLClassifier *parent)
 
UMLFoldercreateSubDir (const QString &name, UMLFolder *parentPkg, const QString &comment)
 
UMLObjectcreateArtifactFolder (const QString &name, UMLPackage *parentPkg, const QString &comment)
 
UMLObjectcreateArtifact (const QString &name, UMLFolder *parentPkg, const QString &comment)
 
void createGeneralization (UMLClassifier *child, const QString &parentName)
 
UMLEnumremapUMLEnum (UMLObject *ns, UMLPackage *currentScope)
 
QStringList includePathList ()
 
void addIncludePath (const QString &path)
 
bool isDatatype (const QString &name, UMLPackage *parentPkg)
 
UMLPackageglobalScope ()
 

Variables

bool bNewUMLObjectWasCreated = false
 
UMLClassifiergRelatedClassifier = 0
 
bool bPutAtGlobalScope = false
 
QStringList incPathList
 

Detailed Description

Utilities for code import

Author
Oliver Kellogg Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

Function Documentation

◆ addEnumLiteral()

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

Add an enum literal to a UMLEnum.

Here is the call graph for this function:

◆ addIncludePath()

void Import_Utils::addIncludePath ( const QString &  path)

Add a path to the include path list.

◆ addMethodParameter()

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

Add an argument to a UMLOperation.

Here is the call graph for this function:

◆ assignUniqueIdOnCreation()

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
yesnoFalse turns UID generation off, true turns it on.
Here is the call graph for this function:

◆ checkStdString()

void Import_Utils::checkStdString ( QString &  typeName)

Peculiarity of Umbrello: std::string must be mapped to "string" because that is the predefined type in the Datatypes folder, and if we leave std::string as it is then there will be a second type "string" in the package "std" generated by the import. Having two types "string" would create confusion for the user and would not fit with the C++ code generator which generates "std::string" from the "string" of the Datatypes folder.

Parameters
typeNameWritable reference to QString variable: If content is "std::string" then it will be changed to "string".

◆ createArtifact()

UMLObject * Import_Utils::createArtifact ( const QString &  name,
UMLFolder parentPkg,
const QString &  comment 
)

Create an artifact with the given name.

Here is the call graph for this function:

◆ createArtifactFolder()

UMLObject * Import_Utils::createArtifactFolder ( const QString &  name,
UMLPackage parentPkg,
const QString &  comment 
)

Create a folder for artifacts

Here is the call graph for this function:

◆ createGeneralization() [1/2]

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

Create a generalization from the existing child UMLObject to the given parent class name. This method does not handle scopes well and is only a last resort. The method createGeneralization(UMLClassifier *child, UMLClassifier *parent) should be used instead.

Here is the call graph for this function:

◆ createGeneralization() [2/2]

UMLAssociation * Import_Utils::createGeneralization ( UMLClassifier child,
UMLClassifier parent 
)

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

Here is the call graph for this function:

◆ createSubDir()

UMLFolder * Import_Utils::createSubDir ( const QString &  name,
UMLFolder parentPkg,
const QString &  comment 
)

Create a subdir with the given name.

Here is the call graph for this function:

◆ createUMLObject()

UMLObject * Import_Utils::createUMLObject ( UMLObject::ObjectType  type,
const QString &  inName,
UMLPackage parentPkg,
const QString &  comment,
const QString &  stereotype,
bool  searchInParentPackageOnly,
bool  remapParent 
)

Find or create a document object.

Parameters
typeobject type
inNamename of uml object
parentPkgparent package
commentcomment for uml object
stereotypestereotype for uml object
searchInParentPackageOnlyflags to search only in parent package
remapParentflag to control remapping of parents if a uml object has been found
Returns
new object or zero
Here is the call graph for this function:

◆ createUMLObjectHierarchy()

UMLObject * Import_Utils::createUMLObjectHierarchy ( UMLObject::ObjectType  type,
const QString &  name,
UMLPackage topLevelParent 
)

Create hierarchical tree of UML objects

This method creates the UML object specified by type and name including an optional namespace hierarchy if included in the name e.g. NamespaceA::ClassA in C++.

Parameters
typetype of UML object to create
namename of UML object
topLevelParentUML package to add the hierarchy of UML objects
Returns
pointer to created or found UML object
Here is the call graph for this function:

◆ formatComment()

QString Import_Utils::formatComment ( const QString &  comment)

Strip comment lines of leading whitespace and stars.

◆ globalScope()

UMLPackage * Import_Utils::globalScope ( )

Returns the UML package of the global scope.

Here is the call graph for this function:

◆ includePathList()

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.

Here is the call graph for this function:

◆ insertAttribute() [1/2]

UMLAttribute * Import_Utils::insertAttribute ( UMLClassifier owner,
Uml::Visibility::Enum  scope,
const QString &  name,
const QString &  type,
const QString &  comment,
bool  isStatic 
)

Create a UMLAttribute and insert it into the document.

Here is the call graph for this function:

◆ insertAttribute() [2/2]

UMLAttribute * Import_Utils::insertAttribute ( UMLClassifier owner,
Uml::Visibility::Enum  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.

Here is the call graph for this function:

◆ insertMethod()

void Import_Utils::insertMethod ( UMLClassifier klass,
UMLOperation *&  op,
Uml::Visibility::Enum  scope,
const QString &  type,
bool  isStatic,
bool  isAbstract,
bool  isFriend,
bool  isConstructor,
bool  isDestructor,
const QString &  comment 
)

Insert the UMLOperation into the given classifier.

Parameters
klassThe classifier into which the operation shall be added.
opReference to pointer to the temporary UMLOperation for insertion. The caller relinquishes ownership of the object pointed to. If a UMLOperation of same signature already exists at the classifier then the incoming UMLOperation is deleted and the pointer is set to the existing UMLOperation.
scopeThe Uml::Visibility of the method
typeThe return type
isStaticboolean switch to decide if method is static
isAbstractboolean switch to decide if method is abstract
isFriendtrue boolean switch to decide if methods is a friend function
isConstructorboolean switch to decide if methods is a constructor
isDestructorboolean switch to decide if methods is a destructor
commentThe Documentation for this method
Here is the call graph for this function:

◆ isDatatype()

bool Import_Utils::isDatatype ( const QString &  name,
UMLPackage parentPkg 
)

Returns true if a type is an actual Datatype

Here is the call graph for this function:

◆ makeOperation()

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.)

Here is the call graph for this function:

◆ newUMLObjectWasCreated()

bool Import_Utils::newUMLObjectWasCreated ( )

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

◆ putAtGlobalScope()

void Import_Utils::putAtGlobalScope ( bool  yesno)

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

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

◆ remapUMLEnum()

UMLEnum * Import_Utils::remapUMLEnum ( UMLObject ns,
UMLPackage currentScope 
)

Remap UMLObject instance in case it does not have the correct type.

Parameters
nsuml object instance with incorrect class
currentScopeparent uml object
Returns
newly created UMLEnum instance or zero in case of error
Here is the call graph for this function:

◆ setRelatedClassifier()

void Import_Utils::setRelatedClassifier ( UMLClassifier c)

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

Variable Documentation

◆ bNewUMLObjectWasCreated

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().

◆ bPutAtGlobalScope

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.

◆ gRelatedClassifier

UMLClassifier* Import_Utils::gRelatedClassifier = 0

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

◆ incPathList

QStringList Import_Utils::incPathList

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