summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codemethodblock.h
blob: 0dae9519c502e27b1c17a1bd4ebf1891ec6bcdbc (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

/*  This code generated by:
 *      Author : thomas
 *      Date   : Fri Jun 20 2003
 */



#ifndef CODEMETHODBLOCK_H
#define CODEMETHODBLOCK_H

#include <tqstring.h>

#include "ownedcodeblock.h"
#include "codeblockwithcomments.h"
#include "umlnamespace.h"

class ClassifierCodeDocument;

/**
  * class CodeMethodBlock
  * A  common type of "code block" that occurs in OO code.
  */

class CodeMethodBlock : public CodeBlockWithComments, public OwnedCodeBlock
{
    friend class CodeGenObjectWithTextBlocks;
    Q_OBJECT
  
public:

    // Constructors/Destructors
    //


    /**
     * Constructors
     */
    CodeMethodBlock ( ClassifierCodeDocument * doc, UMLObject * parentObj,
                      const TQString & body = "", const TQString & comment = "");

    /**
     * Empty Destructor
     */
    virtual ~CodeMethodBlock ( );

    // Public attributes
    //

    /**
     * @return  TQString
     */
    virtual TQString toString ( );

    /**
     * Get the starting text that begins this method before the body is printed.
     */
    TQString getStartMethodText () const;

    /**
     * Get the ending text that finishes this method after the body is printed.
     */
    TQString getEndMethodText () const;

    // get the parent code document
    CodeDocument * getParentDocument();

protected:


    /** causes the text block to release all of its connections
     * and any other text blocks that it 'owns'.
     * needed to be called prior to deletion of the textblock.
     */
    virtual void release ();

    /**
     * Set the starting text that begins this method before the body is printed.
     */
    void setStartMethodText (const TQString &value);

    /**
     * Set the ending text that finishes this method after the body is printed.
     */
    void setEndMethodText (const TQString &value);

    /** this is the method called from within syncToparent().
      * to update the start and end Method text. It is called
                  * whether or not the method is Auto or User generated.
      */
    virtual void updateMethodDeclaration ( ) = 0;

    /** this is the method called from within syncToparent().
      * to update the *body* of the method
                  * It is only called if the method is Auto-generated.
      */
    virtual void updateContent ( ) = 0;

    /** set attributes of the node that represents this class
     * in the XMI document.
     */
    virtual void setAttributesOnNode ( TQDomDocument & doc, TQDomElement & blockElement);

    /** set the class attributes of this object from
     * the passed element node.
     */
    virtual void setAttributesFromNode ( TQDomElement & element);

    /** set the class attributes from a passed object
            */
    virtual void setAttributesFromObject (TextBlock * obj);

private:

    TQString m_startMethod;
    TQString m_endMethod;

    void initFields ( );

public slots:

    virtual void syncToParent();
};

#endif // CODEMETHODBLOCK_H