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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
// *************************************************************************
//
// Copyright 2004-2010 Bruno PAGES .
//
// This file is part of the BOUML Uml Toolkit.
//
// 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 program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// e-mail : bouml@free.fr
// home : http://bouml.free.fr
//
// *************************************************************************
#ifndef CLASSDATA_H
#define CLASSDATA_H
#include "AType.h"
#include "UmlEnum.h"
#include "BasicData.h"
class ActualParamData;
class FormalParamData;
class ClassData : public BasicData {
Q_OBJECT
friend class ClassDialog;
friend class ActualParamsTable;
protected:
MyStr constraint;
FormalParamData * formals; // remark : do NOT use QArray
QList<ActualParamData> actuals;
AType base_type; // typedef
unsigned char nformals;
bool is_deleted : 1;
bool is_abstract : 1;
bool is_active : 1;
bool bodies_read : 1;
bool bodies_modified : 1;
bool cpp_external : 1; // C++
bool java_external : 1; // Java
bool java_final : 1; // Java
bool php_external : 1; // Php
bool php_final : 1; // Php
bool python_external : 1; // Python
bool python_2_2 : 1; // Python 2.2 ..2.6
bool idl_external : 1; // Idl
bool idl_local : 1; // Idl (interface)
bool idl_custom : 1; // Idl (valuetype)
UmlVisibility uml_visibility : 4;
// C++
UmlVisibility cpp_visibility : 4;
SharedStr cpp_decl;
// Java
SharedStr java_decl;
SharedStr java_annotation;
// Php
SharedStr php_decl;
// Python
SharedStr python_decl;
// IDL
AType switch_type; // union
SharedStr idl_decl;
static bool DontUpdateActuals;
//
virtual void send_uml_def(ToolCom * com, BrowserNode * bn,
const QString & comment);
virtual void send_cpp_def(ToolCom * com);
virtual void send_java_def(ToolCom * com);
virtual void send_php_def(ToolCom * com);
virtual void send_python_def(ToolCom * com);
virtual void send_idl_def(ToolCom * com);
void update_actuals(BrowserClass *,
QList<ActualParamData> & new_actuals,
QList<ActualParamData> & managed);
void get_actuals(QList<ActualParamData> & l, BrowserClass * parent);
public:
ClassData();
ClassData(const ClassData * model, BrowserNode * bn);
virtual ~ClassData();
virtual bool deletedp() const;
virtual void set_deletedp(bool y);
void edit();
const char * get_constraint() const { return constraint; }
virtual bool decldefbody_contain(const QString & s, bool cs, BrowserNode *);
bool get_is_abstract() const { return is_abstract; }
void set_is_abstract(bool yes);
bool get_is_active() const { return is_active; }
void set_is_active(bool yes);
const AType & get_base_type() const { return base_type; }
QString get_full_base_type_def() const;
void set_base_type(const AType & t);
void inherit_or_instantiate(BrowserClass * other);
UmlVisibility get_uml_visibility() const { return uml_visibility; }
UmlVisibility get_cpp_visibility() const { return cpp_visibility; }
void set_uml_visibility(UmlVisibility v);
void set_cpp_visibility(UmlVisibility v);
int get_n_formalparams() const { return nformals; }
const char * get_formalparam_type(int) const;
const char * get_formalparam_name(int) const;
QString get_formalparam_default_value(int, bool) const;
QString get_formalparam_extends(int, bool) const;
void set_n_formalparams(int);
void set_formalparam_type(int, const char *);
void set_formalparam_name(int, const char *);
void set_formalparam_default_value(int, BrowserClass * t, const char * e);
void set_formalparam_extends(int, BrowserClass * t, const char * e);
void get_template_prefixes(QString & template1, QString & template2) const;
void get_class_spec(QString & templates, QString & names,
QString & templates_tmplop, QString & names_tmplop) const;
void addFormals(QStringList &);
int get_n_actualparams() const { return actuals.count(); }
QString get_actualparam_name(int); // cannot be const, computed QString
QString get_actualparam_value(int); // cannot be const, computed QString
void set_actualparam_value(int, const AType & t);
QString get_actuals(BrowserClass * parent);
const char * get_cppdecl() const { return cpp_decl; }
bool cpp_is_external() const { return cpp_external; }
const char * get_javadecl() const { return java_decl; }
bool java_is_external() const { return java_external; }
bool java_is_final() const { return java_final; }
const char * get_phpdecl() const { return php_decl; }
bool php_is_external() const { return php_external; }
bool php_is_final() const { return php_final; }
const char * get_pythondecl() const { return python_decl; }
bool python_is_external() const { return python_external; }
bool python_is_2_2() const { return python_2_2; }
const char * get_idldecl() const { return idl_decl; }
const AType & get_switch_type() const { return switch_type; }
void set_switch_type(const AType & t);
bool idl_is_external() const { return idl_external; }
bool idl_is_local() const { return idl_local; }
bool idl_is_custom() const { return idl_custom; }
bool reference(BrowserClass *) const;
virtual bool tool_cmd(ToolCom * com, const char * args,
BrowserNode * bn, const QString & comment);
void save(QTextStream &, QString & warning) const;
void read(char * & st, char * & k);
bool get_bodies_read() { return bodies_read; }
void set_bodies_read(bool y) { bodies_read = y; }
bool get_bodies_modified() { return bodies_modified; }
void set_bodies_modified(bool y) { bodies_modified = y; }
void manage_deleted();
static void setDontUpdateActuals(bool y) { DontUpdateActuals = y; }
class ToolCmd {
public:
ToolCmd() { ClassData::setDontUpdateActuals(TRUE); }
~ToolCmd() { ClassData::setDontUpdateActuals(FALSE); }
};
private slots:
void update_actuals();
void on_delete();
signals:
void actuals_changed();
};
#endif
|