ReaderWriter Plugin

Eckhart Wörner ewoerner at kde.org
Tue Oct 20 19:39:42 UTC 2009


Hi Ruan,

Am Mittwoch, 21. Oktober 2009 00:17:03 schrieb Ruan Strydom:
> Can someone please let me know if it is actually usable and compiles?
>  Thanks? Please criticize, I wont cry promise ;).

just had a short look at it. Compile went fine, although I wondered why sources 
are not in the src directory.

Right-clicking a single member worked fine, right-clicking on a selection or 
pressing Ctrl+Alt+P on a selection made kdevelop crash, haven't investigated 
into that yet.

Tried to experiment a bit:

class a {
    private:
        int var1;
        int& var2;
        const int var3;
        const int& var4;
        int x;
    public:
        
        int getVar1() const {
            return var1;
        }
        void setVar1( int v ) {
            var1 = v;
        }
        const int& getVar2() const {
            return var2;
        }
        void setVar2( int& v ) {
            var2 = v;
        }
        const int getVar3() const {
            return var3;
        }
        void setVar3( const int v ) {
            var3 = v;
        }
        const const int& getVar4() const {
            return var4;
        }
        void setVar4( const int& v ) {
            var4 = v;
        }
        int getX() const {
            return x;
        }
        void setX( int x ) {
            x = x;
        }
};

Suggestion for further improvement:
* don't allow setters when the member is either a reference (var2, var4) or a 
const member (var3, var4)
* check that you don't accidentally end up with two "const" (var4)
* check that your setter parameter isn't called the same as the member (x).

Another nitpick: "final" sounds weird in a C++ context - don't know what you 
mean by it.

Eckhart




More information about the KDevelop-devel mailing list