summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/ownedhierarchicalcodeblock.cpp
blob: bb2e49901be0fd93c45cd7f214b478912ee0a595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   copyright (C) 2004-2007                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

/*  This code generated by:
 *      Author : thomas
 *      Date   : Fri Aug 07 2003
 */

// own header
#include "ownedhierarchicalcodeblock.h"

// qt/kde includes
#include <kdebug.h>

// local includes
#include "association.h"
#include "umldoc.h"
#include "umlobject.h"
#include "umlrole.h"
#include "codedocument.h"
#include "codegenerator.h"

// Constructors/Destructors
//

OwnedHierarchicalCodeBlock::OwnedHierarchicalCodeBlock ( UMLObject *tqparent, CodeDocument * doc, const TQString &start, const TQString &end, const TQString &comment)
        : HierarchicalCodeBlock ( doc, start, end, comment), OwnedCodeBlock(tqparent)
{

}

OwnedHierarchicalCodeBlock::~OwnedHierarchicalCodeBlock ( ) { }

//
// Methods
//


// Accessor methods
//

// Other methods
//

void OwnedHierarchicalCodeBlock::release () {
    OwnedCodeBlock::release();
    HierarchicalCodeBlock::release();
}

void OwnedHierarchicalCodeBlock::setAttributesFromObject (TextBlock * obj) {

    HierarchicalCodeBlock::setAttributesFromObject(obj);
    OwnedCodeBlock::setAttributesFromObject(obj);
}

void OwnedHierarchicalCodeBlock::setAttributesOnNode (TQDomDocument & doc, TQDomElement & elem ) {

    // set super-class attributes
    HierarchicalCodeBlock::setAttributesOnNode(doc, elem);
    OwnedCodeBlock::setAttributesOnNode(doc, elem);

    // set local class attributes
    elem.setAttribute("parent_id",ID2STR(getParentObject()->getID()));

    // setting ID's takes special treatment
    // as UMLRoles arent properly stored in the XMI right now.
    // (change would break the XMI format..save for big version change )
    UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
    if(role) {
        // see comment on role_id at OwnedCodeBlock::setAttributesOnNode()
        elem.setAttribute("role_id", (role->getRole() == Uml::A));
    }
    /* else
            elem.setAttribute("role_id","-1");
    */
}

/** set the class attributes of this object from
 * the passed element node.
 */
void OwnedHierarchicalCodeBlock::setAttributesFromNode ( TQDomElement & root)
{

    // set attributes from the XMI
    HierarchicalCodeBlock::setAttributesFromNode(root); // superclass load
    OwnedCodeBlock::setAttributesFromNode(root); // superclass load

}

CodeDocument * OwnedHierarchicalCodeBlock::getParentDocument() {
    return TextBlock::getParentDocument();
}

/**
 */
void OwnedHierarchicalCodeBlock::syncToParent ( ) {

    if(getContentType() != CodeBlock::AutoGenerated)
        return;

    updateContent();
}


#include "ownedhierarchicalcodeblock.moc"