-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCODING
More file actions
51 lines (47 loc) · 1.45 KB
/
CODING
File metadata and controls
51 lines (47 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Use UTF-8 wherever possible, in both source code and generated files.
The notebook content files should always be UTF-8.
Do not include a UTF-8 BOM.
C++
--------------------
* Use Doxygen.
* Expand tabs to 4 spaces.
* Declare parts of a variable type together.
This:
QObject* something;
Not this:
QObject *something;
* Do not declare multiple variables on one line.
This:
QString* something;
Not this:
QString* something, else;
* Braces are on new lines, except in typdef structs.
* Keep lines reasonable short.
* Don't be afraid of the const.
* Declare source headers before library headers.
This:
#include "notebook.h"
#include <QFile>
Not this:
#include <QFile>
#include "notebook.h"
* Use `this->` to indicate that a variable is a member. Decorating member variables is *ugly*.
This:
this->something
Not this:
m_something
* Use get and set prefixes for properties. It was a mistake for Qt to omit the `get` prefixes.
This:
const QString& getName() const;
Not this:
const QString& name() const;
* Avoid hungarian prefix crap, except for UI controls.
Javascript
--------------------
* Use Doxygen.
* Expand tabs to 4 spaces.
* Place braces on the same line, not a new line.
* Write cross-browser code, if possible. Don't bother writing code to work on
IE - just try to get it to work on Webkit, Gecko, and Opera.
* Make use of the JavaScript libraries/frameworks (Prototype JS).
* Use unobtrusive JavaScript.