Bug 60452 - missing keywords for declaring operations and variables
Summary: missing keywords for declaring operations and variables
Status: ASSIGNED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.1.1
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Lays Rodrigues
URL:
Keywords:
: 116242 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-06-28 04:04 UTC by Michael Dean
Modified: 2018-04-10 06:07 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test case of the new widget about Type Modifiers keyword (87.48 KB, image/png)
2016-05-26 22:08 UTC, Lays Rodrigues
Details
Related use case (33.76 KB, text/x-xmi)
2016-05-29 20:51 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Dean 2003-06-28 04:04:33 UTC
Version:           1.1.1 (using KDE KDE 3.1.1)
Installed from:    RedHat RPMs
Compiler:           compiler unrelated
OS:          Linux

There are several keywords missing for declaring functions (operations, methods, whatever) and variables in C++:

virtual (only pure virtual declaration is possible as-is)
const
volatile
register
implicit
explicit
friend
inline
unsigned

Check-boxes are a great way to choose these.  ClassBuilder is a great example, and has many useful features you might want to consider using.  It's another open-source UML proggy; it was originally written for win32 with mfc, though it is being ported to GNU/Linux.  If you haven't seen it yet, it's worth taking a look at.  Umbrello could be great if a lot of features from ClassBuilder are brought into it.  Find it at:

https://sourceforge.net/projects/classbuilder
Homepage: http://members.lycos.nl/JimmyVenema/ClassBuilder/ClassBuilder.htm

Also, more importantly (to me), it is not possible to create templated types.  This is an extremely important feature to me, as I do lots of templated programming, and use templates to create policy-driven designs (not usable without templates).

Oh, one more request: it would be great if you could use the katepart to allow the user to edit the body of an operation, and have it inserted at code generation time (great for getter/setter functions, and anything else small).

Oops, just one more thing: comments for operations and attributes don't always get saved when you close the properties dialog.  They don't seem to ever be saved when the comment in question is highlighted when the dialog is closed.
Comment 1 Jonathan Riddell 2003-07-03 22:07:29 UTC
These are a bit language specific, the options currently available are all 
part of UML but most of these arn't recognised in UML. 
 
Maybe they could be part of Brian T's new code generator bits. 
 
Of course some are a bit obscure, I've no idea what half of them do. 
Comment 2 Michael Dean 2003-07-04 22:45:33 UTC
virtual is for poly-morphism, as I'm sure you're all aware.

const  can be used more than one might realize:

const Object * pointer;        // points to const object
Object * const pointer;        // const pointer
const Object * const pointer;  // const pointer to const object

volatile       // C++'s recognition of threads; tells compiler not to cache
               // the volatile data type's value, to prevent thread A from
               // reading an obsolete value (the value it was before it was
               // changed by thread B, but hasn't yet been written back to
               // the cached area of memory yet).  Keeps the value in physical
               // memory instead of caching it in a register

register       // for optimization; tells compiler this variable is to be used
               // often, keep it in a register.  If overused, can actually
               // degrade performance, but if used thoughtfully, can help
performance

implicit       // default for functions; opposite of explicit; rarely used

explicit       // tells the compiler that, say, a user defined type conversion
               // must be explicitly called upon:
MyInt b;
int a = MyInt( b );
// instead of
int a = b;     // implicit conversion form

friend         // allows a friend class to access its "friend's" classes members
inline         // optimization I'm sure you all know
unsigned       // again, obvious

Just thought I'd fill you in on the blanks for whichever ones you didn't know.
Thanks for assigning this.
Comment 3 Michael Dean 2003-07-06 16:01:06 UTC
Oh, I also forgot the keyword mutable.
(In case anyone is not familiar with the keyword mutable, it's a flag to tell
the compiler the constness of a variable can be cast away)
Ex:

class A
{
  public:
    mutable int myint;
    int notmyint;
};

int main( int argc, char** argv )
{
  const A myA;
  myA.myint = 5;    //  **** ERROR **** myint is const because it's containing
                    //                  class is const

  const_cast<A>(myA).myint = 5;    // This compiles fine because its constness
                                   // has been cast away by const_cast<T>()

  const_cast<A>(myA).notmyint = 5; //  **** ERROR **** will not compile because
                                   //  notmyint was not declared mutable
}

I think I've thought of all the neccessary missing keywords now (hopefully).
BTW, http://www.gotw.ca/gotw/006.htm is a great guru article on when to use
const and when to not, if anyone's interested in it.  It's by Herb Sutter, good
article.
Comment 4 Brian Thomas 2003-12-12 18:31:08 UTC
> These are a bit language specific, the options currently available are all
> part of UML but most of these arn't recognised in UML.

> Maybe they could be part of Brian T's new code generator bits.

I agree that the code generation could handle this, and I think the way to handle these is through stereotypes and expanded options at various points in the code generation interface (I seem to recall someone else expressing this viewpoint too).

After KDE 3.2 release, this can be a priority for code generation development
(and we will need to think carefully about how stereotypes will be implemented
so they may be used in code generation...I wonder if there are any 'standard' stereotypes for various languages we can leverage??)
Comment 5 Sascha Herrmann 2005-05-18 15:20:33 UTC
is there any activity on getting at least the "const" keyword to work???
Comment 6 Oliver Kellogg 2005-05-20 08:04:25 UTC
> is there any activity on getting at least the "const" keyword to work??? 
 
Not to my knowledge.
Feel free to submit patches.
Comment 7 Oliver Kellogg 2005-12-06 06:39:16 UTC
*** Bug 116242 has been marked as a duplicate of this bug. ***
Comment 8 Oliver Kellogg 2005-12-22 21:08:05 UTC
SVN commit 490686 by okellogg:

Implement "const" for methods in the old and new C++ generators.
Corresponds to the the XMI attribute "isQuery".
CCBUG:60452


 M  +2 -0      codegenerators/cppheadercodeoperation.cpp  
 M  +8 -4      codegenerators/cppsourcecodeoperation.cpp  
 M  +3 -0      codegenerators/cppwriter.cpp  
 M  +10 -5     dialogs/umloperationdialog.cpp  
 M  +1 -0      dialogs/umloperationdialog.h  
 M  +15 -1     operation.cpp  
 M  +11 -0     operation.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/cppheadercodeoperation.cpp #490685:490686
@@ -149,6 +149,8 @@
     // virtual functions
     start = (inlinePolicy ? " {" : ";");
     end = (inlinePolicy ? "}" : "");
+    if (pOp->getConst())
+        prototype += " const";
     if (interface || pOp->getAbstract()) {
        // constructor can't be virtual or abstract
        if (!pOp->isLifeOperation()) {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/cppsourcecodeoperation.cpp #490685:490686
@@ -93,11 +93,15 @@
 
     // if a property has a friend stereotype, the operation should
     // not be a class name
-    QString startText;
+    QString startText = returnType + " ";
+
     if (!o->getStereotype().isEmpty() && o->getStereotype(false) == "friend")
-        startText = returnType + " " + methodName + " ("+paramStr+") {";
-    else
-        startText = returnType + " " + className + "::" + methodName + " ("+paramStr+") {";
+        startText += className + "::";
+    startText += methodName + " ("+paramStr+")";
+    if (o->getConst())
+        startText += " const";
+    startText += " {";
+
     setStartMethodText(startText);
 
     // Only write this out if its a child of an interface OR is abstract.
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/cppwriter.cpp #490685:490686
@@ -1196,6 +1196,9 @@
         }
         str += " )";
 
+        if (op->getConst())
+            str += " const";
+
         // method body : only gets IF its not in a header
         if (isHeaderMethod && !INLINE_OPERATION_METHODS)
             str +=";"; // terminate now
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/umloperationdialog.cpp #490685:490686
@@ -86,11 +86,14 @@
     genLayout -> addWidget(m_pStereoTypeCB, 1, 1);
 
     m_pAbstractCB = new QCheckBox( i18n("&Abstract operation"), m_pGenGB );
-    m_pAbstractCB -> setChecked( m_pOperation -> getAbstract() );
+    m_pAbstractCB -> setChecked( m_pOperation->getAbstract() );
+    genLayout -> addWidget( m_pAbstractCB, 2, 0 );
     m_pStaticCB = new QCheckBox( i18n("Classifier &scope (\"static\")"), m_pGenGB );
-    m_pStaticCB -> setChecked( m_pOperation -> getStatic() );
-    genLayout -> addWidget( m_pAbstractCB, 2, 0 );
+    m_pStaticCB -> setChecked( m_pOperation->getStatic() );
     genLayout -> addWidget( m_pStaticCB, 2, 1 );
+    m_pQueryCB = new QCheckBox( i18n("&Query (\"const\")"), m_pGenGB );
+    m_pQueryCB -> setChecked( m_pOperation->getConst() );
+    genLayout -> addWidget( m_pQueryCB, 2, 2 );
 
     topLayout -> addWidget( m_pGenGB );
 
@@ -485,6 +488,8 @@
     else
         m_pOperation->setTypeName(typeName);
 
+    m_pOperation->setStereotype( m_pStereoTypeCB->currentText() );
+
     bool isAbstract = m_pAbstractCB->isChecked();
     m_pOperation -> setAbstract( isAbstract );
     if (isAbstract) {
@@ -495,8 +500,8 @@
          */
         classifier->setAbstract(true);
     }
-    m_pOperation -> setStatic( m_pStaticCB -> isChecked() );
-    m_pOperation -> setStereotype( m_pStereoTypeCB->currentText() );
+    m_pOperation->setStatic( m_pStaticCB->isChecked() );
+    m_pOperation->setConst( m_pQueryCB->isChecked() );
 
     return true;
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/umloperationdialog.h #490685:490686
@@ -99,6 +99,7 @@
     QLineEdit * m_pNameLE;
     QCheckBox * m_pAbstractCB;
     QCheckBox * m_pStaticCB;
+    QCheckBox * m_pQueryCB;
     QPushButton* m_pDeleteButton;
     QPushButton* m_pPropertiesButton;
     KArrowButton* m_pUpButton;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/operation.cpp #490685:490686
@@ -271,6 +271,14 @@
     return (isConstructorOperation() || isDestructorOperation());
 }
 
+void UMLOperation::setConst(bool b) {
+    m_bConst = b;
+}
+
+bool UMLOperation::getConst() const {
+    return m_bConst;
+}
+
 bool UMLOperation::showPropertiesDialogue(QWidget* parent) {
     UMLOperationDialog dialogue(parent, this);
     return dialogue.exec();
@@ -278,6 +286,7 @@
 
 void UMLOperation::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
     QDomElement operationElement = UMLObject::save("UML:Operation", qDoc);
+    operationElement.setAttribute( "isQuery", m_bConst ? "true" : "false" );
     QDomElement featureElement = qDoc.createElement( "UML:BehavioralFeature.parameter" );
     if (m_pSecondary) {
         QDomElement retElement = qDoc.createElement("UML:Parameter");
@@ -287,7 +296,6 @@
         retElement.setAttribute( "kind", "return" );
         featureElement.appendChild( retElement );
     } else {
-        //operationElement.setAttribute( "type", m_SecondaryId );
         kdDebug() << "UMLOperation::saveToXMI: m_SecondaryId is "
         << m_SecondaryId << endl;
     }
@@ -331,6 +339,12 @@
             }
         }
     }
+    QString isQuery = element.attribute( "isQuery", "" );
+    if (!isQuery.isEmpty()) {
+        // We need this extra test for isEmpty() because load() might have been
+        // called again by the processing for BehavioralFeature.parameter (see below)
+        m_bConst = (isQuery == "true");
+    }
     QDomNode node = element.firstChild();
     if (node.isComment())
         node = node.nextSibling();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/operation.h #490685:490686
@@ -184,6 +184,16 @@
     bool isLifeOperation();
 
     /**
+     * Sets whether this operation is a query (C++ "const".)
+     */
+    void setConst(bool b);
+
+    /**
+     * Returns whether this operation is a query (C++ "const".)
+     */
+    bool getConst() const;
+
+    /**
      * Saves to the <UML:Operation> XMI element.
      */
     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
@@ -196,6 +206,7 @@
 
 private:
     UMLAttributeList m_List;
+    bool m_bConst;
 };
 
 #endif
Comment 9 Ralf Habacker 2016-05-24 04:49:24 UTC
@lays: A few note how to deal with the remaining keywords:
1. The question if a keyword belongs to Codegen_Utils::cppDatatypes() or something else. Options are  createCppStereotypes() or something else. From looking at http://www.tutorialspoint.com/cplusplus/cpp_modifier_types.htm there are also type qualifiers like const, volatile, restrict, mutable, register
2. We need to take a look if a related token is supported by UML or not. (Maybe Sandro can give some inlights into this area). See comment 8 for a supported example. If it is not supported directly by UML, we need to see how this could be implemented in the UML model. 
3. We need to see how we let the user enters the keyword in the gui. The "const" prefix from comment 8 is implemented as checkbox in the method property dialog.
Comment 10 Lays Rodrigues 2016-05-24 15:13:28 UTC
@Ralf, take a look on this at page 60 http://astah.net/tutorials/astah%20professional%20reference%20manual.pdf 
I guess that we could follow some definitions.
Comment 11 Ralf Habacker 2016-05-24 21:03:17 UTC
Git commit 0340c1bc39464f235ad883536f5e071b2e0beb0c by Ralf Habacker.
Committed on 24/05/2016 at 21:01.
Pushed by habacker into branch 'master'.

Refactor out data type property widget related code from attribute and operation dialog into class UMLDatatypeWidget.

This makes it easier to implemented further data type widget related extensions.

M  +1    -0    umbrello/CMakeLists.txt
M  +4    -44   umbrello/dialogs/umlattributedialog.cpp
M  +3    -8    umbrello/dialogs/umlattributedialog.h
M  +4    -57   umbrello/dialogs/umloperationdialog.cpp
M  +2    -2    umbrello/dialogs/umloperationdialog.h
A  +166  -0    umbrello/dialogs/widgets/umldatatypewidget.cpp     [License: GPL (v2+)]
A  +44   -0    umbrello/dialogs/widgets/umldatatypewidget.h     [License: GPL (v2+)]

http://commits.kde.org/umbrello/0340c1bc39464f235ad883536f5e071b2e0beb0c
Comment 12 Ralf Habacker 2016-05-26 06:55:16 UTC
(In reply to Ralf Habacker from comment #11)
> Refactor out data type property widget related code from attribute and
> operation dialog into class UMLDatatypeWidget.
> 
> This makes it easier to implemented further data type widget related extensions.

The data type related widgets are spread all over the code. Adding new stuff like your proposal needs to be coded about 5 times. It is more effective to refactor the code first to merge them into one datatype related widget before and then implement the new feature, which will be shared by all other. 
For that I added the new class UMLDatatypeWidget, which is already used by UMLAttributeDialog and UMLOperationDialog, it is still missing in ParameterPropertyDialog, UMLTemplateDialog and UMLEntityAttributeDialog. If this is finished we can implement the additions. In the meantime we need to design the gui extensions and how to add the attributes to the internal uml model.
Comment 13 Ralf Habacker 2016-05-26 07:05:41 UTC
(In reply to Ralf Habacker from comment #12)
> how to add the attributes to the internal uml model.
In recent umbrello code there is no class UMLDatatype, which would be easy to extend for example with setVolatile()  or setMutable(). The whole type is a simple QString. 

Having a QString makes it easy to add specific types manually like 'const volatile int *' but has the drawback that it is required to parse/splitted  in the gui for representing/selecting parts of the type for example on a checkbox for 'const' or to select a keyword in a combo box. On editing the type by pressing a checkbox the type input field need to be updated.
Comment 14 Ralf Habacker 2016-05-26 07:26:15 UTC
(In reply to Lays Rodrigues from comment #10)
> @Ralf, take a look on this at page 60
> http://astah.net/tutorials/astah%20professional%20reference%20manual.pdf 
> I guess that we could follow some definitions.

As far as I can see do we have three tasks: 
1. Add missing basic types to Codegen_Utils::cppDatatypes()
2. Think how to design the gui for adding 'const' and other keywords like 'volatile', 'mutable' to the gui without having the need to duplicate entries in Codegen_Utils::cppDatatypes(). 
combo boxes for example are used often in apps likes astah, but have the drawback that for a few values it is user unfriendly because you need an additional mouse click to see what the choices are and to select. radio buttons are better for this. 
In the recent gui umbrello's property dialogs are not using tabs like astah. In the attribute dialog for example there is:

Type:               [______________^] 
Name:             [_______________] 
initial value:   [_______________] 
Stereotype:   [______________^]
[] classifier("static")

We can extend it with 

Type:    [] const [] mutable [] volatile ...   # common and language specific modifiers 
                   [______________^] 

or 

Type:           [_____________^]   [______________^] 

where the  first combo box is a multi select combo box containing  common and language specific type modifiers
Comment 15 Lays Rodrigues 2016-05-26 22:08:44 UTC
Created attachment 99208 [details]
Test case of the new widget about Type Modifiers keyword

Print screen of the test of the new widget that will handle the type modifiers keyword
Comment 16 Ralf Habacker 2016-05-27 10:36:14 UTC
(In reply to Lays Rodrigues from comment #15)
> Created attachment 99208 [details]
> Test case of the new widget about Type Modifiers keyword
> 
> Print screen of the test of the new widget that will handle the type
> modifiers keyword

Looks nice except we need checkboxes to be able to select more then one entries and the boxes should be near the type field. May be we can reorder the dialog entries.

Name  [_____________]
Type    [_____________]
Modifiers [] ... [] ... [] ... 
...
Comment 17 Lays Rodrigues 2016-05-27 13:53:40 UTC
(In reply to Ralf Habacker from comment #16)
> (In reply to Lays Rodrigues from comment #15)
> > Created attachment 99208 [details]
> > Test case of the new widget about Type Modifiers keyword
> > 
> > Print screen of the test of the new widget that will handle the type
> > modifiers keyword
> 
> Looks nice except we need checkboxes to be able to select more then one
> entries and the boxes should be near the type field. May be we can reorder
> the dialog entries.
> 
> Name  [_____________]
> Type    [_____________]
> Modifiers [] ... [] ... [] ... 
This kind of qualifiers cant be used at the same time: or you use const or volatile or mutable. You can't use one or more. You saw my review request? Now I'm having doubts in how to make the *apply* method and what changes I need to do the cppcodegen(if is necessary).
> ...
Comment 18 Ralf Habacker 2016-05-28 07:54:02 UTC
(In reply to Lays Rodrigues from comment #17)
> This kind of qualifiers cant be used at the same time: or you use const or
> volatile or mutable. You can't use one or more. 
Sure ? See http://embeddedgurus.com/barr-code/2012/01/combining-cs-volatile-and-const-keywords/  and http://en.cppreference.com/w/cpp/language/cv. 
Also if you use radio buttons you need to add an additional for 'none'. 

> Now I'm having doubts in how to make the *apply* method 
See type related stuff in UMLAttributeDialog::apply(). 

> and what changes I need to do the cppcodegen(if is necessary).
From UMLAttributeDialog::apply() i can see that at last there is used UMLClassifierListItem::setType(UMLObject *type) and the counterpart is UMLClassifier * getType()
Comment 19 Ralf Habacker 2016-05-28 12:51:40 UTC
Git commit 2b3e00e40acce18703137e33fa86e54aa992bc95 by Ralf Habacker.
Committed on 28/05/2016 at 12:51.
Pushed by habacker into branch 'master'.

Refactor out data type property widget related code from entity attribute parameter dialog into class UMLDatatypeWidget.

M  +5    -50   umbrello/dialogs/umlentityattributedialog.cpp
M  +3    -4    umbrello/dialogs/umlentityattributedialog.h
M  +52   -0    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +4    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/2b3e00e40acce18703137e33fa86e54aa992bc95
Comment 20 Ralf Habacker 2016-05-28 12:51:40 UTC
Git commit 921de4993dd557457ac5891360e081e615f4299f by Ralf Habacker.
Committed on 28/05/2016 at 12:51.
Pushed by habacker into branch 'master'.

Refactor out data type property widget related code from template property dialog into class UMLDatatypeWidget.

After this commit we can see how to refactor the data type related apply() method.

M  +4    -48   umbrello/dialogs/umltemplatedialog.cpp
M  +3    -2    umbrello/dialogs/umltemplatedialog.h
M  +54   -4    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +4    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/921de4993dd557457ac5891360e081e615f4299f
Comment 21 Ralf Habacker 2016-05-28 16:36:32 UTC
Git commit 2214b8365d2a0d41ee349360cecfa060df01fc0d by Ralf Habacker.
Committed on 28/05/2016 at 15:56.
Pushed by habacker into branch 'master'.

Refactor applying of data type related stuff from UMLAttributeDialog into UMLDatatypeWidget.

M  +2    -42   umbrello/dialogs/umlattributedialog.cpp
M  +57   -0    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +1    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/2214b8365d2a0d41ee349360cecfa060df01fc0d
Comment 22 Ralf Habacker 2016-05-28 16:36:32 UTC
Git commit fe85bfb441338d46883d77b95b83243e824738a5 by Ralf Habacker.
Committed on 28/05/2016 at 16:15.
Pushed by habacker into branch 'master'.

Refactor applying of data type related stuff from ParameterPropertiesDialog into UMLDatatypeWidget.

M  +1    -33   umbrello/dialogs/parameterpropertiesdialog.cpp
M  +39   -0    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +1    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/fe85bfb441338d46883d77b95b83243e824738a5
Comment 23 Ralf Habacker 2016-05-28 16:36:32 UTC
Git commit 0629bb3d6b51aac1ba40554121330bdd0c4567c7 by Ralf Habacker.
Committed on 28/05/2016 at 16:06.
Pushed by habacker into branch 'master'.

Refactor applying of data type related stuff from UMLOperationDialog into UMLDatatypeWidget.

M  +1    -11   umbrello/dialogs/umloperationdialog.cpp
M  +16   -0    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +1    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/0629bb3d6b51aac1ba40554121330bdd0c4567c7
Comment 24 Ralf Habacker 2016-05-28 16:46:19 UTC
Git commit a4527af709d29196ec7a9d35ad394dbc2f055791 by Ralf Habacker.
Committed on 28/05/2016 at 16:23.
Pushed by habacker into branch 'master'.

Refactor applying of data type related stuff from UMLEntityAttributeDialog into UMLDatatypeWidget.

M  +1    -23   umbrello/dialogs/umlentityattributedialog.cpp
M  +30   -0    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +1    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/a4527af709d29196ec7a9d35ad394dbc2f055791
Comment 25 Ralf Habacker 2016-05-28 16:46:19 UTC
Git commit 19d62281b9a4c11887344ee63376783bf769b235 by Ralf Habacker.
Committed on 28/05/2016 at 16:28.
Pushed by habacker into branch 'master'.

Refactor applying of data type related stuff from UMLTemplateDialog into UMLDatatypeWidget.

M  +2    -12   umbrello/dialogs/umltemplatedialog.cpp
M  +19   -0    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +1    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/19d62281b9a4c11887344ee63376783bf769b235
Comment 26 Ralf Habacker 2016-05-29 15:09:46 UTC
Git commit 28ae70b51b2279b62928d15f33599a3bf128199f by Ralf Habacker.
Committed on 29/05/2016 at 11:36.
Pushed by habacker into branch 'master'.

Remove only locally used method UMLDatatypeWidget::currentText().

M  +0    -5    umbrello/dialogs/parameterpropertiesdialog.cpp
M  +0    -1    umbrello/dialogs/parameterpropertiesdialog.h
M  +5    -14   umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +0    -1    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/28ae70b51b2279b62928d15f33599a3bf128199f
Comment 27 Ralf Habacker 2016-05-29 15:36:51 UTC
(In reply to Ralf Habacker from comment #18)
> > and what changes I need to do the cppcodegen(if is necessary).
> From UMLAttributeDialog::apply() i can see that at last there is used
> UMLClassifierListItem::setType(UMLObject *type) and the counterpart is
> UMLClassifier * getType()

Sorry, the related methods are all in UMLClassifierListItem
   virtual void setType(UMLObject *type);
    UMLClassifier * getType() const;

and the returned type is an UMLClassifier, so it looks that all types are based on UMLClassifier with an object type like ot_Datatype. See also Object_Factory::createNewUMLObject()

How new types to a class attribute are created see UMLDatatypeWidget::applyAttribute(), for operations UMLDatatypeWidget::applyOperation() and so one.
Comment 28 Ralf Habacker 2016-05-29 20:51:30 UTC
Created attachment 99252 [details]
Related use case
Comment 29 Lays Rodrigues 2016-05-31 13:24:58 UTC
Git commit e740472dddf397d0facc025b186d1ef539e3becb by Lays Rodrigues.
Committed on 31/05/2016 at 13:20.
Pushed by laysrodrigues into branch 'master'.

Add cpp missing keywords for attribute types

Include the missing keywords based on:
http://www.tutorialspoint.com/cplusplus/cpp_data_types.htm
REVIEW: 128026

Signed-off-by: Lays Rodrigues <laysrodriguessilva@gmail.com>

M  +15   -7    umbrello/codegenerators/codegen_utils.cpp

http://commits.kde.org/umbrello/e740472dddf397d0facc025b186d1ef539e3becb
Comment 30 Ralf Habacker 2016-05-31 13:54:07 UTC
(In reply to Lays Rodrigues from comment #29)
> http://commits.kde.org/umbrello/e740472dddf397d0facc025b186d1ef539e3becb
This commit breaks a related unit test.  From https://build.kde.org/job/umbrello%20master%20latest-qt4/PLATFORM=Linux,compiler=gcc/20/consoleText
FAIL!  : TEST_cppwriter::test_defaultDatatypes() Compared values are not the same
   Actual (list[0]): char
   Expected (QLatin1String("int")): int
   Loc: [/home/jenkins/sources/umbrello/latest-qt4/unittests/TEST_cppwriter.cpp(83)]
Comment 31 Ralf Habacker 2016-06-01 07:08:37 UTC
Git commit d9b30593a1edd178e913088bf98f04bed41ee2ef by Ralf Habacker.
Committed on 01/06/2016 at 07:08.
Pushed by habacker into branch 'master'.

Add member UMLDatatypeWidget::m_parent to setup type parent in constructors.

This is one step more in merging different apply implementations and makes
Lays GSOC live easier.

M  +11   -9    umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +2    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/d9b30593a1edd178e913088bf98f04bed41ee2ef
Comment 32 Ralf Habacker 2016-06-01 07:08:37 UTC
Git commit 651f485f1781c0e6dafb3fee88b6024e13c0994c by Ralf Habacker.
Committed on 01/06/2016 at 07:08.
Pushed by habacker into branch 'master'.

In class UMLDatatypeWidget move type related combo box setup into related constructor.

This makes UMLDatatypeWidget::init() type independent.

M  +5    -11   umbrello/dialogs/widgets/umldatatypewidget.cpp

http://commits.kde.org/umbrello/651f485f1781c0e6dafb3fee88b6024e13c0994c
Comment 33 Ralf Habacker 2016-06-01 10:47:59 UTC
Git commit 7b272f2c6004a70a8aa2f1aab4fd6de1854105cf by Ralf Habacker.
Committed on 01/06/2016 at 10:43.
Pushed by habacker into branch 'master'.

Use UMLDatatypeWidget::m_parent also in insertTypes...() methods.

M  +7    -7    umbrello/dialogs/widgets/umldatatypewidget.cpp

http://commits.kde.org/umbrello/7b272f2c6004a70a8aa2f1aab4fd6de1854105cf
Comment 34 Ralf Habacker 2016-06-01 10:47:59 UTC
Git commit 3a45009eda6ac24bb121bc35256c429e869d1fd9 by Ralf Habacker.
Committed on 01/06/2016 at 10:46.
Pushed by habacker into branch 'master'.

Merge data type combo box setup into UMLDatatypeWidget::initTypesBox().

Add used type to the combo box completion in all cases.

M  +27   -70   umbrello/dialogs/widgets/umldatatypewidget.cpp
M  +1    -0    umbrello/dialogs/widgets/umldatatypewidget.h

http://commits.kde.org/umbrello/3a45009eda6ac24bb121bc35256c429e869d1fd9
Comment 35 Ralf Habacker 2018-04-09 18:45:15 UTC
Git commit b4a363e6c41d3699c53f7c14198737975eb6a482 by Ralf Habacker.
Committed on 09/04/2018 at 18:45.
Pushed by habacker into branch 'master'.

Add support for importing 'volatile' and 'mutable' type qualifiers for c++

Type qualifiers are currently part of the data type and therefore do not
need any special gui enhancements for now.

M  +3    -1    lib/cppparser/parser.cpp
M  +9    -1    umbrello/codeimport/import_utils.cpp
M  +4    -1    umbrello/codeimport/kdevcppparser/cpptree2uml.cpp

https://commits.kde.org/umbrello/b4a363e6c41d3699c53f7c14198737975eb6a482
Comment 36 Ralf Habacker 2018-04-10 05:30:40 UTC
Git commit dd0c1e0f685740c9e494a5f693e19f15878394b3 by Ralf Habacker.
Committed on 10/04/2018 at 05:29.
Pushed by habacker into branch 'Applications/18.04'.

Add importing c++ keyword "friend" for class members

In the created UMLAttribute instance the keyword is imported as stereotype
"friend".

It was required to refactor Import_Utils::insertAttribute() to return now
an UMLAttribute, not UMLObject.
FIXED-IN: 2.25.0 (KDE Applications 18.04.0)

M  +3    -3    umbrello/codeimport/import_utils.cpp
M  +2    -2    umbrello/codeimport/import_utils.h
M  +8    -5    umbrello/codeimport/kdevcppparser/cpptree2uml.cpp

https://commits.kde.org/umbrello/dd0c1e0f685740c9e494a5f693e19f15878394b3
Comment 37 Ralf Habacker 2018-04-10 06:07:44 UTC
Adding keyword 'explicit' would be added as stereotype. Unfortunally constructors are also tagged as stereotype and umbrello currently only support one stereotype.
A solution would be to use stereotype "explicit constructor" or extend the stereotype implementation to be able to handle multiple stereotypes.