umbrello/umbrello
codegenerator.cpp
Go to the documentation of this file.
212 else if (docTag == QLatin1String("codedocument") || docTag == QLatin1String("classifiercodedocument")) {
233 void CodeGenerator::loadCodeForOperation(const QString& idStr, const QDomElement& codeDocElement)
615 KMessageBox::sorry(0, i18n("Cannot open file %1 for writing. Please make sure the folder exists and you have permissions to write to it.", file.fileName()), i18n("Cannot Open File"));
UMLObject * getObject(Uml::RoleType::Enum role) const
Returns the UMLObject assigned to the given role.
Definition: association.cpp:497
void clear()
Used by CodeGenerator::findFileName when it needs to ask the user if they want to overwrite and exist...
Definition: overwritedialog.h:29
This class contains the non-graphical information required for a UML Package.
Definition: package.h:32
iterator insert(const Key &key, const T &value)
This class defines the non-graphical information required for a UML Classifier (ie a class or interfa...
Definition: classifier.h:39
QString overwritableName(const QString &name, const QString &extension)
Remove (and possibly delete) all AutoGenerated content type CodeDocuments but leave the UserGenerated...
Definition: codegenerator.cpp:517
UMLClassifier * getType() const
Returns the type of the UMLClassifierListItem.
Definition: classifierlistitem.cpp:100
virtual CodeViewerDialog * getCodeViewerDialog(QWidget *parent, CodeDocument *doc, Settings::CodeViewerState state)
Get the editing dialog for this code document.
Definition: codegenerator.cpp:181
virtual void loadFromXMI(QDomElement &element)
Load codegenerator data from xmi.
Definition: codegenerator.cpp:191
class ClassifierCodeDocument A CodeDocument which represents a UMLClassifier (e.g.
Definition: classifiercodedocument.h:32
QDomNode appendChild(const QDomNode &newChild)
Definition: basictypes.h:215
bool addCodeDocument(CodeDocument *add_object)
Add a CodeDocument object to the m_codedocumentVector List.
Definition: codegenerator.cpp:127
bool openFile(QFile &file, const QString &name)
Opens a file named "name" for writing in the outputDirectory.
Definition: codegenerator.cpp:601
QString attribute(const QString &name, const QString &defValue) const
QString getNewLineEndingChars() const
Utility function to get the actual characters.
Definition: codegenerationpolicy.cpp:248
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
virtual bool isReservedKeyword(const QString &keyword)
Check whether the given string is a reserved word for the language of this code generator.
Definition: codegenerator.cpp:891
Definition: basictypes.h:216
const T & at(int i) const
virtual void loadFromXMI(QDomElement &root)
Load params from the appropriate XMI element node.
Definition: codedocument.cpp:348
QString fileName() const
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QString simplified() const
void setFileName(const QString &name)
virtual void writeCodeToFile()
This method is here to provide class wizard the ability to write out only those classes which are sel...
Definition: codegenerator.cpp:390
class CodeGenerationPolicy This class describes the code generation policy for this project...
Definition: codegenerationpolicy.h:29
This sub-class adds copyInto and clone to the QPtrList base class.
Definition: umlattributelist.h:26
void setCodeVerboseDocumentComments(bool new_var)
Set the value of m_codeVerboseDocumentComments Whether or not verbose code commenting for documentati...
Definition: codegenerationpolicy.cpp:134
virtual CodeDocument * newCodeDocument()
Create a new Code document belonging to this package.
Definition: codegenerator.cpp:473
Definition: umlobject.h:60
virtual QString getHeadingFile(const QString &file)
Gets the heading file (as a string) to be inserted at the beginning of the generated file...
Definition: codegenerator.cpp:497
UMLClassifier * getParentClassifier()
Get the value of m_parentclassifier.
Definition: classifiercodedocument.cpp:271
QString & remove(int position, int n)
CodeDocument * findCodeDocumentByID(const QString &id)
Find a code document by the given id string.
Definition: codegenerator.cpp:112
virtual QString getPath()
Get the value of the path to this code document.
Definition: codedocument.cpp:100
int size() const
Definition: basictypes.h:104
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QDomNode nextSibling() const
This class contains the non-graphic representation of an association.
Definition: association.h:32
virtual void checkAddUMLObject(UMLObject *obj)
This function checks for adding objects to the UMLDocument.
Definition: codegenerator.cpp:343
QDir getOutputDirectory()
Get the value of m_outputDirectory location of where output files will go.
Definition: codegenerationpolicy.cpp:206
QDomElement toElement() const
UMLAssociationList getAssociations()
Return the list of associations for the CanvasObject.
Definition: umlcanvasobject.cpp:337
bool getCodeVerboseDocumentComments() const
Get the value of m_codeVerboseDocumentComments Whether or not verbose code commenting for documentati...
Definition: codegenerationpolicy.cpp:147
const char * name() const
virtual Uml::ProgrammingLanguage::Enum language() const =0
Return the unique language enum that identifies this type of code generator.
static QString toString(ObjectType ot)
Helper function for debug output.
Definition: umlobject.cpp:1079
QString number(int n, int base)
int count(const T &value) const
bool exists() const
void append(const T &value)
void setSourceCode(const QString &code)
Sets the source code for this operation.
Definition: operation.cpp:432
bool isInterface() const
Returns true if this classifier represents an interface.
Definition: classifier.cpp:117
virtual void finalizeRun()
A single call to writeCodeToFile() usually entails processing many items (e.g.
Definition: codegenerator.cpp:465
virtual QStringList reservedKeywords() const
Get list of reserved keywords.
Definition: codegenerator.cpp:900
void setAttribute(const QString &name, const QString &value)
void codeGenerated(UMLClassifier *concept, bool generated)
bool isEmpty() const
int removeAll(const T &value)
Uml::AssociationType::Enum getAssocType() const
Returns the AssociationType::Enum of the UMLAssociation.
Definition: association.cpp:103
virtual QStringList defaultDatatypes()
Return the default datatypes for your language (bool, int etc).
Definition: codegenerator.cpp:878
QString toString(Enum item)
Return string corresponding to the given ProgrammingLanguage.
Definition: basictypes.cpp:807
QString getUniqueID(CodeDocument *codeDoc)
Get a unique id for this codedocument.
Definition: codegenerator.cpp:80
virtual void saveToXMI(QDomDocument &doc, QDomElement &root)
Save the XMI representation of this object.
Definition: codegenerator.cpp:258
int remove(const Key &key)
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
static QString formatSourceCode(const QString &code, const QString &indentation)
Format source code for output in source files by adding the correct indentation to every line of code...
Definition: codegenerator.cpp:821
static void findObjectsRelated(UMLClassifier *c, UMLPackageList &cList)
Finds all classes in the current document to which objects of class c are in some way related...
Definition: codegenerator.cpp:700
void setCodeVerboseSectionComments(bool new_var)
Set the value of m_codeVerboseSectionComments Whether or not verbose code commenting for sections is ...
Definition: codegenerationpolicy.cpp:110
This class is sooo ugly I don't know where to begin.
Definition: codeviewerdialog.h:27
iterator end()
const T value(const Key &key) const
CodeGenerationPolicy * commonPolicy() const
Returns the default code generation policy.
Definition: uml.cpp:2219
CodeDocumentList * getCodeDocumentList()
Get the list of CodeDocument objects held by m_codedocumentVector.
Definition: codegenerator.cpp:171
UMLClassifierList classesAndInterfaces(bool includeNested=true)
Returns a list of the classes and interfaces in this UMLDoc.
Definition: umldoc.cpp:2549
OverwritePolicy getOverwritePolicy() const
Get the value of m_overwritePolicy Policy of how to deal with overwriting existing files...
Definition: codegenerationpolicy.cpp:80
virtual void close()
bool getCodeVerboseSectionComments() const
Get the value of m_codeVerboseSectionComments Whether or not verbose code commenting for sections is ...
Definition: codegenerationpolicy.cpp:122
bool m_applyToAllRemaining
Used by OverwriteDialog to know if the apply to all remaining files checkbox should be checked (is by...
Definition: codegenerator.h:185
bool isNull() const
configurable params for the code viewer tool
Definition: codeviewerstate.h:20
virtual void createDefaultStereotypes()
Create the default stereotypes for your language (constructor, int etc).
Definition: codegenerator.cpp:909
UMLObject * findObjectById(Uml::ID::Type id)
Used to find a reference to a UMLObject by its ID.
Definition: umldoc.cpp:782
QString & replace(int position, int n, QChar after)
UMLAttributeList getAttributeList() const
Returns the attributes for the specified scope.
Definition: classifier.cpp:449
QDomNode firstChild() const
virtual void checkRemoveUMLObject(UMLObject *obj)
This function checks for removing objects from the UMLDocument.
Definition: codegenerator.cpp:359
virtual CodeDocument * newClassifierCodeDocument(UMLClassifier *classifier)=0
A series of accessor method constructors that we need to define for any particular language...
QString absolutePath() const
void writeListedCodeDocsToFile(CodeDocumentList *docs)
The actual internal routine which writes code documents.
Definition: codegenerator.cpp:421
typedef ConstIterator
CodeDocument * findCodeDocumentByClassifier(UMLClassifier *classifier)
Find a code document by the given classifier.
Definition: codegenerator.cpp:380
QHash< QString, CodeDocument * > m_codeDocumentDictionary
Definition: codegenerator.h:179
QString getSourceCode() const
Returns the source code for this operation.
Definition: operation.cpp:440
QString absoluteFilePath(const QString &fileName) const
int length() const
QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries)
bool removeCodeDocument(CodeDocument *remove_object)
Replace (or possibly add a new) CodeDocument object to the m_codedocumentVector List.
Definition: codegenerator.cpp:152
UMLOperationList getOpList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=0)
Return a list of operations for the Classifier.
Definition: classifier.cpp:968
QString left(int n) const
static QString formatDoc(const QString &text, const QString &linePrefix=QLatin1String(" *"), int lineWidth=80)
Format documentation for output in source files.
Definition: codegenerator.cpp:790
bool contains(const Key &key) const
static QString cleanName(const QString &name)
Replaces spaces with underscores and capitalises as defined in m_modname.
Definition: codegenerator.cpp:627
QString tagName() const
QString findFileName(CodeDocument *codeDocument)
Finds an appropriate file name for the given CodeDocument, taking into account the Overwrite Policy a...
Definition: codegenerator.cpp:643
void showGeneratedFile(const QString &filename)
const_iterator constEnd() const
QDomElement createElement(const QString &tagName)
const_iterator constBegin() const
virtual void syncCodeToDocument()
Force a synchronize of this code generator, and its present contents, to that of the parent UMLDocume...
Definition: codegenerator.cpp:328
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString getHeadingFile(const QString &str)
Gets the heading file (as a string) to be inserted at the beginning of the generated file...
Definition: codegenerationpolicy.cpp:540
iterator begin()
Definition: umlobject.h:55
bool mkpath(const QString &dirPath) const
void setOverwritePolicy(OverwritePolicy new_var)
Set the value of m_overwritePolicy Policy of how to deal with overwriting existing files...
Definition: codegenerationpolicy.cpp:69
virtual void initFromParentDocument()
Initialize this code generator from its parent UMLDoc.
Definition: codegenerator.cpp:308
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.