umbrello API Documentation

cppheadercodeclassfielddeclarationblock.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   : Mon Sep 1 2003
00014  */
00015 
00016 #include "cppheadercodeclassfielddeclarationblock.h"
00017 
00018 #include "cppcodeclassfield.h"
00019 #include "cppheadercodedocument.h"
00020 
00021 // Constructors/Destructors
00022 //
00023 
00024 CPPHeaderCodeClassFieldDeclarationBlock::CPPHeaderCodeClassFieldDeclarationBlock ( CodeClassField * parent )
00025         : CodeClassFieldDeclarationBlock ( parent )
00026 {
00027     setOverallIndentationLevel(1);
00028     updateContent();
00029 }
00030 
00031 CPPHeaderCodeClassFieldDeclarationBlock::~CPPHeaderCodeClassFieldDeclarationBlock ( ) { }
00032 
00033 //
00034 // Methods
00035 //
00036 
00037 // Other methods
00038 //
00039 
00042 void CPPHeaderCodeClassFieldDeclarationBlock::updateContent( )
00043 {
00044     UMLObject *umlparent = CodeClassFieldDeclarationBlock::getParentObject();
00045     if (umlparent == NULL) {
00046         return;
00047     }
00048 
00049     CodeClassField * cf = getParentClassField();
00050     CPPCodeClassField * hcppcf = dynamic_cast<CPPCodeClassField*>(cf);
00051 
00052     // Set the comment
00053     QString notes = umlparent->getDoc();
00054     getComment()->setText(notes);
00055     if(notes.isEmpty())
00056         getComment()->setWriteOutText(false);
00057     else
00058         getComment()->setWriteOutText(true);
00059 
00060 
00061     // Set the body
00062     QString staticValue = umlparent->getStatic() ? "static " : "";
00063     QString typeName = hcppcf->getTypeName();
00064     QString fieldName = hcppcf->getFieldName();
00065 
00066     // Ugh. Sloppy exception.
00067     if (!cf->parentIsAttribute() && !cf->fieldIsSingleValue())
00068         typeName = hcppcf->getListFieldClassName();
00069 
00070     QString body = staticValue + ' ' + typeName + ' ' + fieldName + ';';
00071 
00072     setText(body);
00073 
00074 }
00075 
00076 
00077 
00078 #include "cppheadercodeclassfielddeclarationblock.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:56 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003