Skip to content
thisdroneeatspeople edited this page Mar 12, 2013 · 3 revisions

Work in progress...

1) Hungarian Notation and Method Conventions

a) Member Data

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;

Special Cases:

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;

b) Prototype Arguments

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);
};

c) Method Conventions

Private Methods

Private methods shall always begin with an underscore, e.g.:

private:
   void _initialize();
   int _lastID();

Prefer Mutative Methods

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();

2) Align Assignments and Initializations

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;`