umbrello API Documentation

codegenerationpolicy.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2004-2006                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 /*  This code generated by:
00013  *      Author : thomas
00014  *      Date   : Fri Jun 20 2003
00015  */
00016 
00017 
00018 
00019 #ifndef CODEGENERATIONPOLICY_H
00020 #define CODEGENERATIONPOLICY_H
00021 
00022 #include <qobject.h>
00023 #include <qdir.h>
00024 #include <qdom.h>
00025 
00026 class QWidget;
00027 class KConfig;
00028 class CodeGenerationPolicyPage;
00029 
00035 class CodeGenerationPolicy : public QObject {
00036     Q_OBJECT
00037 public:
00038 
00051     enum OverwritePolicy {Ok=0, Ask, Never, Cancel};
00052     enum ModifyNamePolicy {No=0, Underscore, Capitalise};
00053     enum NewLineType {UNIX=0, DOS, MAC};
00054     enum IndentationType {NONE=0, TAB, SPACE};
00055     enum CommentStyle { SingleLine=0, MultiLine };
00056     enum ScopePolicy { Public=200, Private, Protected, FromParent };
00057 
00058     // set some reasonable defaults
00059     OverwritePolicy  defaultOverwritePolicy()          const;
00060     bool             defaultVerboseSectionComments()   const;
00061     bool             defaultVerboseDocumentComments()  const;
00062     bool             defaultIncludeHeadings()          const;
00063     NewLineType      defaultLineEndingType()           const;
00064     IndentationType  defaultIndentType()               const;
00065     int              defaultIndentAmount()             const;
00066     ModifyNamePolicy defaultModifyNamePolicy()         const;
00067     CommentStyle     defaultCommentStyle()             const;
00068     ScopePolicy      defaultAttribAccessorScope()      const;
00069     ScopePolicy      defaultAssocFieldScope()          const;
00070     bool             defaultAutoGenerateConstructors() const;
00071 
00072     // Constructors/Destructors
00073     //
00074 
00078     // note that as the code gen policy may be the 'default' policy, it may
00079     // not be coupled with a code generator.
00080     CodeGenerationPolicy (CodeGenerationPolicy * clone = 0);
00081     CodeGenerationPolicy (KConfig * config );
00082 
00086     virtual ~CodeGenerationPolicy ( );
00087 
00088     // Public attributes
00089     //
00090 
00091     // Public attribute accessor methods
00092     //
00093 
00110     void setOverwritePolicy ( OverwritePolicy new_var );
00111 
00118     OverwritePolicy getOverwritePolicy ( ) const;
00119 
00120 
00127     void setCodeVerboseSectionComments ( bool new_var );
00128 
00135     bool getCodeVerboseSectionComments ( ) const;
00136 
00137 
00145     void setCodeVerboseDocumentComments ( bool new_var );
00146 
00154     bool getCodeVerboseDocumentComments ( ) const;
00155 
00161     void setHeadingFileDir ( const QString & path);
00162 
00168     QString getHeadingFileDir ( ) const;
00169 
00170 
00175     void setIncludeHeadings ( bool new_var );
00176 
00181     bool getIncludeHeadings ( ) const;
00182 
00183 
00189     void setOutputDirectory ( QDir new_var );
00190 
00196     QDir getOutputDirectory ( );
00197 
00203     void setLineEndingType ( NewLineType new_var );
00204 
00210     NewLineType getLineEndingType ( );
00211 
00214     QString getNewLineEndingChars ( ) const;
00215 
00221     void  setIndentationType ( IndentationType type );
00222 
00226     IndentationType getIndentationType ( );
00227 
00230     void  setIndentationAmount ( int amount );
00231     int getIndentationAmount ( );
00232 
00238     QString getIndentation ( ) const;
00239 
00244     void setModifyPolicy ( ModifyNamePolicy new_var );
00245 
00250     ModifyNamePolicy getModifyPolicy ( ) const;
00251 
00256     void setAutoGenerateConstructors ( bool var );
00257 
00262     bool getAutoGenerateConstructors ( );
00263 
00268     void setAttributeAccessorScope(ScopePolicy var);
00269 
00274     ScopePolicy getAttributeAccessorScope();
00275 
00280     void setAssociationFieldScope(ScopePolicy var);
00281 
00286     ScopePolicy getAssociationFieldScope();
00287 
00292     virtual CodeGenerationPolicyPage * createPage ( QWidget *parent = 0, const char * name = 0);
00293 
00309     QString getHeadingFile(QString str);
00310 
00314     virtual void setDefaults (CodeGenerationPolicy * defaults, bool emitUpdateSignal = true);
00315 
00319     virtual void setDefaults(KConfig * config, bool emitUpdateSignal = true);
00320 
00324     virtual void writeConfig (KConfig * config);
00325 
00326     void emitModifiedCodeContentSig();
00327 
00332     void setCommentStyle ( CommentStyle new_var );
00333 
00338     CommentStyle getCommentStyle ( );
00339 
00340 signals:
00341 
00342     // this signal is sent whenever a change is made to the policy
00343     // which could modifiy code document content
00344     void modifiedCodeContent();
00345 
00346 protected:
00347 
00348     // Policy of how to deal with overwriting existing files. Allowed values are "ask", "yes" and "no".
00349     OverwritePolicy m_overwritePolicy;
00350 
00351     // Whether or not verbose code commenting for sections is desired.
00352     // If true, comments for sections will be written even if the section is empty.
00353     bool m_codeVerboseSectionComments;
00354 
00355     // Whether or not verbose code commenting for documentation is desired.
00356     // If true, documentation for various code will be written even if no
00357     //code would normally be created at that point in the file.
00358     bool m_codeVerboseDocumentComments;
00359 
00360     QDir m_headingFiles; // location of the header file template.
00361     bool m_includeHeadings;
00362     QDir m_outputDirectory; // location of where output files will go.
00363     NewLineType m_lineEndingType; // What type of line ending characters to use.
00364     IndentationType m_indentationType; // The amount and type of whitespace to indent with.
00365     int m_indentationAmount; // The amount of units to indent with.
00366     ModifyNamePolicy m_modifyPolicy;
00367     bool m_autoGenerateConstructors;
00368     CommentStyle m_commentStyle;
00369     ScopePolicy m_attributeAccessorScope;
00370     ScopePolicy m_associationFieldScope;
00371 
00372     // these 2 private fields 'cache' the string values of other fields we may frequently call for
00373     QString m_lineEndingChars;
00374     QString m_indentation;
00375 
00376     void calculateIndentation ( );
00377 
00378 protected:
00379 
00380     void initFields ( );
00381 
00382 };
00383 
00384 #endif // CODEGENERATIONPOLICY_H
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:55 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003