summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codegenerators/adawriter.h
blob: 17affb459eddd20786c708e897fa47c13e528ecf (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
/***************************************************************************
                          adawriter.h  -  description
                             -------------------
    Based on javawriter.h by Luis De la Parra Blum
    begin                : Sat Dec 14 2002
    copyright            : (C) 2002 by Oliver Kellogg
    email                : okellogg@users.sourceforge.net
 ***************************************************************************/

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

#ifndef ADAWRITER_H
#define ADAWRITER_H

#include "simplecodegenerator.h"

class UMLAssociation;
class UMLOperation;

/**
  * class AdaWriter is a code generator for UMLClassifier objects.
  * Create an instance of this class, and feed it a UMLClassifier when
  * calling writeClass and it will generate an Ada package spec for
  * that concept
  */
class AdaWriter : public SimpleCodeGenerator {
    TQ_OBJECT
  
public:

    /**
     * Basic Constructor
     */
    AdaWriter ();

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

    /**
     * call this method to generate Ada code for a UMLClassifier
     * @param c the class to generate code for
     */
    virtual void writeClass (UMLClassifier *c);

    /**
     * returns "Ada"
     */
    virtual Uml::Programming_Language getLanguage();

    TQStringList defaultDatatypes();

    /**
     * Check whether the given string is a reserved word for the
     * language of this code generator
     *
     * @param rPossiblyReservedKeyword  The string to check.
     * @return true if the keyword is reserved
     */
    virtual bool isReservedKeyword(const TQString & rPossiblyReservedKeyword);

    /**
     * get list of reserved keywords
     */
    virtual const TQStringList reservedKeywords() const;

private:

    /**
     * write one operation
     * @param op the class for which we are generating code
     * @param ada the stream associated with the output file
     */
    void writeOperation (UMLOperation *op, TQTextStream &ada, bool is_comment = false);

    /**
     * Compute the type and role name from the given association.
     *
     * @param c         The UMLClassifier for which code is being generated.
     * @param a         The UMLAssociation to analyze.
     * @param typeName  Return value: type name.
     * @param roleName  Return value: role name.
     */
    void computeAssocTypeAndRole (UMLClassifier *c,
                                  UMLAssociation *a,
                                  TQString& typeName, TQString& roleName);

    bool isOOClass (UMLClassifier *c);

    TQString className(UMLClassifier *c, bool inOwnScope = true);

    TQString packageName(UMLPackage *p);

    static const TQString defaultPackageSuffix;

};

#endif // ADAWRITER_H