• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

umbrello/umbrello

  • sources
  • kde-4.12
  • kdesdk
  • umbrello
  • umbrello
  • codegenerators
  • cpp
cppheadercodedocument.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * This program is free software; you can redistribute it and/or modify *
3  * it under the terms of the GNU General Public License as published by *
4  * the Free Software Foundation; either version 2 of the License, or *
5  * (at your option) any later version. *
6  * *
7  * copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
8  * copyright (C) 2004-2013 *
9  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
10  ***************************************************************************/
11 
12 // own header
13 #include "cppheadercodedocument.h"
14 
15 // local includes
16 #include "cppcodegenerator.h"
17 #include "cppcodegenerationpolicy.h"
18 #include "cppcodedocumentation.h"
19 #include "cppheadercodeaccessormethod.h"
20 #include "cppheadercodeoperation.h"
21 #include "cppheaderclassdeclarationblock.h"
22 #include "cppheadercodeclassfielddeclarationblock.h"
23 #include "debug_utils.h"
24 #include "umlpackagelist.h"
25 #include "package.h"
26 #include "umlclassifierlistitemlist.h"
27 #include "classifierlistitem.h"
28 #include "enum.h"
29 #include "uml.h"
30 
31 // qt includes
32 #include <QRegExp>
33 
37 CPPHeaderCodeDocument::CPPHeaderCodeDocument(UMLClassifier* concept)
38  : ClassifierCodeDocument(concept)
39 {
40  setFileExtension(".h");
41 
42  //initCodeClassFields(); // this is dubious because it calls down to
43  // CodeGenFactory::newCodeClassField(this)
44  // but "this" is still in construction at that time.
45 
46  m_classDeclCodeBlock = 0;
47  m_publicBlock = 0;
48  m_protectedBlock = 0;
49  m_privateBlock = 0;
50  m_namespaceBlock = 0;
51  m_pubConstructorBlock = 0;
52  m_protConstructorBlock = 0;
53  m_privConstructorBlock = 0;
54  m_pubOperationsBlock = 0;
55  m_privOperationsBlock = 0;
56  m_protOperationsBlock = 0;
57 
58  // this will call updateContent() as well as other things that sync our document.
59  //synchronize();
60 }
61 
65 CPPHeaderCodeDocument::~CPPHeaderCodeDocument()
66 {
67  resetTextBlocks();
68 }
69 
70 CPPHeaderClassDeclarationBlock * CPPHeaderCodeDocument::getClassDecl()
71 {
72  if(!m_classDeclCodeBlock) {
73  m_classDeclCodeBlock = new CPPHeaderClassDeclarationBlock (this); // was deleted before our load
74  m_classDeclCodeBlock->updateContent();
75  m_classDeclCodeBlock->setTag("classDeclarationBlock");
76  }
77  return m_classDeclCodeBlock;
78 }
79 
80 // Sigh. NOT optimal. The only reason that we need to have this
81 // is so we can create the CPPHeaderClassDeclarationBlock.
82 // would be better if we could create a handler interface that each
83 // codeblock used so all we have to do here is add the handler
84 void CPPHeaderCodeDocument::loadChildTextBlocksFromNode (QDomElement & root)
85 {
86  QDomNode tnode = root.firstChild();
87  QDomElement telement = tnode.toElement();
88  bool loadCheckForChildrenOK = false;
89  while(!telement.isNull()) {
90  QString nodeName = telement.tagName();
91 
92  if(nodeName == "textblocks") {
93 
94  QDomNode node = telement.firstChild();
95  QDomElement element = node.toElement();
96 
97  // if there is nothing to begin with, then we don't worry about it
98  loadCheckForChildrenOK = element.isNull() ? true : false;
99 
100  while(!element.isNull()) {
101  QString name = element.tagName();
102 
103  if(name == "codecomment") {
104  CodeComment * block = new CPPCodeDocumentation(this);
105  block->loadFromXMI(element);
106  if(!addTextBlock(block))
107  {
108  uError()<<"Unable to add codeComment to :"<<this;
109  delete block;
110  } else
111  loadCheckForChildrenOK= true;
112  } else
113  if(name == "codeaccessormethod" ||
114  name == "ccfdeclarationcodeblock"
115  ) {
116  QString acctag = element.attribute("tag","");
117  // search for our method in the
118  TextBlock * tb = findCodeClassFieldTextBlockByTag(acctag);
119  if(!tb || !addTextBlock(tb))
120  {
121  uError()<<"Unable to add codeclassfield child method to:"<<this;
122  // DON'T delete
123  } else
124  loadCheckForChildrenOK= true;
125 
126  } else
127  if(name == "codeblock") {
128  CodeBlock * block = newCodeBlock();
129  block->loadFromXMI(element);
130  if(!addTextBlock(block))
131  {
132  uError()<<"Unable to add codeBlock to :"<<this;
133  delete block;
134  } else
135  loadCheckForChildrenOK= true;
136  } else
137  if(name == "codeblockwithcomments") {
138  CodeBlockWithComments * block = newCodeBlockWithComments();
139  block->loadFromXMI(element);
140  if(!addTextBlock(block))
141  {
142  uError()<<"Unable to add codeBlockwithcomments to:"<<this;
143  delete block;
144  } else
145  loadCheckForChildrenOK= true;
146  } else
147  if(name == "header") {
148  // do nothing.. this is treated elsewhere
149  } else
150  if(name == "hierarchicalcodeblock") {
151  HierarchicalCodeBlock * block = newHierarchicalCodeBlock();
152  block->loadFromXMI(element);
153  if(!addTextBlock(block))
154  {
155  uError()<<"Unable to add hierarchicalcodeBlock to:"<<this;
156  delete block;
157  } else
158  loadCheckForChildrenOK= true;
159  } else
160  if(name == "codeoperation") {
161  // find the code operation by id
162  QString id = element.attribute("parent_id","-1");
163  UMLObject * obj = UMLApp::app()->document()->findObjectById(Uml::ID::fromString(id));
164  UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
165  if(op) {
166  CodeOperation * block = new CPPHeaderCodeOperation(this, op);
167  block->updateMethodDeclaration();
168  block->updateContent();
169  block->loadFromXMI(element);
170  if(addTextBlock(block))
171  loadCheckForChildrenOK= true;
172  else
173  {
174  uError()<<"Unable to add codeoperation to:"<<this;
175  block->deleteLater();
176  }
177  } else
178  uError()<<"Unable to find operation create codeoperation for:"<<this;
179  }
180  else
181  if(name == "cppheaderclassdeclarationblock")
182  {
183  CPPHeaderClassDeclarationBlock * block = getClassDecl();
184  block->loadFromXMI(element);
185  // normally this would be populated by the following syncToparent
186  // call, but we cant wait for it, so lets just do it now.
187  m_namespaceBlock = getHierarchicalCodeBlock("namespace", "Namespace", 0);
188 
189  if(!m_namespaceBlock || !m_namespaceBlock->addTextBlock(block))
190  {
191  uError()<<"Error:cant add class declaration codeblock";
192  // DON'T delete/release block
193  // block->release();
194  } else
195  loadCheckForChildrenOK= true;
196 
197  }
198  // only needed for extreme debugging conditions (E.g. making new codeclassdocument loader)
199  //else
200  //uDebug()<<" LoadFromXMI: Got strange tag in text block stack:"<<name<<", ignorning";
201 
202  node = element.nextSibling();
203  element = node.toElement();
204  }
205  break;
206  }
207 
208  tnode = telement.nextSibling();
209  telement = tnode.toElement();
210  }
211 
212  if(!loadCheckForChildrenOK)
213  {
214  CodeDocument * test = dynamic_cast<CodeDocument*>(this);
215  if(test)
216  {
217  uWarning()<<" loadChildBlocks : unable to initialize any child blocks in doc: "<<test->getFileName()<<" "<<this;
218  } else {
219  HierarchicalCodeBlock * hb = dynamic_cast<HierarchicalCodeBlock*>(this);
220  if(hb)
221  uWarning()<<" loadChildBlocks : unable to initialize any child blocks in Hblock: "<<hb->getTag()<<" "<<this;
222  else
223  uDebug()<<" loadChildBlocks : unable to initialize any child blocks in UNKNOWN OBJ:"<<this;
224  }
225  }
226 
227 }
228 
229 void CPPHeaderCodeDocument::resetTextBlocks()
230 {
231  // all special pointers need to be zero'd out.
232  if (m_classDeclCodeBlock) {
233  delete m_classDeclCodeBlock;
234  m_classDeclCodeBlock = 0;
235  }
236  if (m_publicBlock) {
237  delete m_publicBlock;
238  m_publicBlock = 0;
239  }
240  if (m_protectedBlock) {
241  delete m_protectedBlock;
242  m_protectedBlock = 0;
243  }
244  if (m_privateBlock) {
245  delete m_privateBlock;
246  m_privateBlock = 0;
247  }
248  if (m_namespaceBlock) {
249  delete m_namespaceBlock;
250  m_namespaceBlock = 0;
251  }
252  if (m_pubConstructorBlock) {
253  delete m_pubConstructorBlock;
254  m_pubConstructorBlock = 0;
255  }
256  if (m_protConstructorBlock) {
257  delete m_protConstructorBlock;
258  m_protConstructorBlock = 0;
259  }
260  if (m_privConstructorBlock) {
261  delete m_privConstructorBlock;
262  m_privConstructorBlock = 0;
263  }
264  if (m_pubOperationsBlock) {
265  delete m_pubOperationsBlock;
266  m_pubOperationsBlock = 0;
267  }
268  if (m_privOperationsBlock) {
269  delete m_privOperationsBlock;
270  m_privOperationsBlock = 0;
271  }
272  if (m_protOperationsBlock) {
273  delete m_protOperationsBlock;
274  m_protOperationsBlock = 0;
275  }
276 
277  // now do the traditional release of child text blocks
278  ClassifierCodeDocument::resetTextBlocks();
279 }
280 
288 bool CPPHeaderCodeDocument::addCodeOperation(CodeOperation* op)
289 {
290  if (op == NULL) {
291  uDebug() << "CodeOperation is null!";
292  return false;;
293  }
294  Uml::Visibility::Enum scope = op->getParentOperation()->visibility();
295  if(!op->getParentOperation()->isLifeOperation())
296  {
297  switch (scope) {
298  default:
299  case Uml::Visibility::Public:
300  return (m_pubOperationsBlock == NULL ? false : m_pubOperationsBlock->addTextBlock(op));
301  break;
302  case Uml::Visibility::Protected:
303  return (m_protOperationsBlock == NULL ? false : m_protOperationsBlock->addTextBlock(op));
304  break;
305  case Uml::Visibility::Private:
306  return (m_privOperationsBlock == NULL ? false : m_privOperationsBlock->addTextBlock(op));
307  break;
308  }
309  } else {
310  switch (scope) {
311  default:
312  case Uml::Visibility::Public:
313  return (m_pubConstructorBlock == NULL ? false : m_pubConstructorBlock->addTextBlock(op));
314  break;
315  case Uml::Visibility::Protected:
316  return (m_protConstructorBlock == NULL ? false : m_protConstructorBlock->addTextBlock(op));
317  break;
318  case Uml::Visibility::Private:
319  return (m_privConstructorBlock == NULL ? false : m_privConstructorBlock->addTextBlock(op));
320  break;
321  }
322  }
323 }
324 
329 /*
330 void CPPHeaderCodeDocument::saveToXMI (QDomDocument & doc, QDomElement & root)
331 {
332  QDomElement docElement = doc.createElement("");
333 
334  setAttributesOnNode(doc, docElement);
335 
336  root.appendChild(docElement);
337 }
338 */
339 
340 // This method will cause the class to rebuild its text representation.
341 // based on the parent classifier object.
342 // For any situation in which this is called, we are either building the code
343 // document up, or replacing/regenerating the existing auto-generated parts. As
344 // such, we will want to insert everything we resonablely will want
345 // during creation. We can set various parts of the document (esp. the
346 // comments) to appear or not, as needed.
347 void CPPHeaderCodeDocument::updateContent()
348 {
349  // Gather info on the various fields and parent objects of this class...
350  UMLClassifier * c = getParentClassifier();
351  CodeGenPolicyExt *pe = UMLApp::app()->policyExt();
352  CPPCodeGenerationPolicy * policy = dynamic_cast<CPPCodeGenerationPolicy*>(pe);
353 
354  // first, set the global flag on whether or not to show classfield info
355  const CodeClassFieldList * cfList = getCodeClassFieldList();
356  CodeClassFieldList::const_iterator it = cfList->begin();
357  CodeClassFieldList::const_iterator end = cfList->end();
358  for(; it != end; ++it)
359  (*it)->setWriteOutMethods(policy->getAutoGenerateAccessors());
360 
361  // attribute-based ClassFields
362  // we do it this way to have the static fields sorted out from regular ones
363  CodeClassFieldList staticPublicAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Public);
364  CodeClassFieldList publicAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Public);
365  CodeClassFieldList staticProtectedAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Protected);
366  CodeClassFieldList protectedAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Protected);
367  CodeClassFieldList staticPrivateAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, true, Uml::Visibility::Private);
368  CodeClassFieldList privateAttribClassFields = getSpecificClassFields (CodeClassField::Attribute, false, Uml::Visibility::Private);
369 
370  // association-based ClassFields
371  // don't care if they are static or not..all are lumped together
372  CodeClassFieldList publicPlainAssocClassFields = getSpecificClassFields (CodeClassField::PlainAssociation, Uml::Visibility::Public);
373  CodeClassFieldList publicAggregationClassFields = getSpecificClassFields (CodeClassField::Aggregation, Uml::Visibility::Public);
374  CodeClassFieldList publicCompositionClassFields = getSpecificClassFields (CodeClassField::Composition, Uml::Visibility::Public);
375 
376  CodeClassFieldList protPlainAssocClassFields = getSpecificClassFields (CodeClassField::PlainAssociation, Uml::Visibility::Protected);
377  CodeClassFieldList protAggregationClassFields = getSpecificClassFields (CodeClassField::Aggregation, Uml::Visibility::Protected);
378  CodeClassFieldList protCompositionClassFields = getSpecificClassFields (CodeClassField::Composition, Uml::Visibility::Protected);
379 
380  CodeClassFieldList privPlainAssocClassFields = getSpecificClassFields (CodeClassField::PlainAssociation, Uml::Visibility::Private);
381  CodeClassFieldList privAggregationClassFields = getSpecificClassFields (CodeClassField::Aggregation, Uml::Visibility::Private);
382  CodeClassFieldList privCompositionClassFields = getSpecificClassFields (CodeClassField::Composition, Uml::Visibility::Private);
383 
384  bool hasOperationMethods = false;
385  Q_ASSERT(c != NULL);
386  if (c) {
387  UMLOperationList list = c->getOpList();
388  hasOperationMethods = ! list.isEmpty();
389  }
390  bool hasNamespace = false;
391  bool isEnumeration = false;
392  bool isInterface = parentIsInterface();
393  bool hasclassFields = hasClassFields();
394  bool forcedoc = UMLApp::app()->commonPolicy()->getCodeVerboseDocumentComments();
395  QString endLine = UMLApp::app()->commonPolicy()->getNewLineEndingChars();
396 
397  UMLClassifierList superclasses = c->findSuperClassConcepts();
398 
399 
400  // START GENERATING CODE/TEXT BLOCKS and COMMENTS FOR THE DOCUMENT
401  //
402 
403  // Write the hash define stuff to prevent multiple parsing/inclusion of header
404  QString cppClassName = CodeGenerator::cleanName(c->name());
405  QString hashDefine = CodeGenerator::cleanName(c->name().toUpper().simplified());
406  QString defText = "#ifndef "+hashDefine + "_H"+ endLine + "#define "+ hashDefine + "_H";
407  addOrUpdateTaggedCodeBlockWithComments("hashDefBlock", defText, "", 0, false);
408 
409  // INCLUDE CODEBLOCK
410  //
411  // Q: Why all utils? Isnt just List and Vector the only classes we are using?
412  // A: doesn't matter at all; its more readable to just include '*' and cpp compilers
413  // don't slow down or anything. (TZ)
414  QString includeStatement = "";
415  bool stringGlobal = policy->stringIncludeIsGlobal();
416  QString sStartBrak = stringGlobal ? "<" : "\"";
417  QString sEndBrak = stringGlobal ? ">" : "\"";
418  includeStatement.append("#include "+sStartBrak+policy->getStringClassNameInclude()+sEndBrak+endLine);
419  if (hasObjectVectorClassFields())
420  {
421  bool vecGlobal = policy->vectorIncludeIsGlobal();
422  QString vStartBrak = vecGlobal ? "<" : "\"";
423  QString vEndBrak = vecGlobal ? ">" : "\"";
424  QString value ="#include "+vStartBrak+policy->getVectorClassNameInclude()+vEndBrak;
425  includeStatement.append(value+endLine);
426  }
427 
428  //only include classes in a different package from this class
429  UMLPackageList includes;
430  QMap<UMLPackage *, QString> packageMap; // so we don't repeat packages
431 
432  CodeGenerator::findObjectsRelated(c, includes);
433  foreach(UMLPackage* con, includes) {
434  if (con->baseType() != UMLObject::ot_Datatype && !packageMap.contains(con)) {
435  packageMap.insert(con, con->package());
436  if(con != getParentClassifier())
437  includeStatement.append("#include \""+CodeGenerator::cleanName(con->name().toLower())+".h\""+endLine);
438  }
439  }
440  // now, add/update the includes codeblock
441  CodeBlockWithComments * inclBlock = addOrUpdateTaggedCodeBlockWithComments("includes", includeStatement, QString(), 0, false);
442  if(includeStatement.isEmpty() && inclBlock->contentType() == CodeBlock::AutoGenerated)
443  inclBlock->setWriteOutText(false);
444  else
445  inclBlock->setWriteOutText(true);
446 
447  // Using
448  QString usingStatement;
449  foreach(UMLClassifier* classifier, superclasses) {
450  if(classifier->package()!=c->package() && !classifier->package().isEmpty()) {
451  usingStatement.append("using "+CodeGenerator::cleanName(c->package())+"::"+cleanName(c->name())+';'+endLine);
452  }
453  }
454  CodeBlockWithComments * usingBlock = addOrUpdateTaggedCodeBlockWithComments("using", usingStatement, "", 0, false);
455  if(usingStatement.isEmpty() && usingBlock->contentType() == CodeBlock::AutoGenerated)
456  usingBlock->setWriteOutText(false);
457  else
458  usingBlock->setWriteOutText(true);
459 
460  // namespace
461  // This needs special treatment. We cant use "nowriteouttext" for this, as
462  // that will prevent the class declaration from being written. Instead, we
463  // check if "hasNamspace" is true or not, and then indent the remaining code
464  // appropriately as well as set the start/end text of this namespace block.
465  if (c->umlPackage() && policy->getPackageIsNamespace())
466  hasNamespace = true;
467  else
468  hasNamespace = false;
469 
470  // set start/end text of namespace block
471  m_namespaceBlock = getHierarchicalCodeBlock("namespace", "Namespace", 0);
472  if(hasNamespace) {
473  UMLPackageList pkgList = c->packages();
474  QString pkgs;
475  UMLPackage *pkg;
476  foreach (pkg, pkgList) {
477  pkgs += "namespace " + CodeGenerator::cleanName(pkg->name()) + " { ";
478  }
479  m_namespaceBlock->setStartText(pkgs);
480  QString closingBraces;
481  foreach (pkg, pkgList) {
482  closingBraces += "} ";
483  }
484  m_namespaceBlock->setEndText(closingBraces);
485  m_namespaceBlock->getComment()->setWriteOutText(true);
486  } else {
487  m_namespaceBlock->setStartText("");
488  m_namespaceBlock->setEndText("");
489  m_namespaceBlock->getComment()->setWriteOutText(false);
490  }
491 
492  // Enum types for include
493  if (!isInterface) {
494  QString enumStatement;
495  QString indent = UMLApp::app()->commonPolicy()->getIndentation();
496  UMLEnum* e = dynamic_cast<UMLEnum*>(c);
497  if (e) {
498  enumStatement.append(indent + "enum " + cppClassName + " {" + endLine);
499 
500  // populate
501  UMLClassifierListItemList ell = e->getFilteredList(UMLObject::ot_EnumLiteral);
502  for (UMLClassifierListItemListIt elit(ell) ; elit.hasNext() ;) {
503  UMLClassifierListItem* el = elit.next();
504  enumStatement.append(indent+indent);
505  enumStatement.append(CodeGenerator::cleanName(el->name()));
506  if (elit.hasNext()) {
507  el=elit.next();
508  enumStatement.append(", "+endLine);
509  } else {
510  break;
511  }
512  enumStatement.append(endLine);
513  }
514  enumStatement.append(indent+"};");
515  isEnumeration = true;
516  }
517  m_namespaceBlock->addOrUpdateTaggedCodeBlockWithComments("enums", enumStatement, "", 0, false);
518  }
519 
520  // CLASS DECLARATION BLOCK
521  //
522 
523  // add the class declaration block to the namespace block.
524  CPPHeaderClassDeclarationBlock * myClassDeclCodeBlock = getClassDecl();
525  m_namespaceBlock->addTextBlock(myClassDeclCodeBlock); // note: wont add if already present
526 
527  // Is this really true?? hmm..
528  if(isEnumeration)
529  myClassDeclCodeBlock->setWriteOutText(false); // not written out IF its an enumeration class
530  else
531  myClassDeclCodeBlock->setWriteOutText(true);
532 
533  //
534  // Main Sub-Blocks
535  //
536 
537  // declare public, protected and private methods, attributes (fields).
538  // set the start text ONLY if this is the first time we created the objects.
539  bool createdPublicBlock = m_publicBlock == 0 ? true : false;
540  m_publicBlock = myClassDeclCodeBlock->getHierarchicalCodeBlock("publicBlock","Public stuff", 0);
541  if (createdPublicBlock)
542  m_publicBlock->setStartText("public:");
543 
544  bool createdProtBlock = m_protectedBlock == 0 ? true : false;
545  m_protectedBlock = myClassDeclCodeBlock->getHierarchicalCodeBlock("protectedBlock","Protected stuff", 0);
546  if(createdProtBlock)
547  m_protectedBlock->setStartText("protected:");
548 
549  bool createdPrivBlock = m_privateBlock == 0 ? true : false;
550  m_privateBlock = myClassDeclCodeBlock->getHierarchicalCodeBlock("privateBlock","Private stuff", 0);
551  if(createdPrivBlock)
552  m_privateBlock->setStartText("private:");
553 
554  //
555  // * CLASS FIELD declaration section
556  //
557 
558  // setup/get/create the field declaration code block
559  //
560 
561  // public fields: Update the comment: we only set comment to appear under the following conditions
562  HierarchicalCodeBlock * publicFieldDeclBlock = m_publicBlock->getHierarchicalCodeBlock("publicFieldsDecl", "Fields", 1);
563  CodeComment * pubFcomment = publicFieldDeclBlock->getComment();
564  if (!forcedoc && !hasclassFields)
565  pubFcomment->setWriteOutText(false);
566  else
567  pubFcomment->setWriteOutText(true);
568 
569  // protected fields: Update the comment: we only set comment to appear under the following conditions
570  HierarchicalCodeBlock * protectedFieldDeclBlock = m_protectedBlock->getHierarchicalCodeBlock("protectedFieldsDecl", "Fields", 1);
571  CodeComment * protFcomment = protectedFieldDeclBlock->getComment();
572  if (!forcedoc && !hasclassFields)
573  protFcomment->setWriteOutText(false);
574  else
575  protFcomment->setWriteOutText(true);
576 
577  // private fields: Update the comment: we only set comment to appear under the following conditions
578  HierarchicalCodeBlock * privateFieldDeclBlock = m_privateBlock->getHierarchicalCodeBlock("privateFieldsDecl", "Fields", 1);
579  CodeComment * privFcomment = privateFieldDeclBlock->getComment();
580  if (!forcedoc && !hasclassFields)
581  privFcomment->setWriteOutText(false);
582  else
583  privFcomment->setWriteOutText(true);
584 
585 
586  // now actually declare the fields within the appropriate HCodeBlock
587  //
588 
589  // public
590  declareClassFields(staticPublicAttribClassFields, publicFieldDeclBlock);
591  declareClassFields(publicAttribClassFields, publicFieldDeclBlock);
592  declareClassFields(publicPlainAssocClassFields, publicFieldDeclBlock);
593  declareClassFields(publicAggregationClassFields, publicFieldDeclBlock);
594  declareClassFields(publicCompositionClassFields, publicFieldDeclBlock);
595 
596  // protected
597  declareClassFields(staticProtectedAttribClassFields, protectedFieldDeclBlock);
598  declareClassFields(protectedAttribClassFields, protectedFieldDeclBlock);
599  declareClassFields(protPlainAssocClassFields, protectedFieldDeclBlock);
600  declareClassFields(protAggregationClassFields, protectedFieldDeclBlock);
601  declareClassFields(protCompositionClassFields, protectedFieldDeclBlock);
602 
603  // private
604  declareClassFields(staticPrivateAttribClassFields, privateFieldDeclBlock);
605  declareClassFields(privateAttribClassFields, privateFieldDeclBlock);
606  declareClassFields(privPlainAssocClassFields, privateFieldDeclBlock);
607  declareClassFields(privAggregationClassFields, privateFieldDeclBlock);
608  declareClassFields(privCompositionClassFields, privateFieldDeclBlock);
609 
610  //
611  // METHODS section
612  //
613 
614  // get/create the method codeblock
615 
616  // public methods
617  HierarchicalCodeBlock * pubMethodsBlock = m_publicBlock->getHierarchicalCodeBlock("pubMethodsBlock", "", 1);
618  CodeComment * pubMethodsComment = pubMethodsBlock->getComment();
619  // set conditions for showing this comment
620  if (!forcedoc && !hasclassFields && !hasOperationMethods)
621  pubMethodsComment->setWriteOutText(false);
622  else
623  pubMethodsComment->setWriteOutText(true);
624 
625  // protected methods
626  HierarchicalCodeBlock * protMethodsBlock = m_protectedBlock->getHierarchicalCodeBlock("protMethodsBlock", "", 1);
627  CodeComment * protMethodsComment = protMethodsBlock->getComment();
628  // set conditions for showing this comment
629  if (!forcedoc && !hasclassFields && !hasOperationMethods)
630  protMethodsComment->setWriteOutText(false);
631  else
632  protMethodsComment->setWriteOutText(true);
633 
634  // private methods
635  HierarchicalCodeBlock * privMethodsBlock = m_privateBlock->getHierarchicalCodeBlock("privMethodsBlock", "", 1);
636  CodeComment * privMethodsComment = privMethodsBlock->getComment();
637  // set conditions for showing this comment
638  if (!forcedoc && !hasclassFields && !hasOperationMethods)
639  privMethodsComment->setWriteOutText(false);
640  else
641  privMethodsComment->setWriteOutText(true);
642 
643 
644  // METHODS sub-section : constructor methods
645  //
646  CodeGenerationPolicy *pol = UMLApp::app()->commonPolicy();
647 
648  // setup/get/create the constructor codeblocks
649 
650  // public
651  m_pubConstructorBlock = pubMethodsBlock->getHierarchicalCodeBlock("constructionMethods", "Constructors", 1);
652  // special condiions for showing comment: only when autogenerateding empty constructors
653  // Although, we *should* check for other constructor methods too
654  CodeComment * pubConstComment = m_pubConstructorBlock->getComment();
655  if (!forcedoc && (isInterface || !pol->getAutoGenerateConstructors()))
656  pubConstComment->setWriteOutText(false);
657  else
658  pubConstComment->setWriteOutText(true);
659 
660  // protected
661  m_protConstructorBlock = protMethodsBlock->getHierarchicalCodeBlock("constructionMethods", "Constructors", 1);
662  // special condiions for showing comment: only when autogenerateding empty constructors
663  // Although, we *should* check for other constructor methods too
664  CodeComment * protConstComment = m_protConstructorBlock->getComment();
665  if (!forcedoc && (isInterface || !pol->getAutoGenerateConstructors()))
666  protConstComment->setWriteOutText(false);
667  else
668  protConstComment->setWriteOutText(true);
669 
670  // private
671  m_privConstructorBlock = privMethodsBlock->getHierarchicalCodeBlock("constructionMethods", "Constructors", 1);
672  // special condiions for showing comment: only when autogenerateding empty constructors
673  // Although, we *should* check for other constructor methods too
674  CodeComment * privConstComment = m_privConstructorBlock->getComment();
675  if (!forcedoc && (isInterface || !pol->getAutoGenerateConstructors()))
676  privConstComment->setWriteOutText(false);
677  else
678  privConstComment->setWriteOutText(true);
679 
680  // add/get the empty constructor. I guess since there is no
681  // meta-data to state what the scope of this method is, we will make it
682  // "public" as a default. This might present problems if the user wants
683  // to move the block into the "private" or "protected" blocks.
684  QString emptyConstStatement = cppClassName + " () { }";
685 
686  // search for this first in the entire document. IF not present, put
687  // it in the public constructor method block
688  TextBlock * emptyConstTb = findTextBlockByTag("emptyconstructor", true);
689  CodeBlockWithComments * emptyConstBlock = dynamic_cast<CodeBlockWithComments*>(emptyConstTb);
690  if(!emptyConstBlock)
691  emptyConstBlock = m_pubConstructorBlock->addOrUpdateTaggedCodeBlockWithComments("emptyconstructor", emptyConstStatement, "Empty Constructor", 1, false);
692 
693  // Now, as an additional condition we only show the empty constructor block
694  // IF it was desired to be shown
695  if(!isInterface && pol->getAutoGenerateConstructors())
696  emptyConstBlock->setWriteOutText(true);
697  else
698  emptyConstBlock->setWriteOutText(false);
699 
700 
701  // METHODS subsection : ACCESSOR METHODS
702  //
703 
704  // get/create the accessor codeblock
705 
706  // public
707  HierarchicalCodeBlock * pubAccessorBlock = pubMethodsBlock->getHierarchicalCodeBlock("accessorMethods", "Accessor Methods", 1);
708  // set conditions for showing section comment
709  CodeComment * pubAccessComment = pubAccessorBlock->getComment();
710  if (!forcedoc && !hasclassFields)
711  pubAccessComment->setWriteOutText(false);
712  else
713  pubAccessComment->setWriteOutText(true);
714 
715  // protected
716  HierarchicalCodeBlock * protAccessorBlock = protMethodsBlock->getHierarchicalCodeBlock("accessorMethods", "Accessor Methods", 1);
717  // set conditions for showing section comment
718  CodeComment * protAccessComment = protAccessorBlock->getComment();
719  if (!forcedoc && !hasclassFields)
720  protAccessComment->setWriteOutText(false);
721  else
722  protAccessComment->setWriteOutText(true);
723 
724  // private
725  HierarchicalCodeBlock * privAccessorBlock = privMethodsBlock->getHierarchicalCodeBlock("accessorMethods", "Accessor Methods", 1);
726  // set conditions for showing section comment
727  CodeComment * privAccessComment = privAccessorBlock->getComment();
728  // We've to copy the private accessorMethods to the public block
729  if (!forcedoc && !hasclassFields)
730  privAccessComment->setWriteOutText(false);
731  else
732  privAccessComment->setWriteOutText(true);
733 
734  // now, 2 sub-sub sections in accessor block
735  // add/update accessor methods for attributes
736  HierarchicalCodeBlock * pubStaticAccessors = pubAccessorBlock->getHierarchicalCodeBlock("pubStaticAccessorMethods", "", 1);
737  HierarchicalCodeBlock * pubRegularAccessors = pubAccessorBlock->getHierarchicalCodeBlock("pubRegularAccessorMethods", "", 1);
738  pubStaticAccessors->getComment()->setWriteOutText(false); // never write block comment
739  pubRegularAccessors->getComment()->setWriteOutText(false); // never write block comment
740 
741  HierarchicalCodeBlock * protStaticAccessors = protAccessorBlock->getHierarchicalCodeBlock("protStaticAccessorMethods", "", 1);
742  HierarchicalCodeBlock * protRegularAccessors = protAccessorBlock->getHierarchicalCodeBlock("protRegularAccessorMethods", "", 1);
743  protStaticAccessors->getComment()->setWriteOutText(false); // never write block comment
744  protRegularAccessors->getComment()->setWriteOutText(false); // never write block comment
745 
746  HierarchicalCodeBlock * privStaticAccessors = privAccessorBlock->getHierarchicalCodeBlock("privStaticAccessorMethods", "", 1);
747  HierarchicalCodeBlock * privRegularAccessors = privAccessorBlock->getHierarchicalCodeBlock("privRegularAccessorMethods", "", 1);
748  privStaticAccessors->getComment()->setWriteOutText(false); // never write block comment
749  privRegularAccessors->getComment()->setWriteOutText(false); // never write block comment
750 
751  // now add in accessors as appropriate
752 
753  // public stuff
754  pubStaticAccessors->addCodeClassFieldMethods(staticPublicAttribClassFields);
755  pubRegularAccessors->addCodeClassFieldMethods(publicAttribClassFields);
756 
757  // generate accessors as public
758  if (policy && policy->getAccessorsArePublic())
759  {
760  pubRegularAccessors->addCodeClassFieldMethods(privateAttribClassFields);
761  pubRegularAccessors->addCodeClassFieldMethods(protectedAttribClassFields);
762  }
763 
764  pubRegularAccessors->addCodeClassFieldMethods(publicPlainAssocClassFields);
765  pubRegularAccessors->addCodeClassFieldMethods(publicAggregationClassFields);
766  pubRegularAccessors->addCodeClassFieldMethods(publicCompositionClassFields);
767 
768  // protected stuff
769  protStaticAccessors->addCodeClassFieldMethods(staticProtectedAttribClassFields);
770 
771  // accessors are public so we don't have to create it here
772  if (policy && !policy->getAccessorsArePublic())
773  protRegularAccessors->addCodeClassFieldMethods(protectedAttribClassFields);
774 
775  protRegularAccessors->addCodeClassFieldMethods(protPlainAssocClassFields);
776  protRegularAccessors->addCodeClassFieldMethods(protAggregationClassFields);
777  protRegularAccessors->addCodeClassFieldMethods(protCompositionClassFields);
778 
779  // private stuff
780  privStaticAccessors->addCodeClassFieldMethods(staticPrivateAttribClassFields);
781 
782  // accessors are public so we don't have to create it here
783  if (policy && !policy->getAccessorsArePublic())
784  privRegularAccessors->addCodeClassFieldMethods(privateAttribClassFields);
785 
786  privRegularAccessors->addCodeClassFieldMethods(privPlainAssocClassFields);
787  privRegularAccessors->addCodeClassFieldMethods(privAggregationClassFields);
788  privRegularAccessors->addCodeClassFieldMethods(privCompositionClassFields);
789 
790 
791  // METHODS subsection : Operation methods (e.g. methods derive from operations but which arent constructors)
792  //
793 
794  // setup/get/create the operations codeblock
795 
796  // public
797  m_pubOperationsBlock = pubMethodsBlock->getHierarchicalCodeBlock("operationMethods", "Operations", 1);
798  // set conditions for showing section comment
799  CodeComment * pubOcomment = m_pubOperationsBlock->getComment();
800  if (!forcedoc && !hasOperationMethods)
801  pubOcomment->setWriteOutText(false);
802  else
803  pubOcomment->setWriteOutText(true);
804 
805  //protected
806  m_protOperationsBlock = protMethodsBlock->getHierarchicalCodeBlock("operationMethods", "Operations", 1);
807  // set conditions for showing section comment
808  CodeComment * protOcomment = m_protOperationsBlock->getComment();
809  if (!forcedoc && !hasOperationMethods)
810  protOcomment->setWriteOutText(false);
811  else
812  protOcomment->setWriteOutText(true);
813 
814  //private
815  m_privOperationsBlock = privMethodsBlock->getHierarchicalCodeBlock("operationMethods", "Operations", 1);
816  // set conditions for showing section comment
817  CodeComment * privOcomment = m_privOperationsBlock->getComment();
818  if (!forcedoc && !hasOperationMethods)
819  privOcomment->setWriteOutText(false);
820  else
821  privOcomment->setWriteOutText(true);
822 
823  // Operations
824  //
825  // nothing to do here.. "updateOperations" in parent class puts things
826  // in the right place using the "addCodeOperation" method we defined in this class
827 
828  // FINISH up with hash def block close
829  QString defTextEnd = "#endif //"+hashDefine + "_H";
830  addOrUpdateTaggedCodeBlockWithComments("hashDefBlockEnd", defTextEnd, "", 0, false);
831 }
832 
833 #include "cppheadercodedocument.moc"
UMLObject::packages
UMLPackageList packages(bool includeRoot=false) const
Return a list of the packages in which this class is embedded.
Definition: umlobject.cpp:623
CodeBlock::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
Load params from the appropriate XMI element node.
Definition: codeblock.cpp:91
UMLObject::ot_EnumLiteral
Definition: umlobject.h:60
ClassifierCodeDocument::getSpecificClassFields
CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType)
Get a list of codeclassifier objects held by this classifiercodedocument that meet the passed criteri...
Definition: classifiercodedocument.cpp:54
UMLPackage
This class contains the non-graphical information required for a UML Package.
Definition: package.h:32
CodeDocument::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()
Create a new CodeBlockWithComments object belonging to this CodeDocument.
Definition: codedocument.cpp:465
CodeDocument::newCodeBlock
virtual CodeBlock * newCodeBlock()
Create a new CodeBlock object belonging to this CodeDocument.
Definition: codedocument.cpp:456
UMLClassifierListItemList
This sub-class adds copyInto and clone to the QPtrList base class...
Definition: umlclassifierlistitemlist.h:26
ClassifierCodeDocument::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Find a specific textblock held by any code class field in this document by its tag.
Definition: classifiercodedocument.cpp:766
UMLClassifier
This class defines the non-graphical information required for a UML Classifier (ie a class or interfa...
Definition: classifier.h:39
CodeBlock
A "chunk" of code within the code document.
Definition: codeblock.h:20
CodeBlockWithComments::getComment
CodeComment * getComment() const
Get the Comment object.
Definition: codeblockwithcomments.cpp:46
CPPHeaderCodeDocument::CPPHeaderCodeDocument
CPPHeaderCodeDocument(UMLClassifier *classifier)
Constructor.
Definition: cppheadercodedocument.cpp:37
UMLClassifierListItem
Classifiers (classes, interfaces) have lists of operations, attributes, templates and others...
Definition: classifierlistitem.h:29
CodeClassField::Attribute
Definition: codeclassfield.h:34
ClassifierCodeDocument
class ClassifierCodeDocument A CodeDocument which represents a UMLClassifier (e.g.
Definition: classifiercodedocument.h:33
CPPCodeGenerationPolicy::getPackageIsNamespace
bool getPackageIsNamespace()
Get the value of m_packageIsNamespace.
Definition: cppcodegenerationpolicy.cpp:138
Uml::Visibility::Enum
Enum
Definition: basictypes.h:56
CodeComment::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
Load params from the appropriate XMI element node.
Definition: codecomment.cpp:42
UMLObject::visibility
Uml::Visibility::Enum visibility() const
Returns the visibility of the object.
Definition: umlobject.cpp:435
UMLClassifier::getFilteredList
virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Returns the entries in m_List that are of the requested type.
Definition: classifier.cpp:1019
UMLClassifierListItemListIt
QListIterator< UMLClassifierListItem * > UMLClassifierListItemListIt
Definition: umlclassifierlistitemlist.h:17
TextBlock::getTag
QString getTag() const
Get the tag of this text block.
Definition: textblock.cpp:110
CodeBlock::AutoGenerated
the content was generated by code generation itself
Definition: codeblock.h:28
CodeGenerationPolicy::getNewLineEndingChars
QString getNewLineEndingChars() const
Utility function to get the actual characters.
Definition: codegenerationpolicy.cpp:248
ClassifierCodeDocument::getCodeClassFieldList
CodeClassFieldList * getCodeClassFieldList()
Get the list of CodeClassField objects held by m_classfieldVector.
Definition: classifiercodedocument.cpp:262
UMLApp::app
static UMLApp * app()
Get the last created instance of this class.
Definition: uml.cpp:206
CodeOperation::updateMethodDeclaration
virtual void updateMethodDeclaration()=0
This is the method called from within syncToparent().
HierarchicalCodeBlock::setEndText
void setEndText(const QString &new_var)
Set the value of m_endText.
Definition: hierarchicalcodeblock.cpp:43
CodeGenerationPolicy
class CodeGenerationPolicy This class describes the code generation policy for this project...
Definition: codegenerationpolicy.h:29
CodeClassField::Composition
Definition: codeclassfield.h:34
CodeDocument::newHierarchicalCodeBlock
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()
Create a new HierarchicalCodeBlock object belonging to this CodeDocument.
Definition: codedocument.cpp:474
CodeBlock::contentType
ContentType contentType() const
Get the value of m_contentType specifies whether the content (text) of this object was generated by t...
Definition: codeblock.cpp:54
umlpackagelist.h
CPPCodeGenerationPolicy::vectorIncludeIsGlobal
bool vectorIncludeIsGlobal()
Determine if the vector include is global.
Definition: cppcodegenerationpolicy.cpp:230
CodeOperation::updateContent
virtual void updateContent()
This is the method called from within syncToparent() to update the body of the method.
Definition: codeoperation.cpp:151
uWarning
#define uWarning()
Definition: debug_utils.h:97
ClassifierCodeDocument::getParentClassifier
UMLClassifier * getParentClassifier()
Get the value of m_parentclassifier.
Definition: classifiercodedocument.cpp:271
UMLApp::document
UMLDoc * document() const
Returns a pointer to the current document connected to the KMainWindow instance.
Definition: uml.cpp:872
CodeGenObjectWithTextBlocks::addTextBlock
virtual bool addTextBlock(TextBlock *add_object)
Add a TextBlock object to the m_textblockVector List.
Definition: codegenobjectwithtextblocks.cpp:57
debug_utils.h
cppheadercodeoperation.h
HierarchicalCodeBlock::addCodeClassFieldMethods
void addCodeClassFieldMethods(CodeClassFieldList &list)
Utility method to add accessormethods in this object.
Definition: hierarchicalcodeblock.cpp:215
CPPHeaderCodeDocument::loadChildTextBlocksFromNode
virtual void loadChildTextBlocksFromNode(QDomElement &root)
Need to overwrite this for cpp header since we need to pick up the header class declaration block...
Definition: cppheadercodedocument.cpp:84
Uml::Visibility::Private
Definition: basictypes.h:58
UMLObject
This class is the non-graphical version of UMLWidget.
Definition: umlobject.h:41
UMLApp::policyExt
CodeGenPolicyExt * policyExt() const
Returns the CodeGenPolicyExt object.
Definition: uml.cpp:2148
UMLOperation::isLifeOperation
bool isLifeOperation()
Shortcut for (isConstructorOperation() || isDestructorOperation()).
Definition: operation.cpp:395
CodeGenerationPolicy::getCodeVerboseDocumentComments
bool getCodeVerboseDocumentComments() const
Get the value of m_codeVerboseDocumentComments Whether or not verbose code commenting for documentati...
Definition: codegenerationpolicy.cpp:147
CodeBlockWithComments
class CodeBlockWithComments A very common type of text block in any type of code. ...
Definition: codeblockwithcomments.h:24
CPPHeaderCodeDocument::addCodeOperation
bool addCodeOperation(CodeOperation *op)
Add a code operation to this cpp classifier code document.
Definition: cppheadercodedocument.cpp:288
enum.h
CodeClassField::PlainAssociation
Definition: codeclassfield.h:34
HierarchicalCodeBlock::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
load params from the appropriate XMI element node.
Definition: hierarchicalcodeblock.cpp:269
CodeOperation
Definition: codeoperation.h:23
CodeOperation::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
Load params from the appropriate XMI element node.
Definition: codeoperation.cpp:83
CPPCodeGenerationPolicy::getStringClassNameInclude
QString getStringClassNameInclude()
Definition: cppcodegenerationpolicy.cpp:167
CodeDocument::resetTextBlocks
void resetTextBlocks()
Reset/clear our inventory of textblocks in this document.
Definition: codedocument.cpp:337
ClassifierCodeDocument::parentIsInterface
bool parentIsInterface()
Return if the parent classifier is an interface.
Definition: classifiercodedocument.cpp:413
CodeGenerationPolicy::getIndentation
QString getIndentation() const
Utility method to get the amount (and type of whitespace) to indent with.
Definition: codegenerationpolicy.cpp:299
TextBlock::setWriteOutText
void setWriteOutText(bool write)
Set the value of m_writeOutText Whether or not to include the text of this TextBlock into a file...
Definition: textblock.cpp:131
cppcodegenerator.h
CPPHeaderClassDeclarationBlock::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
load params from the appropriate XMI element node.
Definition: cppheaderclassdeclarationblock.cpp:33
CodeDocument
A document containing the code for one file.
Definition: codedocument.h:32
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:17
CodeClassField::Aggregation
Definition: codeclassfield.h:34
cppcodegenerationpolicy.h
HierarchicalCodeBlock::addTextBlock
bool addTextBlock(TextBlock *add_object)
Add a TextBlock object to the m_textblockVector List.
Definition: hierarchicalcodeblock.cpp:93
uDebug
#define uDebug()
Definition: debug_utils.h:95
UMLPackageList
QList< UMLPackage * > UMLPackageList
Definition: umlpackagelist.h:17
cppheaderclassdeclarationblock.h
CodeGenerator::findObjectsRelated
static void findObjectsRelated(UMLClassifier *c, UMLPackageList &cList)
Finds all classes in the current document to which objects of class c are in some way related...
Definition: codegenerator.cpp:682
HierarchicalCodeBlock::setStartText
void setStartText(const QString &text)
Definition: hierarchicalcodeblock.cpp:199
CPPCodeDocumentation
class CPPCodeDocumentation A CPP code comment.
Definition: cppcodedocumentation.h:27
UMLApp::commonPolicy
CodeGenerationPolicy * commonPolicy() const
Returns the default code generation policy.
Definition: uml.cpp:2132
CodeDocument::cleanName
QString cleanName(const QString &name)
A little utility method which calls CodeGenerator::cleanName.
Definition: codedocument.cpp:269
CodeDocument::findTextBlockByTag
TextBlock * findTextBlockByTag(const QString &tag, bool descendIntoChildren=false)
Lookup a certain textblock by its tag value, returns NULL if it can not find the TextBlock with such ...
Definition: codedocument.cpp:499
CPPCodeGenerationPolicy::getVectorClassNameInclude
QString getVectorClassNameInclude()
Definition: cppcodegenerationpolicy.cpp:177
CodeGenerationPolicy::getAutoGenerateConstructors
bool getAutoGenerateConstructors()
Get the value of m_autoGenerateConstructors.
Definition: codegenerationpolicy.cpp:365
CPPHeaderClassDeclarationBlock::updateContent
void updateContent()
Update the start/end text of this codeblock.
Definition: cppheaderclassdeclarationblock.cpp:60
Uml::Visibility::Public
Definition: basictypes.h:57
CodeGenObjectWithTextBlocks::getHierarchicalCodeBlock
virtual HierarchicalCodeBlock * getHierarchicalCodeBlock(const QString &tag, const QString &comment, int indentLevel)
Will get a hierarchicalcodeblock from the document with given tag.
Definition: codegenobjectwithtextblocks.cpp:183
UMLClassifier::findSuperClassConcepts
UMLClassifierList findSuperClassConcepts(ClassifierType type=ALL)
Returns a list of concepts which this concept inherits from.
Definition: classifier.cpp:616
UMLObject::baseType
ObjectType baseType() const
Returns the type of the object.
Definition: umlobject.cpp:366
CodeOperation::getParentOperation
UMLOperation * getParentOperation()
Add a Parameter object to the m_parameterVector List.
Definition: codeoperation.cpp:64
cppcodedocumentation.h
CPPHeaderCodeDocument::updateContent
void updateContent()
Save the XMI representation of this object.
Definition: cppheadercodedocument.cpp:347
UMLEnum
This class contains the non-graphical information required for a UML Enum.
Definition: enum.h:28
CPPHeaderClassDeclarationBlock
Definition: cppheaderclassdeclarationblock.h:20
CPPCodeGenerationPolicy
Definition: cppcodegenerationpolicy.h:23
UMLDoc::findObjectById
UMLObject * findObjectById(Uml::ID::Type id)
Used to find a reference to a UMLObject by its ID.
Definition: umldoc.cpp:766
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:22
TextBlock
The fundemental unit of text within an output file containing code.
Definition: textblock.h:24
UMLObject::umlPackage
UMLPackage * umlPackage()
Returns the UMLPackage that this class is located in.
Definition: umlobject.cpp:641
UMLOperation
This class represents an operation in the UML model.
Definition: operation.h:24
CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeBlockWithComments
CodeBlockWithComments * addOrUpdateTaggedCodeBlockWithComments(const QString &tag, const QString &text, const QString &ctext, 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 thi...
Definition: codegenobjectwithtextblocks.cpp:287
package.h
UMLObject::package
QString package(const QString &separator=QString(), bool includeRoot=false)
Return the package(s) in which this UMLObject is contained as a text.
Definition: umlobject.cpp:603
classifierlistitem.h
ClassifierCodeDocument::declareClassFields
void declareClassFields(CodeClassFieldList &list, CodeGenObjectWithTextBlocks *parent)
Add declaration blocks for the passed classfields.
Definition: classifiercodedocument.cpp:373
uError
#define uError()
Definition: debug_utils.h:96
UMLClassifier::getOpList
UMLOperationList getOpList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=0)
Return a list of operations for the Classifier.
Definition: classifier.cpp:960
CPPCodeGenerationPolicy::stringIncludeIsGlobal
bool stringIncludeIsGlobal()
Determine if the string include is global.
Definition: cppcodegenerationpolicy.cpp:221
CPPHeaderCodeDocument::resetTextBlocks
void resetTextBlocks()
Save the XMI representation of this object.
Definition: cppheadercodedocument.cpp:229
ClassifierCodeDocument::hasObjectVectorClassFields
bool hasObjectVectorClassFields()
Tell if any of the accessor classfields will be of lists of objects.
Definition: classifiercodedocument.cpp:124
cppheadercodedocument.h
UMLObject::name
QString name() const
Returns a copy of m_name.
Definition: umlobject.cpp:185
CodeGenerator::cleanName
static QString cleanName(const QString &name)
Replaces spaces with underscores and capitalises as defined in m_modname.
Definition: codegenerator.cpp:609
cppheadercodeclassfielddeclarationblock.h
CPPHeaderCodeOperation
Definition: cppheadercodeoperation.h:21
umlclassifierlistitemlist.h
CodeGenPolicyExt
Base class for programming language specific code generation policy extensions.
Definition: codegenpolicyext.h:28
CPPCodeGenerationPolicy::getAutoGenerateAccessors
bool getAutoGenerateAccessors()
Get the value of m_autoGenerateAccessors.
Definition: cppcodegenerationpolicy.cpp:157
CodeClassFieldList
QList< CodeClassField * > CodeClassFieldList
Definition: codeclassfieldlist.h:17
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1053
CPPHeaderCodeDocument::~CPPHeaderCodeDocument
virtual ~CPPHeaderCodeDocument()
Destructor.
Definition: cppheadercodedocument.cpp:65
CodeComment
Text which will be comments.
Definition: codecomment.h:23
ClassifierCodeDocument::hasClassFields
bool hasClassFields()
Does this object have any classfields declared?
Definition: classifiercodedocument.cpp:147
CodeDocument::getFileName
QString getFileName() const
Get the value of m_filename.
Definition: codedocument.cpp:63
CPPCodeGenerationPolicy::getAccessorsArePublic
bool getAccessorsArePublic()
Get the value of m_publicAccessors.
Definition: cppcodegenerationpolicy.cpp:62
CodeDocument::setFileExtension
void setFileExtension(const QString &new_var)
Set the value of m_fileExtension.
Definition: codedocument.cpp:72
Uml::Visibility::Protected
Definition: basictypes.h:59
UMLObject::ot_Datatype
Definition: umlobject.h:54
CodeBlockWithComments::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
Load params from the appropriate XMI element node.
Definition: codeblockwithcomments.cpp:96
cppheadercodeaccessormethod.h
uml.h
QList
TextBlock::setTag
void setTag(const QString &value)
Set the tag of this text block.
Definition: textblock.cpp:121
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:05:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal