README.developers
1If you start working with code, please read though the following rules:
2
3
41. Use Qt naming scheme. You may have a look at Qt API to learn it.
5Here are some examples:
6
7* classes: BoardView, Filter
8* classes with acronyms: PgnDatabase
9* class variables: m_list, m_darkSquareColor
10* reading class variable: QString title() const
11* setting class variable: void setTitle(const QString& s) const
12* checks: isReadOnly()
13* functions with acronyms: moveToSan(), fromSan()
14
152. Use Doxygen format to comment your code
16
17* start class documentation with Doxygen header
18 /** @ingroup Database
19 The Board class represents a chess position.
20 Pieces are kept directly on the board which is internally represented as simple array[0..63].
21 You can easily and quickly make and undo moves, although undoing moves requires keeping track
22 of captured pieces.
23 */
24 @ingroup should contain Database (for non-GUI classes) or GUI
25 Next sentence should have 'The XXX class represents' or '... is' syntax
26
27* document each function
28 /** Sets widget color. */
29 void setColor(const QColor& color);
30 /** @return widget color. */
31 QColor color() const;
32
33* rebuild documentation with 'doxygen Doxyfile' and verify that your class is documented correctly.
34
353. Format your code with TABs. We advocate using astyle
36(http://astyle.sourceforge.net) to indent your code. To use astyle, put
37
38suffix=none style=linux mode=c force-indent=tab=4 one-line=keep-blocks unpad=paren pad=oper
39
40in ~/.astylerc. Then you can indent your code using:
41astyle <file1> <file2> ...
42
43