summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codegenerators/perlwriter.h
blob: dd8ad6774a1d990900f0fe72555ae3bb3b640463 (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
/***************************************************************************
                          perlwriter.h  -  description
                             -------------------
    begin                : Wed Jan 22 2003
    copyright            : (C) 2003 by David Hugh-Jones
    email                : hughjonesd@yahoo.co.uk
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 PERLWRITER_H
#define PERLWRITER_H

#include "simplecodegenerator.h"
#include "../umlattributelist.h"
#include "../umloperationlist.h"

class UMLOperation;
class UMLAttribute;
class UMLClassifier;

/**
  * class PerlWriter is a Perl code generator for UMLClassifier objects
  * Just call writeClass and feed it a UMLClassifier;
  */
class PerlWriter : public SimpleCodeGenerator {
    Q_OBJECT
  
public:

    PerlWriter();
    virtual ~PerlWriter();

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

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

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

    TQStringList defaultDatatypes();

private:

    /**
     * we do not want to write the comment "Private methods" twice
     * not sure whether this is php specific
     */
    bool bPrivateSectionCommentIsWritten;

    /**
      * write all operations for a given class
      *
      * @param c the concept we are generating code for
      * @param perl output stream for the Perl file
      */
    void writeOperations(UMLClassifier *c, TQTextStream &perl);

    /**
      * write a list of class operations
      *
      * @param classname the name of the class
      * @param opList the list of operations
      * @param perl output stream for the Perl file
      */
    void writeOperations(const TQString &classname, UMLOperationList &opList,
                         TQTextStream &perl);

    /** write all the attributes of a class
      * @param c the class we are generating code for
      * @param perl output stream for the Perl file
      */
    void writeAttributes(UMLClassifier *c, TQTextStream &perl);

    /** write a list of class attributes
      * @param atList the list of attributes
      * @param perl output stream for the Perl file
      */
    void writeAttributes(UMLAttributeList &atList, TQTextStream &perl);

    bool GetUseStatements(UMLClassifier *c, TQString &Ret,
                          TQString &ThisPkgName);

};

#endif //PERLWRITER