umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

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)
UMLObject * | createUMLObject (UMLObject::ObjectType type, const QString &inName, UMLPackage *parentPkg, const QString &comment, const QString &stereotype, bool searchInParentPackageOnly, bool remapParent)
UMLObject * | createUMLObjectHierarchy (UMLObject::ObjectType type, const QString &name, UMLPackage *topLevelParent)
UMLOperation * | makeOperation (UMLClassifier *parent, const QString &name)
UMLAttribute * | insertAttribute (UMLClassifier *owner, Uml::Visibility::Enum scope, const QString &name, UMLClassifier *attrType, const QString &comment, bool isStatic)
UMLAttribute * | insertAttribute (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)
UMLAttribute * | addMethodParameter (UMLOperation *method, const QString &type, const QString &name)
void | addEnumLiteral (UMLEnum *enumType, const QString &literal, const QString &comment, const QString &value)
UMLAssociation * | createGeneralization (UMLClassifier *child, UMLClassifier *parent)
UMLFolder * | createSubDir (const QString &name, UMLFolder *parentPkg, const QString &comment)
UMLObject * | createArtifactFolder (const QString &name, UMLPackage *parentPkg, const QString &comment)
UMLObject * | createArtifact (const QString &name, UMLFolder *parentPkg, const QString &comment)
void | createGeneralization (UMLClassifier *child, const QString &parentName)
UMLEnum * | remapUMLEnum (UMLObject *ns, UMLPackage *currentScope)
QStringList | includePathList ()
void | addIncludePath (const QString &path)
bool | isDatatype (const QString &name, UMLPackage *parentPkg)
UMLPackage * | globalScope ()

## Variables
bool | bNewUMLObjectWasCreated = false
UMLClassifier * | gRelatedClassifier = 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.

## ◆ 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.

## ◆ 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

  yesno | False turns UID generation off, true turns it on.

## ◆ 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

  typeName | Writable 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.

## ◆ createArtifactFolder()

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

Create a folder for artifacts

## ◆ 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.

## ◆ createGeneralization() [2/2]

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

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

## ◆ createSubDir()

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

Create a subdir with the given name.

## ◆ 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

  type | object type
  inName | name of uml object
  parentPkg | parent package
  comment | comment for uml object
  stereotype | stereotype for uml object
  searchInParentPackageOnly | flags to search only in parent package
  remapParent | flag to control remapping of parents if a uml object has been found

Returns
  new object or zero

## ◆ 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

  type | type of UML object to create
  name | name of UML object
  topLevelParent | UML package to add the hierarchy of UML objects

Returns
  pointer to created or found UML object

## ◆ 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.

## ◆ 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.

## ◆ 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.

## ◆ 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.

## ◆ 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

  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 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.
  scope | The Uml::Visibility of the method
  type | The return type
  isStatic | boolean switch to decide if method is static
  isAbstract | boolean switch to decide if method is abstract
  isFriend | true boolean switch to decide if methods is a friend function
  isConstructor | boolean switch to decide if methods is a constructor
  isDestructor | boolean switch to decide if methods is a destructor
  comment | The Documentation for this method

## ◆ isDatatype()

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

Returns true if a type is an actual Datatype

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

## ◆ 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

  yesno | When 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

  ns | uml object instance with incorrect class
  currentScope | parent uml object

Returns
  newly created UMLEnum instance or zero in case of error

## ◆ 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())