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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
|
#ifndef _PYTHONSETTINGS_H
#define _PYTHONSETTINGS_H
#ifdef WITHPYTHON
#include <qcstring.h>
#include "UmlSettings.h"
#include <qdict.h>
// This class manages settings concerning PYTHON, configured through
// the 'Generation settings' dialog.
//
// This class may be defined as a 'singleton', but I prefer to use static
// members allowing to just write 'PythonSettings::member' rather than
// 'PythonSettings::instance()->member' or other long sentence like this.
class PythonSettings : public UmlSettings {
public:
// return if classes follow Python 2.2 by default
static bool isPython_2_2();
// set if classes follow Python 2.2 by default
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_IsPython_2_2(bool y);
// return the default indent step
static const QCString & indentStep();
// set default indent step
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_IndentStep(char * v);
// returns TRUE when the created Python objects are initialized
// with the default declaration/definition
static bool useDefaults();
// if y is TRUE the future created Python objects will be initialized
// with the default declaration/definition
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_UseDefaults(bool y);
// returns the PYTHON stereotype corresponding to the 'UML' stereotype given
// in argument
static QCString relationAttributeStereotype(const QCString & s);
// set the PYTHON stereotype corresponding to the 'UML' stereotype given
// in argument
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_RelationAttributeStereotype(QCString s, QCString v);
// reverse of the RelationAttributeStereotype() operation, returns the 'UML'
// stereotype corresponding to the PYTHON one given in argument
static QCString relationAttributeUmlStereotype(const QCString & s);
// returns the PYTHON stereotype corresponding to the 'UML' stereotype given
// in argument
static QCString classStereotype(const QCString & s);
// set the PYTHON stereotype corresponding to the 'UML' stereotype given
// in argument
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_ClassStereotype(QCString s, QCString v);
// reverse of the ClassStereotype() operation, returns the 'UML'
// stereotype corresponding to the PYTHON one given in argument
static QCString classUmlStereotype(const QCString & s);
//returns the import or other form specified in the last
//'Generation settings' tab for the Python type given in argument.
static QCString get_import(const QCString & s);
// set the import or other form specified in the last
// 'Generation settings' tab for the Python type given in argument.
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_Import(QCString s, QCString v);
// return the 'root' directory
static const QCString & rootDir();
// set the 'root' directory
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_RootDir(QCString v);
// returns the default source file content
static const QCString & sourceContent();
// set the default source file content
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_SourceContent(QCString v);
// returns the extension of the file produced by the PYTHON code generator
static const QCString & sourceExtension();
// set the extension of the file produced by the PYTHON code generator
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_SourceExtension(QCString v);
// returns the default definition of a class
static const QCString & classDecl();
// set the default definition of a class
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_ClassDecl(QCString v);
// returns the default specification for an 'external' class
static const QCString & externalClassDecl();
// set the default specification for an 'external' class
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_ExternalClassDecl(QCString v);
// returns the default definition of an enumeration
static QCString enumDecl();
// set the default definition of an enumeration
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_EnumDecl(QCString v);
// returns the default definition of an attribute depending on the multiplicity
static const QCString & attributeDecl(const char * multiplicity);
// set the default definition of an attribute
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_AttributeDecl(const char * multiplicity, QCString v);
// returns the default definition of an enumeration item
static QCString enumItemDecl();
// set the default definition of an enumeration item
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_EnumItemDecl(QCString v);
// returns the default definition of a relation depending on it is an
// aggregation by value or not and the multiplicity, given in argument.
static const QCString & relationDecl(bool by_value, const char * multiplicity);
// set the default definition of a relation depending on it is an
// aggregation by value or not and the multiplicity, given in argument.
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_RelationDecl(bool by_value, const char * multiplicity, const char * v);
// returns the default definition of an operation
static const QCString & operationDef();
// set the default definition of an operation
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_OperationDef(QCString v);
// returns the default definition of __init__
static const QCString & initOperationDef();
// set the default definition of __init__
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_InitOperationDef(QCString v);
// returns the default name of a 'get' operation generated
// through the attribute and relation 'add get operation' menu
static const QCString & getName();
// set the default name of a 'get' operation generated
// through the attribute and relation 'add get operation' menu
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_GetName(QCString v);
// returns the default name of a 'set' operation generated
// through the attribute and relation 'add set operation' menu
static const QCString & setName();
// set the default name of a 'set' operation generated
// through the attribute and relation 'add set operation' menu
//
// On error : return FALSE in C++, produce a RuntimeException in Java
static bool set_SetName(QCString v);
private:
// never called !
PythonSettings() {};
static unsigned mult_column(const QCString & mult);
static bool _defined;
static bool _2_2;
static QCString _indent_step;
static QCString _root;
static QCString _class_decl;
static QCString _external_class_decl;
static QCString _enum_decl;
static QCString _attr_decl[2/*multiplicity*/];
static QCString _enum_item_decl;
static QCString _rel_decl[2/*relation kind*/][2/*multiplicity*/];
static QCString _oper_def;
protected:
static QCString _initoper_def;
private:
static QCString _get_name;
static QCString _set_name;
static QCString _src_content;
static QCString _ext;
static QDict<QCString> _map_imports;
protected:
static void read_();
static void read_if_needed_();
};
#endif
#endif
|