diff options
Diffstat (limited to 'umbrello/umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.cpp')
-rw-r--r-- | umbrello/umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/umbrello/umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.cpp b/umbrello/umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.cpp new file mode 100644 index 00000000..0fdfeb0a --- /dev/null +++ b/umbrello/umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.cpp @@ -0,0 +1,78 @@ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +/* This code generated by: + * Author : thomas + * Date : Mon Sep 1 2003 + */ + +#include "cppheadercodeclassfielddeclarationblock.h" + +#include "cppcodeclassfield.h" +#include "cppheadercodedocument.h" + +// Constructors/Destructors +// + +CPPHeaderCodeClassFieldDeclarationBlock::CPPHeaderCodeClassFieldDeclarationBlock ( CodeClassField * parent ) + : CodeClassFieldDeclarationBlock ( parent ) +{ + setOverallIndentationLevel(1); + updateContent(); +} + +CPPHeaderCodeClassFieldDeclarationBlock::~CPPHeaderCodeClassFieldDeclarationBlock ( ) { } + +// +// Methods +// + +// Other methods +// + +/** + */ +void CPPHeaderCodeClassFieldDeclarationBlock::updateContent( ) +{ + UMLObject *umlparent = CodeClassFieldDeclarationBlock::getParentObject(); + if (umlparent == NULL) { + return; + } + + CodeClassField * cf = getParentClassField(); + CPPCodeClassField * hcppcf = dynamic_cast<CPPCodeClassField*>(cf); + + // Set the comment + QString notes = umlparent->getDoc(); + getComment()->setText(notes); + if(notes.isEmpty()) + getComment()->setWriteOutText(false); + else + getComment()->setWriteOutText(true); + + + // Set the body + QString staticValue = umlparent->getStatic() ? "static " : ""; + QString typeName = hcppcf->getTypeName(); + QString fieldName = hcppcf->getFieldName(); + + // Ugh. Sloppy exception. + if (!cf->parentIsAttribute() && !cf->fieldIsSingleValue()) + typeName = hcppcf->getListFieldClassName(); + + QString body = staticValue + ' ' + typeName + ' ' + fieldName + ';'; + + setText(body); + +} + + + +#include "cppheadercodeclassfielddeclarationblock.moc" |