umbrello API Documentation

CodeGenObjectWithTextBlocks Class Reference

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

#include <codegenobjectwithtextblocks.h>

Inheritance diagram for CodeGenObjectWithTextBlocks:

CodeDocument ClassifierCodeDocument CPPMakefileCodeDocument JavaANTCodeDocument CPPHeaderCodeDocument CPPSourceCodeDocument JavaClassifierCodeDocument RubyClassifierCodeDocument List of all members.

Public Member Functions

 CodeGenObjectWithTextBlocks (CodeDocument *parent)
 Constructor.
virtual ~CodeGenObjectWithTextBlocks ()
 Empty Destructor.
virtual bool addTextBlock (TextBlock *add_object)
 Add a TextBlock object to the m_textblockVector List.
virtual bool removeTextBlock (TextBlock *remove_object)
 Remove a TextBlock object from m_textblockVector List.
virtual bool insertTextBlock (TextBlock *newBlock, TextBlock *existingBlock, bool after)=0
 Insert a new text block before/after the existing text block.
TextBlockList * getTextBlockList ()
 Get the list of TextBlock objects held by m_textblockVector.
virtual HierarchicalCodeBlock * getHierarchicalCodeBlock (const QString &tag, const QString &comment, int indentLevel)
 Will get a hierarchicalcodeblock from the document with given tag.
virtual CodeBlockWithCommentsgetCodeBlockWithComments (const QString &tag, const QString &comment, int indentLevel)
 Will get a codeblockwithcomments from the document with given tag.
CodeCommentaddOrUpdateTaggedCodeComment (const QString &tag="", const QString &text="", 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.
CodeBlockWithCommentsaddOrUpdateTaggedCodeBlockWithComments (const QString &tag, const QString &text, const QString &comment, 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.
virtual TextBlockfindTextBlockByTag (const QString &tag)
virtual QString getUniqueTag (QString prefix="")=0
virtual CodeBlocknewCodeBlock ()=0
 Virtual methods that return a new code document objects.
virtual CodeBlockWithCommentsnewCodeBlockWithComments ()=0
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock ()=0
CodeGenObjectWithTextBlocksfindParentObjectForTaggedTextBlock (const QString &tag)
 Find the direct parent for a given textblock.

Protected Member Functions

virtual void setAttributesOnNode (QDomDocument &doc, QDomElement &elem)
 set attributes of the node that represents this class in the XMI document.
virtual void setAttributesFromNode (QDomElement &element)
 set the class attributes of this object from the passed element node.
virtual void setAttributesFromObject (CodeGenObjectWithTextBlocks *obj)
virtual void loadChildTextBlocksFromNode (QDomElement &root)
 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
virtual void resetTextBlocks ()
virtual TextBlockfindCodeClassFieldTextBlockByTag (const QString &tag)=0

Protected Attributes

QMap< QString, TextBlock * > m_textBlockTagMap
TextBlockList m_textblockVector

Detailed Description

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

Definition at line 41 of file codegenobjectwithtextblocks.h.


Constructor & Destructor Documentation

CodeGenObjectWithTextBlocks::CodeGenObjectWithTextBlocks CodeDocument parent  ) 
 

Constructor.

Definition at line 35 of file codegenobjectwithtextblocks.cpp.

CodeGenObjectWithTextBlocks::~CodeGenObjectWithTextBlocks  )  [virtual]
 

Empty Destructor.

Definition at line 41 of file codegenobjectwithtextblocks.cpp.


Member Function Documentation

bool CodeGenObjectWithTextBlocks::addTextBlock TextBlock add_object  )  [virtual]
 

Add a TextBlock object to the m_textblockVector List.

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

Definition at line 75 of file codegenobjectwithtextblocks.cpp.

References findParentObjectForTaggedTextBlock(), TextBlock::getParentDocument(), TextBlock::getTag(), getUniqueTag(), removeTextBlock(), and TextBlock::setTag().

Referenced by CPPHeaderCodeDocument::addCodeOperation(), addOrUpdateTaggedCodeBlockWithComments(), addOrUpdateTaggedCodeComment(), getCodeBlockWithComments(), getHierarchicalCodeBlock(), RubyClassifierCodeDocument::loadChildTextBlocksFromNode(), JavaClassifierCodeDocument::loadChildTextBlocksFromNode(), JavaANTCodeDocument::loadChildTextBlocksFromNode(), CPPHeaderCodeDocument::loadChildTextBlocksFromNode(), and loadChildTextBlocksFromNode().

bool CodeGenObjectWithTextBlocks::removeTextBlock TextBlock remove_object  )  [virtual]
 

Remove a TextBlock object from m_textblockVector List.

Definition at line 113 of file codegenobjectwithtextblocks.cpp.

Referenced by addTextBlock(), CodeClassField::removeMethod(), ClassifierCodeDocument::removeOperation(), and CodeClassField::~CodeClassField().

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.

TextBlockList * CodeGenObjectWithTextBlocks::getTextBlockList  ) 
 

Get the list of TextBlock objects held by m_textblockVector.

Returns:
TextBlockList list of TextBlock objects held by m_textblockVector

Definition at line 65 of file codegenobjectwithtextblocks.cpp.

Referenced by ClassifierCodeDocument::getCodeOperations(), setAttributesOnNode(), and CodeDocument::toString().

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.

Returns:
HierarchicalCodeBlock
Parameters:
tag 
comment 
indentLevel 

Definition at line 184 of file codegenobjectwithtextblocks.cpp.

References addTextBlock(), and findTextBlockByTag().

Referenced by CPPHeaderCodeDocument::loadChildTextBlocksFromNode(), and CPPHeaderCodeDocument::updateContent().

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.

Returns:
CodeBlockWithComments
Parameters:
tag 
comment 
indentLevel 

Definition at line 216 of file codegenobjectwithtextblocks.cpp.

References addTextBlock(), findTextBlockByTag(), CodeBlockWithComments::getComment(), CodeBlockWithComments::setComment(), CodeBlockWithComments::setOverallIndentationLevel(), TextBlock::setTag(), TextBlock::setText(), and TextBlock::setWriteOutText().

CodeComment * CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeComment const QString &  tag = "",
const QString &  text = "",
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.

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

CodeComment

Parameters:
tag 
text 
indentationLevel 

Definition at line 244 of file codegenobjectwithtextblocks.cpp.

References addTextBlock(), findTextBlockByTag(), CodeGenFactory::newCodeComment(), TextBlock::setIndentationLevel(), TextBlock::setTag(), TextBlock::setText(), and TextBlock::setWriteOutText().

CodeBlockWithComments * CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeBlockWithComments const QString &  tag,
const QString &  text,
const QString &  comment,
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.

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

CodeBlockWithComments

Parameters:
tag 
text 
comment 
indentLevel 
forceUserBlockUpdate 

Definition at line 283 of file codegenobjectwithtextblocks.cpp.

References addTextBlock(), findTextBlockByTag(), CodeBlockWithComments::getComment(), CodeBlock::getContentType(), CodeBlockWithComments::setOverallIndentationLevel(), TextBlock::setTag(), TextBlock::setText(), and TextBlock::setWriteOutText().

Referenced by CPPHeaderCodeDocument::updateContent().

TextBlock * CodeGenObjectWithTextBlocks::findTextBlockByTag const QString &  tag  )  [virtual]
 

Returns:
TextBlock
Parameters:
tag 

Definition at line 136 of file codegenobjectwithtextblocks.cpp.

Referenced by addOrUpdateTaggedCodeBlockWithComments(), addOrUpdateTaggedCodeComment(), findParentObjectForTaggedTextBlock(), getCodeBlockWithComments(), and getHierarchicalCodeBlock().

virtual QString CodeGenObjectWithTextBlocks::getUniqueTag QString  prefix = ""  )  [pure virtual]
 

Returns:
QString
Parameters:
prefix 

Implemented in CodeDocument.

Referenced by addTextBlock().

virtual CodeBlock* CodeGenObjectWithTextBlocks::newCodeBlock  )  [pure virtual]
 

Virtual methods that return a new code document objects.

Implemented in CodeDocument.

Referenced by loadChildTextBlocksFromNode().

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.

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

Definition at line 149 of file codegenobjectwithtextblocks.cpp.

References findTextBlockByTag().

Referenced by addTextBlock().

void CodeGenObjectWithTextBlocks::setAttributesOnNode QDomDocument &  doc,
QDomElement &  elem
[protected, virtual]
 

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

Reimplemented in ClassifierCodeDocument, CodeDocument, JavaANTCodeDocument, and OwnedHierarchicalCodeBlock.

Definition at line 349 of file codegenobjectwithtextblocks.cpp.

References getTextBlockList(), and TextBlock::saveToXMI().

Referenced by CodeDocument::setAttributesOnNode().

void CodeGenObjectWithTextBlocks::setAttributesFromNode QDomElement &  root  )  [protected, virtual]
 

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

Reimplemented in ClassifierCodeDocument, CodeDocument, JavaANTCodeDocument, and OwnedHierarchicalCodeBlock.

Definition at line 366 of file codegenobjectwithtextblocks.cpp.

References loadChildTextBlocksFromNode().

Referenced by CodeDocument::setAttributesFromNode().

void CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode QDomElement &  root  )  [protected, virtual]
 

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

Reimplemented in CPPHeaderCodeDocument, JavaANTCodeDocument, JavaClassifierCodeDocument, and RubyClassifierCodeDocument.

Definition at line 383 of file codegenobjectwithtextblocks.cpp.

References addTextBlock(), UMLDoc::findObjectById(), UMLApp::getDocument(), CodeDocument::getFileName(), UMLObject::loadFromXMI(), CodeBlockWithComments::loadFromXMI(), CodeBlock::loadFromXMI(), CodeComment::loadFromXMI(), newCodeBlock(), CodeGenFactory::newCodeComment(), and CodeGenFactory::newCodeOperation().

Referenced by setAttributesFromNode().


The documentation for this class was generated from the following files:
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:08:04 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003