-
Notifications
You must be signed in to change notification settings - Fork 2
Coding Guidelines
thisdroneeatspeople edited this page Mar 12, 2013
·
3 revisions
Work in progress...
Member variables for classes shall be notated with 'm_' prefix, unless called out under one of the special cases below. Also consider casing of characters.
For example:
bool m_status;
QList<int> m_ids;
unsigned int m_typeValue;
Static Member variables prefer 's_' prefix, e.g.:
static const int s_foo;
Function pointer member variables prefer 'f_' prefix, e.g.:
void(*)(int) f_myPtr;
Prefix constructor arguments with 'c_', and method arguments with 'p_', e.g.:
class Foo {
public:
Foo(int c_count);
int countThis(QList<int>* p_this);
};
Private methods shall always begin with an underscore, e.g.:
private:
void _initialize();
int _lastID();
Except in cases where most appropriate for the Qt framework (e.g. Q_PROPERTY setter/getter methods), prefer mutative prototypes over set/get-style prototypes, e.g.:
void myValue(unsigned long p_val);
unsigned long myValue();
... is preferred as a setter/getter combination over:
void setMyValue(unsigned long p_val);
unsigned long getMyValue();
Always align assignments and initializations on the equals sign for easy readability, e.g.:
OMfilmParams* params = m_params->getParams();
unsigned long minInt = m_exec->minInterval(params);
unsigned long maxFrames = params->realLength / minInt;
unsigned long maxTime = (maxFrames / params->fps) * 1000;
m_error = false;
m_spinsPrepped = false;
m_ignoreUpdate = false;
m_checkRunning = false;`