umbrello API Documentation

codeblock.cpp

00001 
00002 /***************************************************************************
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  ***************************************************************************/
00010 
00011 /*  This code generated by:
00012  *      Author : thomas
00013  *      Date   : Wed Jun 18 2003
00014  */
00015 
00016 #include "codeblock.h"
00017 #include "codedocument.h"
00018 
00019 #include "hierarchicalcodeblock.h"
00020 
00021 // Constructors/Destructors
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 // Methods
00040 //
00041 
00042 
00043 // Accessor methods
00044 //
00045 
00046 
00047 // Public attribute accessor methods
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 CodeBlockDialog * CodeBlock::getDialog ( ) {
00077     return m_dialog;
00078 }
00079 */
00080 
00081 // Other methods
00082 //
00083 
00087 void CodeBlock::saveToXMI ( QDomDocument & doc, QDomElement & root ) {
00088     QDomElement blockElement = doc.createElement( "codeblock" );
00089 
00090     // set attributes
00091     setAttributesOnNode(doc, blockElement);
00092 
00093     root.appendChild( blockElement );
00094 }
00095 
00096 void CodeBlock::setAttributesOnNode( QDomDocument & doc, QDomElement & blockElement)
00097 {
00098 
00099     // call super-class
00100     TextBlock::setAttributesOnNode(doc, blockElement);
00101 
00102     // local attributes
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     // set attributes from the XMI in super-class
00120     TextBlock::setAttributesFromNode(elem);
00121 
00122     // set local fields now
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     //  m_dialog = new CodeBlockDialog( );
00141 }
00142 
00143 #include "codeblock.moc"
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:07:55 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003