~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to umbrello/umbrello/codegenerators/dcodegenerator.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
Import upstream version 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/***************************************************************************
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 *                                                                         *
 
9
 *   copyright (C) 2007 Jari-Matti Mäkelä <jmjm@iki.fi>                    *
 
10
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 
11
 ***************************************************************************/
 
12
 
 
13
#ifndef DCODEGENERATOR_H
 
14
#define DCODEGENERATOR_H
 
15
 
 
16
#include <qstring.h>
 
17
#include "../codeviewerstate.h"
 
18
#include "../codegenerator.h"
 
19
#include "../codeblockwithcomments.h"
 
20
#include "../umldoc.h"
 
21
 
 
22
#include "dclassifiercodedocument.h"
 
23
 
 
24
#include "dcodegenerationpolicy.h"
 
25
 
 
26
class CodeViewerDialog;
 
27
 
 
28
class DCodeGenerator : public CodeGenerator
 
29
{
 
30
    Q_OBJECT
 
31
public:
 
32
 
 
33
    /**
 
34
     * Empty Constructor
 
35
     */
 
36
    DCodeGenerator ();
 
37
    DCodeGenerator (QDomElement & element);
 
38
 
 
39
    /**
 
40
     * Empty Destructor
 
41
     */
 
42
    virtual ~DCodeGenerator ( );
 
43
 
 
44
    // Public attributes
 
45
    //
 
46
 
 
47
 
 
48
    // Public attribute accessor methods
 
49
    //
 
50
 
 
51
    /**
 
52
     * A utility method to get the dCodeGenerationPolicy()->getAutoGenerateAttribAccessors() value.
 
53
     */
 
54
    bool getAutoGenerateAttribAccessors( );
 
55
 
 
56
    /**
 
57
     * A utility method to get the dCodeGenerationPolicy()->getAutoGenerateAssocAccessors() value.
 
58
     */
 
59
    bool getAutoGenerateAssocAccessors( );
 
60
 
 
61
    /**
 
62
     * Get the list variable class name to use. For D, we have set this to "Vector".
 
63
     */
 
64
    static QString getListFieldClassName();
 
65
 
 
66
    /** Get the editing dialog for this code document
 
67
     */
 
68
    virtual CodeViewerDialog * getCodeViewerDialog( QWidget* parent, CodeDocument * doc,
 
69
            Settings::CodeViewerState state);
 
70
 
 
71
    // Other methods
 
72
    //
 
73
 
 
74
    // general purpose function we may reuse for all types of D code documents
 
75
    static QString capitalizeFirstLetter(const QString &string);
 
76
 
 
77
    /**
 
78
     * Utility function for getting the d code generation policy.
 
79
     */
 
80
    DCodeGenerationPolicy * getDPolicy();
 
81
 
 
82
    /**
 
83
     * @return  ClassifierCodeDocument
 
84
     * @param   classifier
 
85
     */
 
86
    CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier);
 
87
 
 
88
    // return "D"
 
89
    Uml::Programming_Language getLanguage();
 
90
 
 
91
    /**
 
92
     * Adds D's primitives as datatypes
 
93
     */
 
94
    virtual QStringList defaultDatatypes();
 
95
 
 
96
    /**
 
97
     * IF the type is "string" we need to declare it as
 
98
     * the D Object "String" (there is no string primative in D).
 
99
     * Same thing again for "bool" to "boolean".
 
100
     */
 
101
    static QString fixTypeName(const QString &string);
 
102
 
 
103
    /**
 
104
     * get list of reserved keywords
 
105
     */
 
106
    virtual const QStringList reservedKeywords() const;
 
107
 
 
108
protected:
 
109
 
 
110
    /** create the codeblock that will represent the class declaration
 
111
     *  for this classifier
 
112
     */
 
113
    CodeBlockWithComments * createClassDecl ( UMLClassifier *c, DClassifierCodeDocument * doc);
 
114
 
 
115
private:
 
116
 
 
117
    void init();
 
118
};
 
119
 
 
120
#endif // DCODEGENERATOR_H