Kexi/Junior Jobs/Add d-pointers: Difference between revisions

From KDE Community Wiki
No edit summary
Line 70: Line 70:


==Notes to mentor==
==Notes to mentor==
*this task can be naturally splited to many students but please have consistency in mind and note that you will need to somehow synchronize their work into a single branch
*Please always emphasize importance of coding style to students and check that - it's so easier to maintain the style from day one instead of fixing afterwards. Show [http://techbase.kde.org/Policies/Kdelibs_Coding_Style Techbase articles] for that.
*Please always emphasize importance of coding style to students and check that - it's so easier to maintain the style from day one instead of fixing afterwards. Show [http://techbase.kde.org/Policies/Kdelibs_Coding_Style Techbase articles] for that.
*Take care of coding practices too (see [http://techbase.kde.org/Development/Tutorials/Common_Programming_Mistakes Techbase articles])
*Take care of coding practices too (see [http://techbase.kde.org/Development/Tutorials/Common_Programming_Mistakes Techbase articles])

Revision as of 19:56, 21 November 2011

GCI_2011_logo_URL_blueborder-nowww.jpeg
  • maintainer of this task: staniek at kde.org
  • OPEN, DIFFICULTY=2/5
  • Recommended for Google Code-IN program

Goal

Improve internal APIs in Kexi. This can be done easily by introducing d-poitners to classes that lack them.

Introduction

Read section about d-pointers on Techbase (d-pointers only, not shared d-pointers).

Classes that have to be converted are in this form:

 // MyClass.h
 class MyClass {
 public:
  MyClass();
 private:
  Foo m_foo;
 };
 
 // MyClass.cpp
 MyClass::MyClass() {
  m_foo/doSomething();
 }

After converting to d-pointer it should be:

 // MyClass.h
 class MyClass {
 public:
  MyClass();
 private:
  class Private;
  Private * const d;
 };
 
 // MyClass.cpp
 class MyClass::Private {
 public:
  Private() 
  Foo foo;
 };
 
 MyClass::MyClass()
  : d(new Private)
 {
  d->foo.doSomething();
 }
 
 MyClass::~MyClass()
 {
  delete d;
 }

List of files

This list is not complete. If you're looking for more please contact the maintainer.

Extra tasks needed

After converting to d-pointer:

  • any code referring to m_foo attribute should be changed to d->foo
  • if there is inline code in header file that uses member variable, do not move the variable to d-pointer unless you know for sure it isn't there for optimization

Required skills

Basic Qt, average C++.

  • Work within a new branch kexi-dpointers-gci, please create.

Notes to mentor

  • this task can be naturally splited to many students but please have consistency in mind and note that you will need to somehow synchronize their work into a single branch
  • Please always emphasize importance of coding style to students and check that - it's so easier to maintain the style from day one instead of fixing afterwards. Show Techbase articles for that.
  • Take care of coding practices too (see Techbase articles)