edbee - Qt Editor Library
|
The coding style is based on google's styleguide:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
Reference, pointer location can be placed next to type typename or to the variable name
Member instances should be private. Subclasses should never access data members directly unless it's stricly necessary.
A class member name is postfixed with '_'. (To prevent clashes with getter functions)
A class member pointer that is NOT owned by the classes show be postfixed with "Ref". For example a reference to a buffer is added like this
When you have a list of reference the following name is used:
Seperate methods from eachother with 2 blank lines. This improves the visible separation of method bodies.
In C / C++ you need to do your own garabage collection. So ownership is important. Here are some rules to make the ownership in the code clear:
When it is possible for a class to have the ownership of an object optionally, the way to do this is the following. (See redbee::TextEditorController.textDocument[Ref])
When using lists yout can use the following structure
We use custom memory leak detection. To enable this leak detection it is required to include 'debug.h' Uou must include "debug.h" in every Source file AFTER all pre-compiled items and header files. Example:
This implies that you should never use a new or delete keyword in a header file!!! main.cpp is different, it includes all DEBUG_NEW stuff below ALL existing header files!
We make use of doxygen: http://www.doxygen.org
On several places in the code you will find enumeration definitions. We do not aways force the enumeration type for variables. The reason for this is, that somethimes it's desirable to extends the number of enumeration options. And when forcing a enumeration type, you cannot easy pass a custom value and are limited to the predefined definitions.