[umbrello] [Bug 442134] "const" correctness in Umbrello sources

Robert Hairgrove bugzilla_noreply at kde.org
Tue Nov 2 12:49:36 GMT 2021


https://bugs.kde.org/show_bug.cgi?id=442134

--- Comment #7 from Robert Hairgrove <code at roberthairgrove.com> ---
(In reply to Oliver Kellogg from comment #6)
> Git commit 7a8d1cfb0b562fab051c7ec3b46e6eededee5195 by Oliver Kellogg.
> Committed on 11/09/2021 at 08:57.
> Pushed by okellogg into branch 'master'.
> 
> Address remaining trivial const correctness fixes from attachment 141364
> [details].
> Suggestions that require code change beyond function signature are postponed
> to a further batch.
> 
> M  +3    -3    umbrello/dialogs/multipagedialogbase.cpp

(...big snip...)

If you could now add const overloads to the following functions starting at
line 225 in "umlobject.h", this would undoubtibly help further progress in
making other things const correct, i.e.:

    UMLActor                 * asUMLActor();
    UMLArtifact              * asUMLArtifact();
    UMLAssociation           * asUMLAssociation();
    UMLAttribute             * asUMLAttribute();

(etc. ... then add these declarations after the group:)

    const UMLActor                 * asUMLActor() const;
    const UMLArtifact              * asUMLArtifact() const;
    const UMLAssociation           * asUMLAssociation() const;
    const UMLAttribute             * asUMLAttribute() const;

and in umlobject.cpp starting at line 1382:

UMLActor                * UMLObject::asUMLActor()                { return
dynamic_cast<UMLActor*>(this); }
UMLArtifact             * UMLObject::asUMLArtifact()             { return
dynamic_cast<UMLArtifact*>(this); }
UMLAssociation          * UMLObject::asUMLAssociation()          { return
dynamic_cast<UMLAssociation*>(this); }
(...)

adding the corresponding methods after this group, i.e.:

const UMLActor                * UMLObject::asUMLActor()             const   {
return dynamic_cast<const UMLActor*>(this); }
const UMLArtifact             * UMLObject::asUMLArtifact()         const    {
return dynamic_cast<const UMLArtifact*>(this); }
const UMLAssociation          * UMLObject::asUMLAssociation()     const     {
return dynamic_cast<const UMLAssociation*>(this); }

I don't think this would break any existing code?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list