umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
CodeDocument Class Reference

#include <codedocument.h>

Inheritance diagram for CodeDocument:
Collaboration diagram for CodeDocument:

Public Member Functions

 CodeDocument ()
 
virtual ~CodeDocument ()
 
void setFileExtension (const QString &new_var)
 
QString getFileExtension () const
 
void setFileName (const QString &new_var)
 
QString getFileName () const
 
void setPackage (UMLPackage *new_var)
 
QString getPackage () const
 
virtual QString getPath () const
 
void setID (const QString &new_id)
 
QString ID () const
 
void setWriteOutCode (bool new_var)
 
bool getWriteOutCode () const
 
void setHeader (CodeComment *comment)
 
CodeCommentgetHeader () const
 
bool insertTextBlock (TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
 
TextBlockfindTextBlockByTag (const QString &tag, bool descendIntoChildren=false) const
 
virtual QString toString () const
 
virtual void saveToXMI (QXmlStreamWriter &writer)
 
virtual void loadFromXMI (QDomElement &root)
 
virtual CodeBlocknewCodeBlock ()
 
virtual HierarchicalCodeBlocknewHierarchicalCodeBlock ()
 
virtual CodeBlockWithCommentsnewCodeBlockWithComments ()
 
virtual QString getUniqueTag (const QString &prefix=QString())
 
QString cleanName (const QString &name)
 
virtual void synchronize ()
 
virtual void updateContent ()
 
- Public Member Functions inherited from CodeGenObjectWithTextBlocks
 CodeGenObjectWithTextBlocks (CodeDocument *parent)
 
virtual ~CodeGenObjectWithTextBlocks ()
 
virtual bool addTextBlock (TextBlock *add_object)
 
virtual bool removeTextBlock (TextBlock *remove_object)
 
TextBlockListgetTextBlockList () const
 
virtual HierarchicalCodeBlockgetHierarchicalCodeBlock (const QString &tag, const QString &comment, int indentLevel)
 
virtual CodeBlockWithCommentsgetCodeBlockWithComments (const QString &tag, const QString &comment, int indentLevel)
 
CodeCommentaddOrUpdateTaggedCodeComment (const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
 
CodeBlockWithCommentsaddOrUpdateTaggedCodeBlockWithComments (const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
 
TextBlockfindTextBlockByTag (const QString &tag)
 
CodeGenObjectWithTextBlocksfindParentObjectForTaggedTextBlock (const QString &tag)
 

Protected Member Functions

virtual void setAttributesOnNode (QXmlStreamWriter &writer)
 
virtual void setAttributesFromNode (QDomElement &element)
 
void addChildTagToMap (const QString &tag, TextBlock *tb)
 
void removeChildTagFromMap (const QString &tag)
 
void updateHeader ()
 
void resetTextBlocks ()
 
virtual TextBlockfindCodeClassFieldTextBlockByTag (const QString &tag)
 
- Protected Member Functions inherited from CodeGenObjectWithTextBlocks
void setAttributesFromObject (CodeGenObjectWithTextBlocks *obj)
 
virtual void loadChildTextBlocksFromNode (QDomElement &root)
 

Private Attributes

int m_lastTagIndex
 
QString m_filename
 
QString m_fileExtension
 
QString m_ID
 
QString m_pathName
 
UMLPackagem_package
 
bool m_writeOutCode
 
CodeCommentm_header
 
QMap< QString, TextBlock * > m_childTextBlockTagMap
 

Friends

class HierarchicalCodeBlock
 
QDebug operator<< (QDebug os, const CodeDocument &obj)
 

Additional Inherited Members

- Protected Attributes inherited from CodeGenObjectWithTextBlocks
QMap< QString, TextBlock * > m_textBlockTagMap
 
TextBlockList m_textblockVector
 

Detailed Description

A document containing the code for one file. "friend" status is needed for HBlock so it may call addChildTagToMap which is protected.

Constructor & Destructor Documentation

◆ CodeDocument()

CodeDocument::CodeDocument ( )

Constructor.

Here is the call graph for this function:

◆ ~CodeDocument()

CodeDocument::~CodeDocument ( )
virtual

Destructor.

Member Function Documentation

◆ addChildTagToMap()

void CodeDocument::addChildTagToMap ( const QString &  tag,
TextBlock tb 
)
protected

◆ cleanName()

QString CodeDocument::cleanName ( const QString &  name)

A little utility method which calls CodeGenerator::cleanName.

Parameters
namethe cleanable name
Returns
the cleaned name
Here is the call graph for this function:

◆ findCodeClassFieldTextBlockByTag()

TextBlock * CodeDocument::findCodeClassFieldTextBlockByTag ( const QString &  tag)
protectedvirtual

Have to implement this for CodeObjectWithTextBlocks. Actually does not do anything for a vanilla code document.

Implements CodeGenObjectWithTextBlocks.

Reimplemented in ClassifierCodeDocument.

◆ findTextBlockByTag()

TextBlock * CodeDocument::findTextBlockByTag ( const QString &  tag,
bool  descendIntoChildren = false 
) const

Lookup a certain textblock by its tag value, returns NULL if it cannot find the TextBlock with such a tag. If descendIntoChildren is true, then any child hierarchical textblocks will also be searched for a match.

Parameters
tagthe tag to look for
descendIntoChildrenlook down the hierarchy
Returns
the found text block

◆ getFileExtension()

QString CodeDocument::getFileExtension ( ) const

Get the value of m_fileExtension.

Returns
the value of m_fileExtension

◆ getFileName()

QString CodeDocument::getFileName ( ) const

Get the value of m_filename. This name is the "complete" filename, meaning that it contains both the file name plus any extension (e.g. "file.cpp").

Returns
the value of m_filename

◆ getHeader()

CodeComment * CodeDocument::getHeader ( ) const

Get the Header comment object.

Returns
the comment for the header

◆ getPackage()

QString CodeDocument::getPackage ( ) const

Get the value of the package of this code document.

Returns
the value of m_pathName
Here is the call graph for this function:

◆ getPath()

QString CodeDocument::getPath ( ) const
virtual

Get the value of the path to this code document.

Returns
the value of m_pathName

Reimplemented in CPPMakefileCodeDocument, DClassifierCodeDocument, JavaANTCodeDocument, JavaClassifierCodeDocument, and RubyClassifierCodeDocument.

Here is the call graph for this function:

◆ getUniqueTag()

QString CodeDocument::getUniqueTag ( const QString &  prefix = QString())
virtual

Return a unique and currently unallocated text block tag for this document.

Parameters
prefixthe prefix to add
Returns
the just created unique tag

Implements CodeGenObjectWithTextBlocks.

Here is the call graph for this function:

◆ getWriteOutCode()

bool CodeDocument::getWriteOutCode ( ) const

Get the value of m_writeOutCode. Whether or not to write out this code document and any codeblocks, etc that it owns.

Returns
the value of m_writeOutCode

◆ ID()

QString CodeDocument::ID ( ) const

Get the value of m_ID.

Returns
the value of m_ID

◆ insertTextBlock()

bool CodeDocument::insertTextBlock ( TextBlock newBlock,
TextBlock existingBlock,
bool  after = true 
)
virtual

Insert a new text block after the existing text block. Returns false if it cannot insert the textblock.

Parameters
newBlockthe text block to insert
existingBlockthe place where to insert
afterat the index of the existingBlock or after
Returns
the success status

Implements CodeGenObjectWithTextBlocks.

Here is the call graph for this function:

◆ loadFromXMI()

void CodeDocument::loadFromXMI ( QDomElement &  root)
virtual

Load params from the appropriate XMI element node.

Parameters
rootthe starting point for loading

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

Here is the call graph for this function:

◆ newCodeBlock()

CodeBlock * CodeDocument::newCodeBlock ( )
virtual

Create a new CodeBlock object belonging to this CodeDocument.

Returns
the just created CodeBlock

Implements CodeGenObjectWithTextBlocks.

◆ newCodeBlockWithComments()

CodeBlockWithComments * CodeDocument::newCodeBlockWithComments ( )
virtual

Create a new CodeBlockWithComments object belonging to this CodeDocument.

Returns
the just created CodeBlockWithComments

Implements CodeGenObjectWithTextBlocks.

◆ newHierarchicalCodeBlock()

HierarchicalCodeBlock * CodeDocument::newHierarchicalCodeBlock ( )
virtual

Create a new HierarchicalCodeBlock object belonging to this CodeDocument.

Returns
the just created HierarchicalCodeBlock

Implements CodeGenObjectWithTextBlocks.

Reimplemented in JavaANTCodeDocument.

◆ removeChildTagFromMap()

void CodeDocument::removeChildTagFromMap ( const QString &  tag)
protected

◆ resetTextBlocks()

void CodeDocument::resetTextBlocks ( )
protectedvirtual

Reset/clear our inventory of textblocks in this document. Need to overload method to be able to clear the childTextBlockMap.

Reimplemented from CodeGenObjectWithTextBlocks.

Reimplemented in CPPHeaderCodeDocument, CPPSourceCodeDocument, DClassifierCodeDocument, JavaClassifierCodeDocument, and RubyClassifierCodeDocument.

Here is the call graph for this function:

◆ saveToXMI()

void CodeDocument::saveToXMI ( QXmlStreamWriter &  writer)
virtual

Save the XMI representation of this object.

Parameters
writerQXmlStreamWriter serialization target

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

Here is the call graph for this function:

◆ setAttributesFromNode()

void CodeDocument::setAttributesFromNode ( QDomElement &  root)
protectedvirtual

Set the class attributes of this object from the passed element node.

Reimplemented from CodeGenObjectWithTextBlocks.

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

Here is the call graph for this function:

◆ setAttributesOnNode()

void CodeDocument::setAttributesOnNode ( QXmlStreamWriter &  writer)
protectedvirtual

Set attributes of the node that represents this class in the XMI document.

Reimplemented from CodeGenObjectWithTextBlocks.

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

Here is the call graph for this function:

◆ setFileExtension()

void CodeDocument::setFileExtension ( const QString &  new_var)

Set the value of m_fileExtension.

Parameters
new_varthe new value of m_fileExtension
Here is the call graph for this function:

◆ setFileName()

void CodeDocument::setFileName ( const QString &  new_var)

Set the complete value (name plus any extension) of m_filename.

Parameters
new_varthe new value of m_filename

◆ setHeader()

void CodeDocument::setHeader ( CodeComment comment)

Set a Header comment object.

Parameters
commentthe comment for the header

◆ setID()

void CodeDocument::setID ( const QString &  new_id)

Set the value of m_ID.

Parameters
new_idthe new value of m_ID

◆ setPackage()

void CodeDocument::setPackage ( UMLPackage new_var)

Set the value of m_package.

Parameters
new_varthe new value of m_package

◆ setWriteOutCode()

void CodeDocument::setWriteOutCode ( bool  new_var)

Set the value of m_writeOutCode. Whether or not to write out this code document and any codeblocks, etc that it owns.

Parameters
new_varthe new value of m_writeOutCode

◆ synchronize()

void CodeDocument::synchronize ( )
virtual

Cause this code document to synchronize to current generator policy.

Reimplemented in ClassifierCodeDocument.

Here is the call graph for this function:

◆ toString()

QString CodeDocument::toString ( ) const
virtual

Create the string representation of this object.

Returns
the created string

Reimplemented in CPPMakefileCodeDocument.

Here is the call graph for this function:

◆ updateContent()

void CodeDocument::updateContent ( )
virtual

Update the content of this code document. This is where you should lay out your code document structure of textblocks in the inheriting class, should it have any text in it. Vanilla code documents don't have much to do.. override this with a different version for your own documents.

Reimplemented in CPPHeaderCodeDocument, CPPMakefileCodeDocument, CPPSourceCodeDocument, DClassifierCodeDocument, JavaANTCodeDocument, JavaClassifierCodeDocument, RubyClassifierCodeDocument, and ClassifierCodeDocument.

Here is the call graph for this function:

◆ updateHeader()

void CodeDocument::updateHeader ( )
protected

Update the header text of this codedocument (text and status of the head comment).

Here is the call graph for this function:

Friends And Related Function Documentation

◆ HierarchicalCodeBlock

friend class HierarchicalCodeBlock
friend

◆ operator<<

QDebug operator<< ( QDebug  os,
const CodeDocument obj 
)
friend

Member Data Documentation

◆ m_childTextBlockTagMap

QMap<QString, TextBlock *> CodeDocument::m_childTextBlockTagMap
private

◆ m_fileExtension

QString CodeDocument::m_fileExtension
private

◆ m_filename

QString CodeDocument::m_filename
private

◆ m_header

CodeComment* CodeDocument::m_header
private

◆ m_ID

QString CodeDocument::m_ID
private

◆ m_lastTagIndex

int CodeDocument::m_lastTagIndex
private

◆ m_package

UMLPackage* CodeDocument::m_package
private

◆ m_pathName

QString CodeDocument::m_pathName
private

◆ m_writeOutCode

bool CodeDocument::m_writeOutCode
private

The documentation for this class was generated from the following files: