• Skip to content
  • Skip to link menu
KDE 4.2 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

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 ()
 UMLClassifier (const QString &name=QString(), Uml::IDType id=Uml::id_None)
virtual ~UMLClassifier ()

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 40 of file classifier.h.


Member Enumeration Documentation

enum UMLClassifier::ClassifierType

Enumeration identifying the type of classifier.

Enumerator:
ALL 
CLASS 
INTERFACE 
DATATYPE 

Definition at line 48 of file classifier.h.


Constructor & Destructor Documentation

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

Sets up a Concept.

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

Definition at line 44 of file classifier.cpp.

UMLClassifier::~UMLClassifier (  )  [virtual]

Standard deconstructor.

Definition at line 52 of file classifier.cpp.


Member Function Documentation

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

reimplemented from UMLObject

Reimplemented from UMLObject.

Definition at line 548 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 645 of file classifier.cpp.

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

Definition at line 629 of file classifier.cpp.

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

Adds an attribute to the class.

If an attribute of the given name already exists, then returns the existing attribute instead of creating a new one.

Parameters:
name The name of the attribute.
id The id of the attribute (optional.) If not given, and the attribute name does not already exist, then the method will internally assign a new ID.
Returns:
Pointer to the UMLAttribute created or found.

Definition at line 614 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 253 of file classifier.cpp.

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

Adds an operation to the classifier, at the given position.

If position is negative or too large, the attribute is added to the end of the list. The Classifier first checks and only adds the Operation if the signature does not conflict with exising operations

Parameters:
op Pointer to the UMLOperation to add.
position Index at which to insert into the list.
Returns:
True if the Operation could be added to the Classifier.

Definition at line 223 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.

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 790 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 772 of file classifier.cpp.

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

Adds a template to the class if it is not there yet.

Parameters:
name The name of the template.
id The id of the template.
Returns:
Pointer to the UMLTemplate object created.

Definition at line 758 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 320 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 96 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 511 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 502 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 569 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 167 of file classifier.cpp.

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

Creates a template for the concept.

Returns:
The UMLTemplate created

Definition at line 282 of file classifier.cpp.

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

Find an attribute, operation, association or template.

Parameters:
id The id of the object to find.
considerAncestors Whether to search the parent classes.
Returns:
The object found. Will return 0 if none found.

Reimplemented from UMLCanvasObject.

Definition at line 411 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 133 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 393 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 429 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 460 of file classifier.cpp.

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

Seeks the template parameter of the given name.

Definition at line 823 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 337 of file classifier.cpp.

UMLAttributeList UMLClassifier::getAttributeList (  )  const

Returns the attributes.

Same as UMLClassifier::getFilteredList(ot_Attribute) but return type is a true UMLAttributeList.

Returns:
List of true attributes for the class.

Definition at line 326 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 365 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 687 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.

Returns:
The list of true operations for the Concept.

Reimplemented in UMLEntity.

Definition at line 743 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 708 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 840 of file classifier.cpp.

UMLAssociationList UMLClassifier::getUniAssociationToBeImplemented (  )  [virtual]

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

Definition at line 991 of file classifier.cpp.

bool UMLClassifier::hasAbstractOps (  ) 

Return true if this classifier has abstract operations.

Definition at line 692 of file classifier.cpp.

bool UMLClassifier::hasAccessorMethods (  ) 

Return true if this classifier has accessor methods.

Definition at line 968 of file classifier.cpp.

bool UMLClassifier::hasAssociations (  ) 

Return true if this classifier has associations.

Definition at line 943 of file classifier.cpp.

bool UMLClassifier::hasAttributes (  ) 

Return true if this classifier has attributes.

Definition at line 951 of file classifier.cpp.

bool UMLClassifier::hasMethods (  ) 

Return true if this classifier has methods.

Definition at line 978 of file classifier.cpp.

bool UMLClassifier::hasOperationMethods (  ) 

Return true if this classifier has operation methods.

Definition at line 973 of file classifier.cpp.

bool UMLClassifier::hasStaticAttributes (  ) 

Return true if this classifier has static attributes.

Definition at line 961 of file classifier.cpp.

bool UMLClassifier::hasVectorFields (  ) 

Return true if this classifier has vector fields.

Definition at line 986 of file classifier.cpp.

bool UMLClassifier::isDatatype (  )  const

Returns true if this classifier represents a datatype.

Definition at line 91 of file classifier.cpp.

bool UMLClassifier::isInterface (  )  const

Returns true if this classifier represents an interface.

Definition at line 86 of file classifier.cpp.

bool UMLClassifier::isReference (  )  const

Get the m_isRef flag.

Definition at line 938 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 1111 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.

plain, aggregate or compositions). Create a new ClassifierListObject (attribute, operation, template) according to the given XMI tag. 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 1096 of file classifier.cpp.

void UMLClassifier::operationAdded ( UMLClassifierListItem *   )  [signal]

Signals that a new UMLOperation has been added to the classifer.

void UMLClassifier::operationRemoved ( UMLClassifierListItem *   )  [signal]

Signals that a UMLOperation has been removed from the classifer.

int UMLClassifier::operations (  ) 

counts the number of operations in the Classifier.

Returns:
The number of operations for the Classifier.

Definition at line 703 of file classifier.cpp.

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

Overloaded '==' operator.

Definition at line 488 of file classifier.cpp.

UMLClassifier * UMLClassifier::originType (  )  const

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

typedef)

Definition at line 928 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 667 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 264 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 810 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 518 of file classifier.cpp.

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

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

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. Auxiliary to saveToXMI of inheriting classes: Saves template parameters to the given QDomElement.

Reimplemented from UMLPackage.

Reimplemented in UMLEntity, and UMLEnum.

Definition at line 1019 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.

Reimplemented from UMLObject.

Definition at line 56 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 682 of file classifier.cpp.

void UMLClassifier::setIsReference ( bool  isRef = true  ) 

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

Definition at line 933 of file classifier.cpp.

void UMLClassifier::setOriginType ( UMLClassifier *  origType  ) 

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

typedef)

Definition at line 923 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 851 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 834 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