[Uml-devel] KDE/kdesdk/umbrello/umbrello/codegenerators
Andi Fischer
andi.fischer at hispeed.ch
Wed Mar 11 22:36:04 UTC 2009
SVN commit 938475 by fischer:
Some comments fixed.
M +20 -9 codegenerationpolicy.cpp
M +4 -25 codegenerationpolicy.h
M +19 -10 codegenerator.cpp
M +3 -17 codegenerator.h
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codegenerationpolicy.cpp #938474:938475
@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas at mail630.gsfc.nasa.gov> *
- * copyright (C) 2003-2008 *
+ * copyright (C) 2003-2009 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -27,27 +27,35 @@
// app includes
#include "uml.h"
#include "umldoc.h"
-#include "dialogs/codegenerationpolicypage.h"
+#include "codegenerationpolicypage.h"
#include "umbrellosettings.h"
using namespace std;
#define MAXLINES 256
-
+/**
+ * Constructor
+ */
CodeGenerationPolicy::CodeGenerationPolicy(CodeGenerationPolicy * clone)
{
// first call the function which can give us values from disk, so that we have something to fall back on
setDefaults(false);
// then set the values from the object passed.
- setDefaults(clone,false);
+ setDefaults(clone, false);
}
+/**
+ * Constructor
+ */
CodeGenerationPolicy::CodeGenerationPolicy()
{
setDefaults(false);
}
+/**
+ * Destructor
+ */
CodeGenerationPolicy::~CodeGenerationPolicy()
{
}
@@ -144,7 +152,7 @@
/**
* Set the value of m_headingFileDir
* location of the header file template.
- * @param new_var the new value of m_headingFileDir
+ * @param path the new value of m_headingFileDir
*/
void CodeGenerationPolicy::setHeadingFileDir ( const QString & path)
{
@@ -203,7 +211,7 @@
/**
* Set the value of m_lineEndingType
* What line ending characters to use.
- * @param new_var the new value of m_lineEndingType
+ * @param type the new value of m_lineEndingType
*/
void CodeGenerationPolicy::setLineEndingType ( NewLineType type)
{
@@ -235,6 +243,7 @@
/**
* Utility function to get the actual characters.
+ * @return the line ending characters
*/
QString CodeGenerationPolicy::getNewLineEndingChars ( ) const
{
@@ -263,6 +272,7 @@
/**
* Set how many units to indent for each indentation level.
+ * @param amount the amount of indentation units
*/
void CodeGenerationPolicy::setIndentationAmount ( int amount )
{
@@ -291,6 +301,9 @@
return m_indentation;
}
+/**
+ * Calculate the indentation.
+ */
void CodeGenerationPolicy::calculateIndentation ( )
{
QString indent;
@@ -337,7 +350,7 @@
/**
* Set the value of m_autoGenerateConstructors
- * @param new_var the new value
+ * @param var the new value
*/
void CodeGenerationPolicy::setAutoGenerateConstructors( bool var )
{
@@ -509,8 +522,6 @@
// this will be written to the disk from the place it was called :)
}
-// return the actual text
-
/**
* Gets the heading file (as a string) to be inserted at the
* beginning of the generated file. you give the file type as
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codegenerationpolicy.h #938474:938475
@@ -5,7 +5,7 @@
* (at your option) any later version. *
* *
* copyright (C) 2003 Brian Thomas <thomas at mail630.gsfc.nasa.gov> *
- * copyright (C) 2004-2008 *
+ * copyright (C) 2004-2009 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -23,6 +23,8 @@
/**
* class CodeGenerationPolicy
* This class describes the code generation policy for this project.
+ * Note that as the code gen policy may be the 'default' policy, it may
+ * not be coupled with a code generator.
*/
class CodeGenerationPolicy : public QObject
{
@@ -47,73 +49,52 @@
enum IndentationType {NONE=0, TAB, SPACE};
enum CommentStyle { SingleLine=0, MultiLine };
- /**
- * Constructor
- */
- // note that as the code gen policy may be the 'default' policy, it may
- // not be coupled with a code generator.
CodeGenerationPolicy (CodeGenerationPolicy * clone);
CodeGenerationPolicy ();
- /**
- * Empty Destructor
- */
virtual ~CodeGenerationPolicy ( );
void setOverwritePolicy ( OverwritePolicy new_var );
-
OverwritePolicy getOverwritePolicy ( ) const;
void setCodeVerboseSectionComments ( bool new_var );
-
bool getCodeVerboseSectionComments ( ) const;
void setCodeVerboseDocumentComments ( bool new_var );
-
bool getCodeVerboseDocumentComments ( ) const;
void setHeadingFileDir ( const QString & path);
-
QString getHeadingFileDir ( ) const;
void setIncludeHeadings ( bool new_var );
-
bool getIncludeHeadings ( ) const;
void setOutputDirectory ( QDir new_var );
-
QDir getOutputDirectory ( );
- void setLineEndingType ( NewLineType new_var );
-
+ void setLineEndingType ( NewLineType type );
NewLineType getLineEndingType ( );
QString getNewLineEndingChars ( ) const;
void setIndentationType ( IndentationType type );
-
IndentationType getIndentationType ( );
void setIndentationAmount ( int amount );
-
int getIndentationAmount ( );
QString getIndentation ( ) const;
void setModifyPolicy ( ModifyNamePolicy new_var );
-
ModifyNamePolicy getModifyPolicy ( ) const;
void setAutoGenerateConstructors ( bool var );
-
bool getAutoGenerateConstructors ( );
void setAttributeAccessorScope(Uml::Visibility::Value var);
-
Uml::Visibility::Value getAttributeAccessorScope();
void setAssociationFieldScope(Uml::Visibility::Value var);
-
Uml::Visibility::Value getAssociationFieldScope();
virtual CodeGenerationPolicyPage * createPage ( QWidget *parent = 0, const char * name = 0);
@@ -121,7 +102,6 @@
QString getHeadingFile(const QString& str);
virtual void setDefaults (CodeGenerationPolicy * defaults, bool emitUpdateSignal = true);
-
virtual void setDefaults(bool emitUpdateSignal = true);
virtual void writeConfig ();
@@ -129,7 +109,6 @@
void emitModifiedCodeContentSig();
void setCommentStyle ( CommentStyle new_var );
-
CommentStyle getCommentStyle ( );
signals:
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codegenerator.cpp #938474:938475
@@ -48,14 +48,20 @@
// system includes
#include <cstdlib> // to get the user name
+/**
+ * Constructor for a code generator.
+ */
CodeGenerator::CodeGenerator ()
: QObject (UMLApp::app()->getDocument())
{
initFields();
}
-// FIX
-// hmm. this should be pure virtual so that implemented in sub-class
+/**
+ * Constructor for a code generator and then initialize it from an XMI element.
+ * FIX: hmm. this should be pure virtual so that implemented in sub-class.
+ * @param element an element from an XMI document
+ */
CodeGenerator::CodeGenerator (QDomElement & element )
: QObject (UMLApp::app()->getDocument())
{
@@ -63,6 +69,9 @@
loadFromXMI(element); // hmm. cant call this here.. it is 'pure' virtual
}
+/**
+ * Destructor.
+ */
CodeGenerator::~CodeGenerator ()
{
// destroy all owned codedocuments
@@ -176,7 +185,8 @@
}
/**
- * @param element
+ * Load codegenerator data from xmi.
+ * @param qElement the element from which to load
*/
void CodeGenerator::loadFromXMI (QDomElement & qElement )
{
@@ -217,10 +227,9 @@
}
}
-// probably we have code which was entered in classpropdlg for an operation
-
/**
* Extract and load code for operations from xmi section.
+ * Probably we have code which was entered in classpropdlg for an operation.
*/
void CodeGenerator::loadCodeForOperation(const QString& idStr, const QDomElement& codeDocElement)
{
@@ -552,9 +561,9 @@
* Opens a file named "name" for writing in the outputDirectory.
* If something goes wrong, it informs the user
* if this function returns true, you know you can write to the file.
- * @return bool
- * @param file
- * @param name
+ * @param file file descriptor
+ * @param fileName the name of the file
+ * @return success state
*/
bool CodeGenerator::openFile (QFile & file, const QString &fileName )
{
@@ -590,7 +599,7 @@
* account the Overwrite Policy and asking the user what to do if need be
* (if policy == Ask).
*
- * @param doc the CodeDocument for which an output file name is desired.
+ * @param codeDocument the CodeDocument for which an output file name is desired.
* @return the file name that should be used. (with extension) or
* NULL if none to be used
*/
@@ -847,7 +856,7 @@
* Check whether the given string is a reserved word for the
* language of this code generator.
*
- * @param rPossiblyReservedKeyword is the string to check
+ * @param keyword string to check
*
*/
bool CodeGenerator::isReservedKeyword(const QString & keyword)
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codegenerator.h #938474:938475
@@ -71,22 +71,9 @@
public:
- /**
- * Build a code generator.
- * @return CodeGenerator
- */
CodeGenerator ();
-
- /**
- * Build a code generator and then initialize it from an XMI element.
- * @return CodeGenerator
- * @param element an element from an XMI document
- */
CodeGenerator (QDomElement & element );
- /**
- * Empty Destructor.
- */
virtual ~CodeGenerator ( );
bool addCodeDocument ( CodeDocument * add_object );
@@ -112,7 +99,6 @@
CodeDocument * findCodeDocumentByID (const QString &id );
virtual void writeCodeToFile ( );
-
virtual void writeCodeToFile(UMLClassifierList &list);
// these are utility methods for accessing the default
@@ -136,11 +122,11 @@
virtual QString getHeadingFile (const QString &file );
- QString findFileName(CodeDocument * doc);
+ QString findFileName(CodeDocument * codeDocument);
static QString cleanName ( const QString &name );
- static QString formatDoc (const QString & text, const QString & linePrefix = " *", int lineWidth = 80 );
+ static QString formatDoc (const QString& text, const QString& linePrefix = " *", int lineWidth = 80 );
static QString formatSourceCode(const QString& code, const QString& indentation);
@@ -175,7 +161,7 @@
virtual CodeViewerDialog * getCodeViewerDialog( QWidget* parent, CodeDocument * doc,
Settings::CodeViewerState state);
- virtual bool isReservedKeyword(const QString & rPossiblyReservedKeyword);
+ virtual bool isReservedKeyword(const QString & keyword);
/**
* Get list of reserved keywords.
More information about the umbrello-devel
mailing list