• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • kdesdk
  • Sitemap
  • Contact Us
 

umbrello/umbrello

UMLClassifier Class Reference

This class defines the non-graphical information required for a UML Classifier (ie a class or interface). More...

#include <classifier.h>

Inheritance diagram for UMLClassifier:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ClassifierType { ALL = 0, CLASS, INTERFACE, DATATYPE }

Signals

void attributeAdded (UMLClassifierListItem *)
void attributeRemoved (UMLClassifierListItem *)
void operationAdded (UMLClassifierListItem *)
void operationRemoved (UMLClassifierListItem *)
void templateAdded (UMLClassifierListItem *)
void templateRemoved (UMLClassifierListItem *)

Public Member Functions

 UMLClassifier (const QString &name=QString(), Uml::IDType id=Uml::id_None)
virtual ~UMLClassifier ()
virtual bool acceptAssociationType (Uml::Association_Type)
bool addAttribute (UMLAttribute *att, IDChangeLog *log=0, int position=-1)
UMLAttribute * addAttribute (const QString &name, UMLObject *type, Uml::Visibility scope)
UMLAttribute * addAttribute (const QString &name, Uml::IDType id=Uml::id_None)
bool addOperation (UMLOperation *op, IDChangeLog *log)
bool addOperation (UMLOperation *op, int position=-1)
bool addTemplate (UMLTemplate *templt, int position)
bool addTemplate (UMLTemplate *newTemplate, IDChangeLog *log=0)
UMLTemplate * addTemplate (const QString &name, Uml::IDType id=Uml::id_None)
int attributes ()
UMLOperation * checkOperationSignature (const QString &name, UMLAttributeList opParams, UMLOperation *exemptOp=NULL)
UMLObject * clone () const
virtual void copyInto (UMLObject *lhs) const
virtual UMLAttribute * createAttribute (const QString &name=QString(), UMLObject *type=0, Uml::Visibility vis=Uml::Visibility::Private, const QString &init=QString())
UMLOperation * createOperation (const QString &name=QString(), bool *isExistingOp=NULL, Model_Utils::NameAndType_List *params=NULL)
UMLObject * createTemplate (const QString &name=QString())
virtual UMLObject * findChildObjectById (Uml::IDType id, bool considerAncestors=false)
UMLOperation * findOperation (const QString &name, Model_Utils::NameAndType_List params)
UMLOperationList findOperations (const QString &n)
UMLClassifierList findSubClassConcepts (ClassifierType type=ALL)
UMLClassifierList findSuperClassConcepts (ClassifierType type=ALL)
UMLTemplate * findTemplate (const QString &name)
UMLAttributeList getAttributeList (Uml::Visibility scope) const
UMLAttributeList getAttributeList () const
UMLAttributeList getAttributeListStatic (Uml::Visibility scope) const
UMLAssociation * getClassAssoc () const
virtual UMLClassifierListItemList getFilteredList (Uml::Object_Type ot) const
UMLOperationList getOpList (bool includeInherited=false)
UMLTemplateList getTemplateList () const
virtual UMLAssociationList getUniAssociationToBeImplemented ()
bool hasAbstractOps ()
bool hasAccessorMethods ()
bool hasAssociations ()
bool hasAttributes ()
bool hasMethods ()
bool hasOperationMethods ()
bool hasStaticAttributes ()
bool hasVectorFields ()
bool isDatatype () const
bool isInterface () const
bool isReference () const
virtual UMLClassifierListItem * makeChildObject (const QString &xmiTag)
int operations ()
bool operator== (const UMLClassifier &rhs)
UMLClassifier * originType () const
int removeAttribute (UMLAttribute *att)
int removeOperation (UMLOperation *op)
int removeTemplate (UMLTemplate *umltemplate)
virtual bool resolveRef ()
void setBaseType (Uml::Object_Type ot)
void setClassAssoc (UMLAssociation *assoc)
void setIsReference (bool isRef=true)
void setOriginType (UMLClassifier *origType)
int takeItem (UMLClassifierListItem *item)
int templates ()

Protected Member Functions

virtual bool load (QDomElement &element)
void saveToXMI (QDomDocument &qDoc, QDomElement &qElement)

Detailed Description

This class defines the non-graphical information required for a UML Classifier (ie a class or interface).

This class inherits from UMLPackage which allows classifiers to also act as namespaces, i.e. it allows classifiers to nest.

NOTE: There is a unit test available for this class. Please, use and adapt it when necessary.

Information for a non-graphical Concept/Class.

Author:
Paul Hensgen <phensgen@techie.com> Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org

Definition at line 38 of file classifier.h.


Member Enumeration Documentation

enum UMLClassifier::ClassifierType

Enumeration identifying the type of classifier.

Enumerator:
ALL 
CLASS 
INTERFACE 
DATATYPE 

Definition at line 46 of file classifier.h.


Constructor & Destructor Documentation

UMLClassifier::UMLClassifier ( const QString &  name = QString(),
Uml::IDType  id = Uml::id_None 
) [explicit]

Sets up a Classifier.

Parameters:
name The name of the Concept.
id The unique id of the Concept.

Definition at line 51 of file classifier.cpp.

UMLClassifier::~UMLClassifier (  )  [virtual]

Standard deconstructor.

Definition at line 62 of file classifier.cpp.


Member Function Documentation

bool UMLClassifier::acceptAssociationType ( Uml::Association_Type  type  )  [virtual]

Reimplemented from UMLObject.

Reimplemented from UMLObject.

Definition at line 713 of file classifier.cpp.

bool UMLClassifier::addAttribute ( UMLAttribute *  att,
IDChangeLog *  log = 0,
int  position = -1 
)

Adds an already created attribute.

The attribute object must not belong to any other concept.

Parameters:
att Pointer to the UMLAttribute.
log Pointer to the IDChangeLog (optional.)
position Position index for the insertion (optional.) If the position is omitted, or if it is negative or too large, the attribute is added to the end of the list.
Returns:
True if the attribute was successfully added.

Definition at line 850 of file classifier.cpp.

UMLAttribute * UMLClassifier::addAttribute ( const QString &  name,
UMLObject *  type,
Uml::Visibility  scope 
)

Adds an already created attribute.

The attribute object must not belong to any other concept.

Parameters:
name the name of the attribute
type the type of the attribute
scope the visibility of the attribute
Returns:
the just created and added attribute

Definition at line 822 of file classifier.cpp.

UMLAttribute * UMLClassifier::addAttribute ( const QString &  name,
Uml::IDType  id = Uml::id_None 
)

Creates and adds an attribute for the class.

Parameters:
name an optional name, used by when creating through UMLListView
id an optional id
Returns:
the UMLAttribute created and added

Definition at line 797 of file classifier.cpp.

bool UMLClassifier::addOperation ( UMLOperation *  op,
IDChangeLog *  log 
)

Appends an operation to the classifier.

See also:
bool addOperation(UMLOperation* Op, int position = -1) This function is mainly intended for the clipboard.
Parameters:
op Pointer to the UMLOperation to add.
log Pointer to the IDChangeLog.
Returns:
True if the operation was added successfully.

Definition at line 331 of file classifier.cpp.

bool UMLClassifier::addOperation ( UMLOperation *  op,
int  position = -1 
)

Appends an operation to the classifier.

This function is mainly intended for the clipboard.

Parameters:
op Pointer to the UMLOperation to add.
position Inserted at the given position.
Returns:
True if the operation was added successfully.

Definition at line 291 of file classifier.cpp.

bool UMLClassifier::addTemplate ( UMLTemplate *  templt,
int  position 
)

Adds an template to the class.

The template object must not belong to any other class. TODO: If the param IDChangeLog from the method above is not being used, give position a default value of -1 and the method can replace the above one.

Parameters:
templt Pointer to the UMLTemplate to add.
position The position of the template in the list. A value of -1 will add the template at the end.
Returns:
True if the template was successfully added.

Definition at line 1062 of file classifier.cpp.

bool UMLClassifier::addTemplate ( UMLTemplate *  newTemplate,
IDChangeLog *  log = 0 
)

Adds an already created template.

The template object must not belong to any other concept.

Parameters:
newTemplate Pointer to the UMLTemplate object to add.
log Pointer to the IDChangeLog.
Returns:
True if the template was successfully added.

Definition at line 1034 of file classifier.cpp.

UMLTemplate * UMLClassifier::addTemplate ( const QString &  name,
Uml::IDType  id = Uml::id_None 
)

Adds an already created template.

The template object must not belong to any other concept.

Parameters:
name the name of the template
id the id of the template
Returns:
the added template

Definition at line 1012 of file classifier.cpp.

void UMLClassifier::attributeAdded ( UMLClassifierListItem *   )  [signal]
void UMLClassifier::attributeRemoved ( UMLClassifierListItem *   )  [signal]
int UMLClassifier::attributes (  ) 

Returns the number of attributes for the class.

Returns:
The number of attributes for the class.

Definition at line 418 of file classifier.cpp.

UMLOperation * UMLClassifier::checkOperationSignature ( const QString &  name,
UMLAttributeList  opParams,
UMLOperation *  exemptOp = NULL 
)

Checks whether an operation is valid based on its signature - An operation is "valid" if the operation's name and parameter list are unique in the classifier.

Parameters:
name Name of the operation to check.
opParams The operation's argument list.
exemptOp Pointer to the exempt method (optional.)
Returns:
NULL if the signature is valid (ok), else return a pointer to the existing UMLOperation that causes the conflict.

Definition at line 125 of file classifier.cpp.

UMLObject * UMLClassifier::clone (  )  const [virtual]

Make a clone of this object.

Reimplemented from UMLPackage.

Reimplemented in UMLEntity, and UMLEnum.

Definition at line 664 of file classifier.cpp.

void UMLClassifier::copyInto ( UMLObject *  lhs  )  const [virtual]

Copy the internal presentation of this object into the new object.

Reimplemented from UMLPackage.

Reimplemented in UMLEntity, and UMLEnum.

Definition at line 652 of file classifier.cpp.

UMLAttribute * UMLClassifier::createAttribute ( const QString &  name = QString(),
UMLObject *  type = 0,
Uml::Visibility  vis = Uml::Visibility::Private,
const QString &  init = QString() 
) [virtual]

Creates an attribute for the class.

Parameters:
name An optional name, used by when creating through UMLListView
type An optional type, used by when creating through UMLListView
vis An optional visibility, used by when creating through UMLListView
init An optional initial value, used by when creating through UMLListView
Returns:
The UMLAttribute created

Reimplemented in UMLEntity.

Definition at line 743 of file classifier.cpp.

UMLOperation * UMLClassifier::createOperation ( const QString &  name = QString(),
bool *  isExistingOp = NULL,
Model_Utils::NameAndType_List *  params = NULL 
)

Creates an operation in the current document.

The new operation is initialized with name, id, etc. If a method with the given profile already exists in the classifier, no new method is created and the existing operation is returned. If no name is provided, or if the params are NULL, an Operation Dialog is shown to ask the user for a name and parameters. The operation's signature is checked for validity within the parent classifier.

Parameters:
name The operation name (will be chosen internally if none given.)
isExistingOp Optional pointer to bool. If supplied, the bool is set to true if an existing operation is returned.
params Optional list of parameter names and types. If supplied, new operation parameters are constructed using this list.
Returns:
The new operation, or NULL if the operation could not be created because for example, the user canceled the dialog or no appropriate name can be found.

Definition at line 225 of file classifier.cpp.

UMLObject * UMLClassifier::createTemplate ( const QString &  currentName = QString()  ) 

Create and add a just created template.

Parameters:
currentName the name of the template
Returns:
the template or NULL

Definition at line 374 of file classifier.cpp.

UMLObject * UMLClassifier::findChildObjectById ( Uml::IDType  id,
bool  considerAncestors = false 
) [virtual]

Find the child object by the given id.

Parameters:
id the id of the child object
considerAncestors flag whether the ancestors should be considered during search
Returns:
the found child object or NULL

Reimplemented from UMLCanvasObject.

Definition at line 540 of file classifier.cpp.

UMLOperation * UMLClassifier::findOperation ( const QString &  name,
Model_Utils::NameAndType_List  params 
)

Find an operation of the given name and parameter signature.

Parameters:
name The name of the operation to find.
params The parameter descriptors of the operation to find.
Returns:
The operation found. Will return 0 if none found.

Definition at line 170 of file classifier.cpp.

UMLOperationList UMLClassifier::findOperations ( const QString &  n  ) 

Find a list of operations with the given name.

Parameters:
n The name of the operation to find.
Returns:
The list of objects found; will be empty if none found.

Definition at line 515 of file classifier.cpp.

UMLClassifierList UMLClassifier::findSubClassConcepts ( ClassifierType  type = ALL  ) 

Returns a list of concepts which inherit from this concept.

Parameters:
type The ClassifierType to seek.
Returns:
List of UMLClassifiers that inherit from us.

Definition at line 564 of file classifier.cpp.

UMLClassifierList UMLClassifier::findSuperClassConcepts ( ClassifierType  type = ALL  ) 

Returns a list of concepts which this concept inherits from.

Parameters:
type The ClassifierType to seek.
Returns:
List of UMLClassifiers we inherit from.

Definition at line 603 of file classifier.cpp.

UMLTemplate * UMLClassifier::findTemplate ( const QString &  name  ) 

Seeks the template parameter of the given name.

Parameters:
name the template name
Returns:
the found template or 0

Definition at line 1106 of file classifier.cpp.

UMLAttributeList UMLClassifier::getAttributeList ( Uml::Visibility  scope  )  const

Returns the attributes for the specified scope.

Parameters:
scope The scope of the attribute.
Returns:
List of true attributes for the class.

Definition at line 445 of file classifier.cpp.

UMLAttributeList UMLClassifier::getAttributeList (  )  const

Returns the attributes for the specified scope.

Returns:
List of true attributes for the class.

Definition at line 428 of file classifier.cpp.

UMLAttributeList UMLClassifier::getAttributeListStatic ( Uml::Visibility  scope  )  const

Returns the static attributes for the specified scope.

Parameters:
scope The scope of the attribute.
Returns:
List of true attributes for the class.

Definition at line 480 of file classifier.cpp.

UMLAssociation * UMLClassifier::getClassAssoc (  )  const

Returns the UMLAssociation for which this class acts as an association class.

Returns NULL if this class does not act as an association class.

Definition at line 909 of file classifier.cpp.

UMLClassifierListItemList UMLClassifier::getFilteredList ( Uml::Object_Type  ot  )  const [virtual]

Returns the entries in m_List that are of the requested type.

If the requested type is Uml::ot_UMLObject then all entries are returned.

Parameters:
ot the requested object type
Returns:
The list of true operations for the Concept.

Reimplemented in UMLEntity.

Definition at line 988 of file classifier.cpp.

UMLOperationList UMLClassifier::getOpList ( bool  includeInherited = false  ) 

Return a list of operations for the Classifier.

Parameters:
includeInherited Includes operations from superclasses.
Returns:
The list of operations for the Classifier.

Definition at line 945 of file classifier.cpp.

UMLTemplateList UMLClassifier::getTemplateList (  )  const

Returns the templates.

Same as UMLClassifier::getFilteredList(ot_Template) but return type is a true UMLTemplateList.

Returns:
Pointer to the list of true templates for the class.

Definition at line 1135 of file classifier.cpp.

UMLAssociationList UMLClassifier::getUniAssociationToBeImplemented (  )  [virtual]

Return the list of unidirectional association that should show up in the code.

Definition at line 1338 of file classifier.cpp.

bool UMLClassifier::hasAbstractOps (  ) 

Return true if this classifier has abstract operations.

Definition at line 917 of file classifier.cpp.

bool UMLClassifier::hasAccessorMethods (  ) 

Return true if this classifier has accessor methods.

Definition at line 1302 of file classifier.cpp.

bool UMLClassifier::hasAssociations (  ) 

Return true if this classifier has associations.

Returns:
true if classifier has associations

Definition at line 1268 of file classifier.cpp.

bool UMLClassifier::hasAttributes (  ) 

Return true if this classifier has attributes.

Definition at line 1279 of file classifier.cpp.

bool UMLClassifier::hasMethods (  ) 

Return true if this classifier has methods.

Definition at line 1318 of file classifier.cpp.

bool UMLClassifier::hasOperationMethods (  ) 

Return true if this classifier has operation methods.

Definition at line 1310 of file classifier.cpp.

bool UMLClassifier::hasStaticAttributes (  ) 

Return true if this classifier has static attributes.

Definition at line 1292 of file classifier.cpp.

bool UMLClassifier::hasVectorFields (  ) 

Return true if this classifier has vector fields.

Definition at line 1330 of file classifier.cpp.

bool UMLClassifier::isDatatype (  )  const

Returns true if this classifier represents a datatype.

Definition at line 109 of file classifier.cpp.

bool UMLClassifier::isInterface (  )  const

Returns true if this classifier represents an interface.

Definition at line 101 of file classifier.cpp.

bool UMLClassifier::isReference (  )  const

Get the m_isRef flag.

Returns:
true if is reference, otherwise false

Definition at line 1259 of file classifier.cpp.

bool UMLClassifier::load ( QDomElement &  element  )  [protected, virtual]

Auxiliary to loadFromXMI: The loading of operations is implemented here.

Calls loadSpecialized() for any other tag. Child classes can override the loadSpecialized method to load its additional tags.

Reimplemented from UMLPackage.

Reimplemented in UMLEntity, and UMLEnum.

Definition at line 1478 of file classifier.cpp.

UMLClassifierListItem * UMLClassifier::makeChildObject ( const QString &  xmiTag  )  [virtual]

utility functions to allow easy determination of what classifiers are "owned" by the current one via named association type (e.g.

Create a new ClassifierListObject (attribute, operation, template) according to the given XMI tag.

plain, aggregate or compositions).

Returns NULL if the string given does not contain one of the tags <UML:Attribute>, <UML:Operation>, or <UML:TemplateParameter>. Used by the clipboard for paste operation.

Reimplemented in UMLEntity, and UMLEnum.

Definition at line 1456 of file classifier.cpp.

void UMLClassifier::operationAdded ( UMLClassifierListItem *   )  [signal]
void UMLClassifier::operationRemoved ( UMLClassifierListItem *   )  [signal]
int UMLClassifier::operations (  ) 

Counts the number of operations in the Classifier.

Returns:
The number of operations for the Classifier.

Definition at line 934 of file classifier.cpp.

bool UMLClassifier::operator== ( const UMLClassifier &  rhs  ) 

Overloaded '==' operator.

Reimplemented from UMLCanvasObject.

Reimplemented in UMLEntity, and UMLEnum.

Definition at line 635 of file classifier.cpp.

UMLClassifier * UMLClassifier::originType (  )  const

Get the origin type (in case of e.g.

typedef)

Returns:
the origin type

Definition at line 1241 of file classifier.cpp.

int UMLClassifier::removeAttribute ( UMLAttribute *  att  ) 

Removes an attribute from the class.

Parameters:
att The attribute to remove.
Returns:
Count of the remaining attributes after removal. Returns -1 if the given attribute was not found.

Definition at line 880 of file classifier.cpp.

int UMLClassifier::removeOperation ( UMLOperation *  op  ) 

Remove an operation from the Classifier.

The operation is not deleted so the caller is responsible for what happens to it after this.

Parameters:
op The operation to remove.
Returns:
Count of the remaining operations after removal, or -1 if the given operation was not found.

Definition at line 351 of file classifier.cpp.

int UMLClassifier::removeTemplate ( UMLTemplate *  umltemplate  ) 

Removes a template from the class.

Parameters:
umltemplate The template to remove.
Returns:
Count of the remaining templates after removal. Returns -1 if the given template was not found.

Definition at line 1089 of file classifier.cpp.

bool UMLClassifier::resolveRef (  )  [virtual]

Needs to be called after all UML objects are loaded from file.

Calls the parent resolveRef(), and calls resolveRef() on all UMLClassifierListItems. Overrides the method from UMLObject.

Returns:
true for success.

Reimplemented from UMLPackage.

Reimplemented in UMLEntity.

Definition at line 679 of file classifier.cpp.

void UMLClassifier::saveToXMI ( QDomDocument &  qDoc,
QDomElement &  qElement 
) [protected, virtual]

Utility method called by "get*ChildClassfierList()" methods.

Auxiliary to saveToXMI of inheriting classes: Saves template parameters to the given QDomElement.

It basically finds all the classifiers named in each association in the given association list which aren't the current one. Useful for finding which classifiers are "owned" by the current one via declared associations such as in aggregations/compositions.

Reimplemented from UMLPackage.

Reimplemented in UMLEntity, and UMLEnum.

Definition at line 1372 of file classifier.cpp.

void UMLClassifier::setBaseType ( Uml::Object_Type  ot  )  [virtual]

Reimplementation of method from class UMLObject for controlling the exact type of this classifier: class, interface, or datatype.

Parameters:
ot the base type to set

Reimplemented from UMLObject.

Definition at line 71 of file classifier.cpp.

void UMLClassifier::setClassAssoc ( UMLAssociation *  assoc  ) 

Sets the UMLAssociation for which this class shall act as an association class.

Definition at line 899 of file classifier.cpp.

void UMLClassifier::setIsReference ( bool  isRef = true  ) 

Set the m_isRef flag (true when dealing with a pointer type).

Parameters:
isRef the flag to set

Definition at line 1250 of file classifier.cpp.

void UMLClassifier::setOriginType ( UMLClassifier *  origType  ) 

Set the origin type (in case of e.g.

typedef)

Parameters:
origType the origin type to set

Definition at line 1232 of file classifier.cpp.

int UMLClassifier::takeItem ( UMLClassifierListItem *  item  ) 

Take and return a subordinate item from this classifier.

Ownership of the item is passed to the caller.

Parameters:
item Subordinate item to take.
Returns:
Index in m_List of the item taken. Return -1 if the item is not found in m_List.

Definition at line 1155 of file classifier.cpp.

void UMLClassifier::templateAdded ( UMLClassifierListItem *   )  [signal]
void UMLClassifier::templateRemoved ( UMLClassifierListItem *   )  [signal]
int UMLClassifier::templates (  ) 

Returns the number of templates for the class.

Returns:
The number of templates for the class.

Definition at line 1122 of file classifier.cpp.


The documentation for this class was generated from the following files:
  • classifier.h
  • classifier.cpp

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdesdk

Skip menu "kdesdk"
  • kapptemplate
  • kate
  •     kate
  • kbugbuster
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello
Generated for kdesdk by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal