umbrello: CodeGenObjectWithTextBlocks Class Reference

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

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

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

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
CodeGenObjectWithTextBlocks Class Referenceabstract

`#include <codegenobjectwithtextblocks.h>`

Inheritance diagram for CodeGenObjectWithTextBlocks:

## Public Member Functions
| CodeGenObjectWithTextBlocks (CodeDocument *parent)
virtual | ~CodeGenObjectWithTextBlocks ()
virtual bool | addTextBlock (TextBlock *add_object)
virtual bool | removeTextBlock (TextBlock *remove_object)
virtual bool | insertTextBlock (TextBlock *newBlock, TextBlock *existingBlock, bool after)=0
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)
virtual QString | getUniqueTag (const QString &prefix=QString())=0
virtual CodeBlock * | newCodeBlock ()=0
virtual CodeBlockWithComments * | newCodeBlockWithComments ()=0
virtual HierarchicalCodeBlock * | newHierarchicalCodeBlock ()=0
CodeGenObjectWithTextBlocks * | findParentObjectForTaggedTextBlock (const QString &tag)

## Protected Member Functions
virtual void | setAttributesOnNode (QXmlStreamWriter &writer)
virtual void | setAttributesFromNode (QDomElement &element)
void | setAttributesFromObject (CodeGenObjectWithTextBlocks *obj)
virtual void | loadChildTextBlocksFromNode (QDomElement &root)
virtual void | resetTextBlocks ()
virtual TextBlock * | findCodeClassFieldTextBlockByTag (const QString &tag)=0

## Protected Attributes
QMap< QString, TextBlock * > | m_textBlockTagMap
TextBlockList | m_textblockVector

## Private Attributes
CodeDocument * | m_pCodeDoc

## Detailed Description

This abstract class is for code generator objects which 'own' text blocks.

## Constructor & Destructor Documentation

## ◆ CodeGenObjectWithTextBlocks()

CodeGenObjectWithTextBlocks::CodeGenObjectWithTextBlocks | ( | CodeDocument * | parent | ) |
| explicit

Constructor

Parameters

  parent | parent code document

## ◆ ~CodeGenObjectWithTextBlocks()

CodeGenObjectWithTextBlocks::~CodeGenObjectWithTextBlocks | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ addOrUpdateTaggedCodeBlockWithComments()

CodeBlockWithComments * CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeBlockWithComments | ( | const QString & | tag,
|  | const QString & | text,
|  | const QString & | ctext,
|  | int | indentLevel,
|  | bool | forceUserBlockUpdate
| ) |  |

Allows the user to either add a code block with comments to the end of the list of text blocks in this document OR, if a text block already exists with that tag, it will update it with the passed text as appropriate.

Parameters

  tag | tag to find the text block
  text | text to set
  ctext | comment to set
  indentLevel | indentation level
  forceUserBlockUpdate | ...

Returns
  codeblock/comment pointer to the object which was created/updated

## ◆ addOrUpdateTaggedCodeComment()

CodeComment * CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeComment | ( | const QString & | tag = `QString()`,
|  | const QString & | text = `QString()`,
|  | int | indentationLevel = `0`
| ) |  |

Allows the user to add a code comment to the end of the list of text blocks in this document OR, if a text block already exists with that tag, it will update it with the passed text as appropriate.

Parameters

  tag | tag to find the text block
  text | code comment to set
  indentationLevel | indentation level

Returns
  codeblock/comment pointer to the object which was created/updated.

## ◆ addTextBlock()

bool CodeGenObjectWithTextBlocks::addTextBlock | ( | TextBlock * | add_object | ) |
| virtual

Add a TextBlock object to the m_textblockVector List.

Parameters

  add_object | text block to add

Returns
  boolean value where false means not added because an TextBlock object with that tag already exists in this document.

Reimplemented in HierarchicalCodeBlock.

## ◆ findCodeClassFieldTextBlockByTag()

virtual TextBlock * CodeGenObjectWithTextBlocks::findCodeClassFieldTextBlockByTag | ( | const QString & | tag | ) |
| protectedpure virtual

Find specific text block belonging to code classfields. Block may not presently be allocated to the textblock list.

Implemented in ClassifierCodeDocument, CodeDocument, and HierarchicalCodeBlock.

## ◆ findParentObjectForTaggedTextBlock()

CodeGenObjectWithTextBlocks * CodeGenObjectWithTextBlocks::findParentObjectForTaggedTextBlock | ( | const QString & | tag | ) |

Find the direct parent for a given textblock. This may be any object which holds text blocks, e.g. a CodeGenObjectWithTextBlocks. IMPORTANT: this will only search for a parent from the viewpoint of this object and down into its Hierarchical codeblocks. This means you should start any search from the parent document of the text block. This method NOT meant for casual usage.

Parameters

  tag | tag to find the text block

Returns
  parent object. Could return null if the textblock is missing from the branch of the document tree being examined.

## ◆ findTextBlockByTag()

TextBlock * CodeGenObjectWithTextBlocks::findTextBlockByTag | ( | const QString & | tag | ) |

Find the text block with a given tag.

Parameters

  tag | the tag to search with

Returns
  the found TextBlock object

## ◆ getCodeBlockWithComments()

CodeBlockWithComments * CodeGenObjectWithTextBlocks::getCodeBlockWithComments | ( | const QString & | tag,
|  | const QString & | comment,
|  | int | indentLevel
| ) |  |
| virtual

Will get a codeblockwithcomments from the document with given tag. If the codeblock doesn't exist, then it will create it at the end of the document textBlock list and pass back a reference.

Parameters

  tag | tag to find the text block
  comment | comment
  indentLevel | indentation level

Returns
  CodeBlockWithComments object

## ◆ getHierarchicalCodeBlock()

HierarchicalCodeBlock * CodeGenObjectWithTextBlocks::getHierarchicalCodeBlock | ( | const QString & | tag,
|  | const QString & | comment,
|  | int | indentLevel
| ) |  |
| virtual

Will get a hierarchicalcodeblock from the document with given tag. IF the codeblock doesn't exist, then it will create it at the end of the document textBlock list and pass back a reference.

Parameters

  tag | tag to find the text block
  comment | comment
  indentLevel | indentation level

Returns
  HierarchicalCodeBlock object

## ◆ getTextBlockList()

TextBlockList * CodeGenObjectWithTextBlocks::getTextBlockList | ( |  | ) | const

Get the list of TextBlock objects held by m_textblockVector

Returns
  list of TextBlock objects held by m_textblockVector

## ◆ getUniqueTag()

virtual QString CodeGenObjectWithTextBlocks::getUniqueTag | ( | const QString & | prefix = `QString()` | ) |
| pure virtual

Returns
  QString

Parameters

  prefix |

Implemented in HierarchicalCodeBlock, and CodeDocument.

## ◆ insertTextBlock()

virtual bool CodeGenObjectWithTextBlocks::insertTextBlock | ( | TextBlock * | newBlock,
|  | TextBlock * | existingBlock,
|  | bool | after
| ) |  |
| pure virtual

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

Implemented in CodeDocument, and HierarchicalCodeBlock.

## ◆ loadChildTextBlocksFromNode()

void CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode | ( | QDomElement & | root | ) |
| protectedvirtual

Load text blocks. In this vanilla version, we only load comments and codeblocks as they are the only instanciatable (vanilla) things this method should be overridden if this class is inherited by some other class that is concrete and takes children derived from codeblock/codecomment/hierarchicalcb/ownedhiercodeblock.

Parameters

  root | node from which to load the child text blocks

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

## ◆ newCodeBlock()

virtual CodeBlock * CodeGenObjectWithTextBlocks::newCodeBlock | ( |  | ) |
| pure virtual

Virtual methods that return a new code document objects.

Implemented in CodeDocument, and HierarchicalCodeBlock.

## ◆ newCodeBlockWithComments()

virtual CodeBlockWithComments * CodeGenObjectWithTextBlocks::newCodeBlockWithComments | ( |  | ) |
| pure virtual

Implemented in CodeDocument, and HierarchicalCodeBlock.

## ◆ newHierarchicalCodeBlock()

virtual HierarchicalCodeBlock * CodeGenObjectWithTextBlocks::newHierarchicalCodeBlock | ( |  | ) |
| pure virtual

Implemented in CodeDocument, HierarchicalCodeBlock, and JavaANTCodeDocument.

## ◆ removeTextBlock()

bool CodeGenObjectWithTextBlocks::removeTextBlock | ( | TextBlock * | remove_object | ) |
| virtual

Remove a TextBlock object from m_textblockVector list.

Parameters

  remove_object | the text block to be removed

Returns
  success status

Reimplemented in HierarchicalCodeBlock.

## ◆ resetTextBlocks()

void CodeGenObjectWithTextBlocks::resetTextBlocks | ( |  | ) |
| protectedvirtual

Reset/clear the inventory text blocks held by this object.

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

## ◆ setAttributesFromNode()

void CodeGenObjectWithTextBlocks::setAttributesFromNode | ( | QDomElement & | root | ) |
| protectedvirtual

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

Parameters

  root | node from which to load the child text blocks

Reimplemented in ClassifierCodeDocument, CodeDocument, HierarchicalCodeBlock, JavaANTCodeDocument, OwnedHierarchicalCodeBlock, and XMLElementCodeBlock.

## ◆ setAttributesFromObject()

void CodeGenObjectWithTextBlocks::setAttributesFromObject | ( | CodeGenObjectWithTextBlocks * | obj | ) |
| protected

Empty method.

## ◆ setAttributesOnNode()

void CodeGenObjectWithTextBlocks::setAttributesOnNode | ( | QXmlStreamWriter & | writer | ) |
| protectedvirtual

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

Reimplemented in ClassifierCodeDocument, CodeDocument, HierarchicalCodeBlock, JavaANTCodeDocument, OwnedHierarchicalCodeBlock, and XMLElementCodeBlock.

## Member Data Documentation

## ◆ m_pCodeDoc

CodeDocument* CodeGenObjectWithTextBlocks::m_pCodeDoc
| private

## ◆ m_textBlockTagMap

QMap<QString, TextBlock *> CodeGenObjectWithTextBlocks::m_textBlockTagMap
| protected

## ◆ m_textblockVector

TextBlockList CodeGenObjectWithTextBlocks::m_textblockVector
| protected

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

- umbrello/codegenerators/codegenobjectwithtextblocks.h
- umbrello/codegenerators/codegenobjectwithtextblocks.cpp