umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
CodeDocument Class Reference

`#include <codedocument.h>`

Inheritance 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)
CodeComment * | getHeader () const
bool | insertTextBlock (TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
TextBlock * | findTextBlockByTag (const QString &tag, bool descendIntoChildren=false) const
virtual QString | toString () const
virtual void | saveToXMI (QXmlStreamWriter &writer)
virtual void | loadFromXMI (QDomElement &root)
virtual CodeBlock * | newCodeBlock ()
virtual HierarchicalCodeBlock * | newHierarchicalCodeBlock ()
virtual CodeBlockWithComments * | newCodeBlockWithComments ()
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)
TextBlockList * | getTextBlockList () const
virtual HierarchicalCodeBlock * | getHierarchicalCodeBlock (const QString &tag, const QString &comment, int indentLevel)
virtual CodeBlockWithComments * | getCodeBlockWithComments (const QString &tag, const QString &comment, int indentLevel)
CodeComment * | addOrUpdateTaggedCodeComment (const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
CodeBlockWithComments * | addOrUpdateTaggedCodeBlockWithComments (const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
TextBlock * | findTextBlockByTag (const QString &tag)
CodeGenObjectWithTextBlocks * | findParentObjectForTaggedTextBlock (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 TextBlock * | findCodeClassFieldTextBlockByTag (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
UMLPackage * | m_package
bool | m_writeOutCode
CodeComment * | m_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.

## ◆ ~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

  name | the cleanable name

Returns
  the cleaned name

## ◆ findCodeClassFieldTextBlockByTag()

TextBlock * CodeDocument::findCodeClassFieldTextBlockByTag | ( | const QString & | tag | ) |
| protected virtual

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

  tag | the tag to look for
  descendIntoChildren | look 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

## ◆ 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.

## ◆ getUniqueTag()

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

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

Parameters

  prefix | the prefix to add

Returns
  the just created unique tag

Implements CodeGenObjectWithTextBlocks.

## ◆ 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

  newBlock | the text block to insert
  existingBlock | the place where to insert
  after | at the index of the existingBlock or after

Returns
  the success status

Implements CodeGenObjectWithTextBlocks.

## ◆ loadFromXMI()

void CodeDocument::loadFromXMI | ( | QDomElement & | root | ) |
| virtual

Load params from the appropriate XMI element node.

Parameters

  root | the starting point for loading

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

## ◆ 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 | ( |  | ) |
| protected virtual

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.

## ◆ saveToXMI()

void CodeDocument::saveToXMI | ( | QXmlStreamWriter & | writer | ) |
| virtual

Save the XMI representation of this object.

Parameters

  writer | QXmlStreamWriter serialization target

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

## ◆ setAttributesFromNode()

void CodeDocument::setAttributesFromNode | ( | QDomElement & | root | ) |
| protected virtual

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

Reimplemented from CodeGenObjectWithTextBlocks.

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

## ◆ setAttributesOnNode()

void CodeDocument::setAttributesOnNode | ( | QXmlStreamWriter & | writer | ) |
| protected virtual

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

Reimplemented from CodeGenObjectWithTextBlocks.

Reimplemented in ClassifierCodeDocument, and JavaANTCodeDocument.

## ◆ setFileExtension()

void CodeDocument::setFileExtension | ( | const QString & | new_var | ) |

Set the value of m_fileExtension.

Parameters

  new_var | the new value of m_fileExtension

## ◆ setFileName()

void CodeDocument::setFileName | ( | const QString & | new_var | ) |

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

Parameters

  new_var | the new value of m_filename

## ◆ setHeader()

void CodeDocument::setHeader | ( | CodeComment * | comment | ) |

Set a Header comment object.

Parameters

  comment | the comment for the header

## ◆ setID()

void CodeDocument::setID | ( | const QString & | new_id | ) |

Set the value of m_ID.

Parameters

  new_id | the new value of m_ID

## ◆ setPackage()

void CodeDocument::setPackage | ( | UMLPackage * | new_var | ) |

Set the value of m_package.

Parameters

  new_var | the 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_var | the new value of m_writeOutCode

## ◆ synchronize()

void CodeDocument::synchronize | ( |  | ) |
| virtual

Cause this code document to synchronize to current generator policy.

Reimplemented in ClassifierCodeDocument.

## ◆ toString()

QString CodeDocument::toString | ( |  | ) | const
| virtual

Create the string representation of this object.

Returns
  the created string

Reimplemented in CPPMakefileCodeDocument.

## ◆ 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 ClassifierCodeDocument, CPPHeaderCodeDocument, CPPMakefileCodeDocument, CPPSourceCodeDocument, DClassifierCodeDocument, JavaANTCodeDocument, JavaClassifierCodeDocument, and RubyClassifierCodeDocument.

## ◆ updateHeader()

void CodeDocument::updateHeader | ( |  | ) |
| protected

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

## Friends And Related Symbol 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:

- umbrello/codegenerators/codedocument.h
- umbrello/codegenerators/codedocument.cpp