[Bug 77150] New: Add template for C++ accessor (setter and getter) methods

Steven T.Hatton hattons at globalsymmetry.com
Wed Mar 10 04:28:04 UTC 2004


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
      
http://bugs.kde.org/show_bug.cgi?id=77150      
           Summary: Add template for C++ accessor (setter and getter)
                    methods
           Product: kdevelop
           Version: unspecified
          Platform: unspecified
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
        AssignedTo: kdevelop-devel kdevelop org
        ReportedBy: hattons globalsymmetry com


Version:           3.0.90-CVS (using KDE 3.2 BRANCH >= 20040204, SuSE)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:          Linux (i686) release 2.4.21-99-default

I decided to make this formal. You can backtrack through the mailing list from here:

http://lists.kde.org/?l=kdevelop-devel&m=107886709010442&w=2

> 
> Does someone have a paradigm for this they would like to share?

Sascha Herrmann <starfox899 () web ! de>

Hi,
i wont claim to set up a paradigm but in my eyes that should look like:

class test {
public:
     test();
     ~test();
     // get...
     const double& getSize() const;
     // set... (for "big" structures or whenever copying takes to long)
     void setSize(const double& newValue);
     // maybe better for standard types
     void setSize(const double newValue);
protected:
     double m_Size;
};

setters should be void because modern error handling should be done with 
exceptions (that`s what i think!). To improve things further we should 
create a template for get/setters so anybody can choose his favorite style.

Alexander Dymo <cloudtemple () mksat ! net>

I like this one ;)

public:
	void setMemberName(const type &memberName)
	type memberName() const
private:
	type m_memberName;




More information about the KDevelop-devel mailing list