source: pacpusframework/trunk/CODING_STYLE.txt@ 40

Last change on this file since 40 was 39, checked in by Marek Kurdej, 12 years ago

Added: CODING_STYLE.txt.
Added to DEPENDENCIES.txt: CMake.

File size: 2.5 KB
Line 
1For the aspects not explained in this document, follow the coding style described in:
2 http://llvm.org/docs/CodingStandards.html
3
4== #include Style ==
5* Avoid #includes in the header files. Use forward declarations if possible.
6* Immediately after the header file comment (and include guards if working on a header file), the minimal list of #includes required by the file should be listed. We prefer these #includes to be listed in this order:
7 1) Main Module Header
8 2) Local/Private Headers
9 3) <Pacpus/...>
10 4) System #includes
11* do not use 'using ...;' in header files
12
13== Mechanical Source Issues ==
14* use standard header-guard:
15 #ifndef PACPUS_EXAMPLE_H
16 #define PACPUS_EXAMPLE_H
17 ...
18 #endif // PACPUS_EXAMPLE_H
19* use C++-style comments (//)
20* write Doxygen-style comments as much as possible, put it in the header file if possible, add developer-only comments in source file
21* use Java-style Doxygen comments, i.e. @returns over \returns
22* use preprocessor directives for long-range comments (#if 0 .... #endif)
23* indent with 4 spaces
24* do not indent namespaces
25* use camelCaseNotation / CamelCaseNotation
26* end namespace with a its name in a comment
27* start with a lowercase letter for local variables, namespaces, function names, method names, ...
28* start with an Uppercase for classes, structs, ...
29* prefix member variables with 'm'
30* prefix (static) const variables with 'k'
31* prefix static (non-const) variables with 's'
32* separate member methods from member variables with a repetion of 'protected:' / 'private:'
33
34========================================
35Example.h:
36========================================
37/// File description
38
39#ifndef PACPUS_EXAMPLE_H
40#define PACPUS_EXAMPLE_H
41
42#include "BaseClass.h"
43
44namespace pacpus {
45/// Constant description
46static const double kConstA;
47/// Static variable description
48static int sStaticA;
49
50/// Brief description of this class
51///
52/// Somewhat longer description of this class
53class SomeClass
54 : public BaseClass
55{
56public:
57 SomeClass
58
59private:
60 void methodA();
61
62private:
63 int mMemberA;
64};
65} // namespace pacpus
66
67#endif // PACPUS_EXAMPLE_H
68
69========================================
70Example.cpp:
71========================================
72#include "Example.h"
73
74#include "Something.h"
75#include "SomethingElse.h"
76
77#include <Pacpus/kernel/DbiteFile.h>
78
79#include <iostream>
80
81using namespace pacpus;
82
83const double kConstA = 3.14159265;
84
85SomeClass::SomeClass()
86 : BaseClass()
87{
88 int someIntegerVariable;
89}
Note: See TracBrowser for help on using the repository browser.