summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codegenerators/simplecodegenerator.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbd9e6617827818fd043452c08c606f07b78014a0 (patch)
tree425bb4c3168f9c02f10150f235d2cb998dcc6108 /umbrello/umbrello/codegenerators/simplecodegenerator.h
downloadtdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz
tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'umbrello/umbrello/codegenerators/simplecodegenerator.h')
-rw-r--r--umbrello/umbrello/codegenerators/simplecodegenerator.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/umbrello/umbrello/codegenerators/simplecodegenerator.h b/umbrello/umbrello/codegenerators/simplecodegenerator.h
new file mode 100644
index 00000000..d75a0660
--- /dev/null
+++ b/umbrello/umbrello/codegenerators/simplecodegenerator.h
@@ -0,0 +1,120 @@
+/***************************************************************************
+ * *
+ * 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 code generated by:
+ * Author : thomas
+ * Date : Sep Mon 1 2003
+ *
+ * copyright (C) 2004
+ * Umbrello UML Modeller Authors <uml-devel@uml.sf.net>
+ */
+
+
+#ifndef SIMPLECODEGENERATOR_H
+#define SIMPLECODEGENERATOR_H
+
+#include <qstringlist.h>
+#include <qstring.h>
+#include <qmap.h>
+
+#include "../codegenerator.h"
+#include "../umlnamespace.h"
+
+class UMLDoc;
+
+/**
+ * A simple code generator interface designed to work with
+ * the existing codewriters.
+ */
+class SimpleCodeGenerator : public CodeGenerator
+{
+ Q_OBJECT
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ SimpleCodeGenerator (bool createDirHierarchyForPackages = true);
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~SimpleCodeGenerator ( );
+
+ // Public attribute accessor methods
+ //
+
+ void writeCodeToFile ( UMLClassifierList & concepts);
+ void writeCodeToFile ( );
+
+ /**
+ * call this method to generate code for a UMLClassifier
+ * @param c the class you want to generate code for.
+ */
+ virtual void writeClass(UMLClassifier *c) = 0;
+
+ /**
+ * This is implemented only because we HAVE to.
+ * @return ClassifierCodeDocument
+ * @param classifier
+ */
+ CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier);
+
+protected:
+
+ // compatability methods..
+ QString findFileName(UMLPackage* concept, const QString &ext);
+ QString overwritableName(UMLPackage* concept, const QString &name, const QString &ext);
+ bool hasDefaultValueAttr(UMLClassifier *c);
+ bool hasAbstractOps(UMLClassifier *c);
+
+ /**
+ * Returns the current indent string based on m_indentLevel and m_indentation.
+ */
+ QString getIndent ();
+
+ /**
+ * Maps UMLObjects to filenames. Used for finding out which file
+ * each class was written to.
+ */
+ QMap<UMLPackage*,QString> m_fileMap;
+
+ // the parent document
+ UMLDoc *m_doc;
+
+ /**
+ * For some code generators, it does not make much sense to create a
+ * directory for each package because that would lead to a rather
+ * sparsely populated directory tree (maximum of just one source file
+ * per directory.)
+ */
+ bool m_createDirHierarchyForPackages;
+
+ /* Old Attributes writers will look for */
+ QString m_indentation;
+ int m_indentLevel;
+ QString m_endl;
+
+ // override parent method..we need special handling
+ void initFromParentDocument( );
+
+private:
+
+ void initFields ( UMLDoc * doc) ;
+
+public slots:
+
+ void syncCodeToDocument ( );
+
+};
+
+#endif // SIMPLECODEGENERATOR_H