Bug 413574 - Cleanup of generated c++ code
Summary: Cleanup of generated c++ code
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: exporter (show other bugs)
Version: 2.29.2 (KDE Applications 19.08.2)
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks: 281170
  Show dependency treegraph
 
Reported: 2019-10-28 23:31 UTC by Ralf Habacker
Modified: 2020-01-12 11:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 2.29.3 (KDE Applications 19.08.3)
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2019-10-28 23:31:22 UTC
The code generated by c++ exporter looks partly ugly and need to be cleaned up.


STEPS TO REPRODUCE
1. start umbrello
2. add c++ class with attributes and methods (public)
3. export code

OBSERVED RESULT
The generated code contains repeated visibility tokens and the generated cpp file uses different styles for '{', ';' and '()'. Also indention inside body is partial different as shown by the following example.

EXPECTED RESULT
The code style should be cleaned up.

-----------------------------------------------------------------
#ifndef TRUCK_H
#define TRUCK_H

#include <string>
#include <vector>

#include "Test.h"
#include "Engine.h"

class Truck
{
public:

    // Constructors/Destructors
    //  


    /**
     * Empty Constructor
     */
    Truck ();

    /**
     * Empty Destructor
     */
    virtual ~Truck ();


    Test * m_mytest;

    /**
     * Set the value of m_mytest
     * @param new_var the new value of m_mytest
     */
    void setMyTest (Test * new_var);

    /**
     * Get the value of m_mytest
     * @return the value of m_mytest
     */
    Test * getMyTest ();


protected:

public:

protected:

public:

protected:


private:

    // Private attributes
    //  

    Engine myEngine;

    Engine * m_myengine;
public:

private:

public:


    // Private attribute accessor methods
    //  


    /**
     * Set the value of myEngine
     * @param new_var the new value of myEngine
     */
    void setMyEngine (Engine new_var)     {
            myEngine = new_var;
    }

    /**
     * Get the value of myEngine
     * @return the value of myEngine
     */
    Engine getMyEngine ()     {
        return myEngine;
    }
private:


    /**
     * Set the value of m_myengine
     * @param new_var the new value of m_myengine
     */
    void setMyEngine (Engine new_var);

    /**
     * Get the value of m_myengine
     * @return the value of m_myengine
     */
    Engine getMyEngine ();


    void initAttributes () ;

};

#endif // TRUCK_H
------------------------------------------------------------------

------------------------------------------------------------------
#include "Truck.h"

// Constructors/Destructors
//  

Truck::Truck () {
initAttributes();
}

Truck::~Truck () { }

//  
// Methods
//  


// Accessor methods
//  


/**
 * Set the value of m_mytest
 * @param new_var the new value of m_mytest
 */
void Truck::setMyTest (Test * new_var) {
    m_mytest = new_var;
}

/**
 * Get the value of m_mytest
 * @return the value of m_mytest
 */
Test * Truck::getMyTest () {
    return m_mytest;
}

/**
 * Set the value of m_myengine
 * @param new_var the new value of m_myengine
 */
void Truck::setMyEngine (Engine * new_var) {
    m_myengine = new_var;
}

/**
 * Get the value of m_myengine
 * @return the value of m_myengine
 */
Engine * Truck::getMyEngine () {
    return m_myengine;
}

void Truck::initAttributes () {
}
-------------------------------
Comment 1 Ralf Habacker 2019-10-28 23:33:39 UTC
Git commit a6f00ce109f8b834eaa8aaefc7a9408a86ef6f33 by Ralf Habacker.
Committed on 28/10/2019 at 23:33.
Pushed by habacker into branch 'Applications/19.08'.

Cleanup of generated c++ code
FIXED-IN:2.29.3 (KDE Applications 19.08.3)

M  +52   -42   umbrello/codegenerators/cpp/cppwriter.cpp

https://commits.kde.org/umbrello/a6f00ce109f8b834eaa8aaefc7a9408a86ef6f33