umbrello/umbrello
ownedhierarchicalcodeblock.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "ownedhierarchicalcodeblock.h"
00014
00015
00016 #include "association.h"
00017 #include "umldoc.h"
00018 #include "umlobject.h"
00019 #include "umlrole.h"
00020 #include "codedocument.h"
00021 #include "codegenerator.h"
00022
00023
00024 #include <kdebug.h>
00025
00026 OwnedHierarchicalCodeBlock::OwnedHierarchicalCodeBlock ( UMLObject *parent, CodeDocument * doc, const QString &start, const QString &end, const QString &comment)
00027 : OwnedCodeBlock(parent), HierarchicalCodeBlock ( doc, start, end, comment)
00028 {
00029 }
00030
00031 OwnedHierarchicalCodeBlock::~OwnedHierarchicalCodeBlock ( )
00032 {
00033 }
00034
00040 void OwnedHierarchicalCodeBlock::release ()
00041 {
00042 OwnedCodeBlock::release();
00043 HierarchicalCodeBlock::release();
00044 }
00045
00049 void OwnedHierarchicalCodeBlock::setAttributesFromObject (TextBlock * obj)
00050 {
00051 HierarchicalCodeBlock::setAttributesFromObject(obj);
00052 OwnedCodeBlock::setAttributesFromObject(obj);
00053 }
00054
00059 void OwnedHierarchicalCodeBlock::setAttributesOnNode (QDomDocument & doc, QDomElement & elem )
00060 {
00061
00062 HierarchicalCodeBlock::setAttributesOnNode(doc, elem);
00063 OwnedCodeBlock::setAttributesOnNode(doc, elem);
00064
00065
00066 elem.setAttribute("parent_id",ID2STR(getParentObject()->getID()));
00067
00068
00069
00070
00071 UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
00072 if(role) {
00073
00074 elem.setAttribute("role_id", (role->getRole() == Uml::A));
00075 }
00076
00077
00078
00079 }
00080
00085 void OwnedHierarchicalCodeBlock::setAttributesFromNode ( QDomElement & root)
00086 {
00087
00088 HierarchicalCodeBlock::setAttributesFromNode(root);
00089 OwnedCodeBlock::setAttributesFromNode(root);
00090 }
00091
00095 CodeDocument * OwnedHierarchicalCodeBlock::getParentDocument()
00096 {
00097
00101 return TextBlock::getParentDocument();
00102 }
00103
00104 void OwnedHierarchicalCodeBlock::syncToParent ( )
00105 {
00106 if(getContentType() != CodeBlock::AutoGenerated)
00107 return;
00108
00109 updateContent();
00110 }
00111
00112
00113 #include "ownedhierarchicalcodeblock.moc"