codeblock.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "codeblock.h"
00017 #include "codedocument.h"
00018
00019 #include "hierarchicalcodeblock.h"
00020
00021
00022
00023
00024 CodeBlock::CodeBlock ( HierarchicalCodeBlock * hblock , const QString & body )
00025 : TextBlock ( hblock->getParentDocument(), body )
00026 {
00027 initFields ( );
00028 }
00029
00030 CodeBlock::CodeBlock ( CodeDocument * doc, const QString & body )
00031 : TextBlock ( doc, body )
00032 {
00033 initFields( );
00034 }
00035
00036 CodeBlock::~CodeBlock ( ) { }
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00057 void CodeBlock::setContentType ( ContentType new_var ) {
00058 m_contentType = new_var;
00059 }
00060
00067 CodeBlock::ContentType CodeBlock::getContentType ( ) {
00068 return m_contentType;
00069 }
00070
00075
00076
00077
00078
00079
00080
00081
00082
00083
00087 void CodeBlock::saveToXMI ( QDomDocument & doc, QDomElement & root ) {
00088 QDomElement blockElement = doc.createElement( "codeblock" );
00089
00090
00091 setAttributesOnNode(doc, blockElement);
00092
00093 root.appendChild( blockElement );
00094 }
00095
00096 void CodeBlock::setAttributesOnNode( QDomDocument & doc, QDomElement & blockElement)
00097 {
00098
00099
00100 TextBlock::setAttributesOnNode(doc, blockElement);
00101
00102
00103 if(m_contentType != AutoGenerated)
00104 blockElement.setAttribute("contentType",getContentType());
00105
00106 }
00107
00111 void CodeBlock::loadFromXMI ( QDomElement & root ) {
00112
00113 setAttributesFromNode(root);
00114
00115 }
00116
00117 void CodeBlock::setAttributesFromNode (QDomElement & elem) {
00118
00119
00120 TextBlock::setAttributesFromNode(elem);
00121
00122
00123 setContentType(((ContentType) elem.attribute("contentType","0").toInt()));
00124
00125 }
00126
00127 void CodeBlock::setAttributesFromObject(TextBlock * obj)
00128 {
00129
00130 TextBlock::setAttributesFromObject(obj);
00131
00132 CodeBlock * cb = dynamic_cast<CodeBlock*>(obj);
00133 if(cb)
00134 setContentType(cb->getContentType());
00135
00136 }
00137
00138 void CodeBlock::initFields ( ) {
00139 m_contentType = AutoGenerated;
00140
00141 }
00142
00143 #include "codeblock.moc"
This file is part of the documentation for umbrello Version 3.1.0.