[Uml-devel] KDE/kdesdk/umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Thu Dec 13 08:42:16 UTC 2007
SVN commit 747968 by fischer:
Some code and documentation format changes.
M +31 -43 codeclassfielddeclarationblock.cpp
M +16 -16 codeclassfielddeclarationblock.h
--- trunk/KDE/kdesdk/umbrello/umbrello/codeclassfielddeclarationblock.cpp #747967:747968
@@ -13,16 +13,16 @@
* Date : Fri Jul 25 2003
*/
-/** basicially a class to allow for synchronization of the contents based on the
- * values of the parentClassField's parentObject
+/**
+ * Basicially a class to allow for synchronization of the contents based on the
+ * values of the parentClassField's parentObject
*/
+
#include "codeclassfielddeclarationblock.h"
#include "codeclassfield.h"
#include "umlrole.h"
-// Constructors/Destructors
-//
CodeClassFieldDeclarationBlock::CodeClassFieldDeclarationBlock ( CodeClassField * parentCF )
: CodeBlockWithComments ( (CodeDocument*) parentCF->getParentDocument() ),
@@ -31,49 +31,41 @@
init(parentCF);
}
-CodeClassFieldDeclarationBlock::~CodeClassFieldDeclarationBlock ( ) {
+CodeClassFieldDeclarationBlock::~CodeClassFieldDeclarationBlock ( )
+{
// Q: is this needed??
// m_parentclassfield->getParentObject()->disconnect(this);
}
-//
-// Methods
-//
-
-// Accessor methods
-//
-
/**
* Get the value of m_parentclassfield
* @return the value of m_parentclassfield
*/
-CodeClassField * CodeClassFieldDeclarationBlock::getParentClassField ( ) {
+CodeClassField * CodeClassFieldDeclarationBlock::getParentClassField ( )
+{
return m_parentclassfield;
}
-/** Get the parent object of the parentCodeClassfield
+/**
+ * Get the parent object of the parentCodeClassfield.
*/
-UMLObject * CodeClassFieldDeclarationBlock::getParentObject ( ) {
+UMLObject * CodeClassFieldDeclarationBlock::getParentObject ( )
+{
return m_parentclassfield->getParentObject();
}
-CodeDocument * CodeClassFieldDeclarationBlock::getParentDocument ( ) {
- return TextBlock::getParentDocument();
-}
-
-// Other methods
-//
-
// this type of textblock is special
// we DON'T release it when resetTextBlocks is
// called because we re-use it over and over
// until the codeclassfield is released.
-void CodeClassFieldDeclarationBlock::release () {
+void CodeClassFieldDeclarationBlock::release ()
+{
// do nothing
}
-void CodeClassFieldDeclarationBlock::forceRelease () {
- if(m_parentclassfield)
+void CodeClassFieldDeclarationBlock::forceRelease ()
+{
+ if (m_parentclassfield)
{
// m_parentclassfield->getParentObject()->disconnect(this);
m_parentclassfield->disconnect(this);
@@ -89,9 +81,7 @@
void CodeClassFieldDeclarationBlock::saveToXMI ( QDomDocument & doc, QDomElement & elem)
{
QDomElement docElement = doc.createElement( "ccfdeclarationcodeblock" );
-
setAttributesOnNode(doc, docElement);
-
elem.appendChild( docElement );
}
@@ -100,19 +90,18 @@
setAttributesFromNode(root);
}
-void CodeClassFieldDeclarationBlock::setAttributesOnNode (QDomDocument & doc, QDomElement & elem ) {
-
+void CodeClassFieldDeclarationBlock::setAttributesOnNode (QDomDocument & doc, QDomElement & elem )
+{
// set super-class attributes
CodeBlockWithComments::setAttributesOnNode(doc, elem);
OwnedCodeBlock::setAttributesOnNode(doc, elem);
-
}
/**
* load params from the appropriate XMI element node.
*/
-void CodeClassFieldDeclarationBlock::setAttributesFromNode( QDomElement & root ) {
-
+void CodeClassFieldDeclarationBlock::setAttributesFromNode( QDomElement & root )
+{
// set attributes from the XMI
CodeBlockWithComments::setAttributesFromNode(root); // superclass load
OwnedCodeBlock::setAttributesFromNode(root); // superclass load
@@ -122,31 +111,30 @@
/** set the class attributes from a passed object
*/
-void CodeClassFieldDeclarationBlock::setAttributesFromObject (TextBlock * obj) {
-
+void CodeClassFieldDeclarationBlock::setAttributesFromObject (TextBlock * obj)
+{
CodeBlockWithComments::setAttributesFromObject(obj);
CodeClassFieldDeclarationBlock * ccb = dynamic_cast<CodeClassFieldDeclarationBlock*>(obj);
- if(ccb)
+ if (ccb)
{
m_parentclassfield->disconnect(this);
init(ccb->getParentClassField());
syncToParent();
}
-
}
-void CodeClassFieldDeclarationBlock::syncToParent () {
-
+void CodeClassFieldDeclarationBlock::syncToParent ()
+{
// for role-based accessors, we DON'T write ourselves out when
// the name of the role is not defined.
- if(!(getParentClassField()->parentIsAttribute()))
+ if (!(getParentClassField()->parentIsAttribute()))
{
UMLRole * parent = dynamic_cast<UMLRole*>(getParentObject());
if (parent == NULL)
return;
- if(parent->getName().isEmpty())
+ if (parent->getName().isEmpty())
{
getComment()->setWriteOutText(false);
setWriteOutText(false);
@@ -157,18 +145,18 @@
}
// only update IF we are NOT AutoGenerated
- if(getContentType() != AutoGenerated)
+ if (getContentType() != AutoGenerated)
return;
updateContent();
-
}
void CodeClassFieldDeclarationBlock::init (CodeClassField * parentCF)
{
m_parentclassfield = parentCF;
- m_canDelete = false;
+ setCanDelete(false);
connect(m_parentclassfield,SIGNAL(modified()),this,SLOT(syncToParent()));
}
+
#include "codeclassfielddeclarationblock.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/codeclassfielddeclarationblock.h #747967:747968
@@ -25,7 +25,6 @@
#include "ownedcodeblock.h"
/**
- * class CodeClassFieldDeclarationBlock
* Used to declare classifier fields (e.g. either class attributes or classifier
* associations) in the code document for any given code classfield. This is a
* special CodeBlockWithComments which is "sync'd" to the parent CodeClassField.
@@ -37,9 +36,6 @@
Q_OBJECT
public:
- // Constructors/Destructors
- //
-
/**
* Constructor
*/
@@ -51,33 +47,33 @@
virtual ~CodeClassFieldDeclarationBlock ( );
/**
- * Get the value of m_parentclassfield
+ * Get the value of m_parentclassfield.
* @return the value of m_parentclassfield
*/
CodeClassField * getParentClassField ( );
- /** A Utility method to get the parent object of the parentCodeClassfield
+ /**
+ * A utility method to get the parent object of the parentCodeClassfield.
*/
UMLObject * getParentObject ( );
- // get the parent document
- CodeDocument * getParentDocument ( );
-
- /** set the class attributes from a passed object
+ /**
+ * Set the class attributes from a passed object.
*/
virtual void setAttributesFromObject (TextBlock * obj);
- /** this is called by syncToParent
+ /**
+ * This is called by syncToParent.
*/
virtual void updateContent() = 0;
/**
- * Save the XMI representation of this object
+ * Save the XMI representation of this object.
*/
virtual void saveToXMI ( QDomDocument & doc, QDomElement & root );
/**
- * load params from the appropriate XMI element node.
+ * Load params from the appropriate XMI element node.
*/
virtual void loadFromXMI ( QDomElement & root );
@@ -85,17 +81,21 @@
virtual void release ();
- /** set attributes of the node that represents this class
+ /**
+ * Set attributes of the node that represents this class
* in the XMI document.
*/
virtual void setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement);
- /** set the class attributes of this object from
+ /**
+ * Set the class attributes of this object from
* the passed element node.
*/
virtual void setAttributesFromNode ( QDomElement & element);
- // so parent can actually release this block
+ /**
+ * So parent can actually release this block.
+ */
void forceRelease ();
private:
More information about the umbrello-devel
mailing list