-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguidlines.txt
87 lines (48 loc) · 1.88 KB
/
guidlines.txt
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
C++ coding convention
Namespace:
- Usage: Static functions and the GrizzlyBear base namespace
- Naming: PascalCase
Struct:
- Usage: Only used for "transfer types". All members are public,
and methods should be used sparingly.
For example: MaterialProps is a collection of material properties.
- Naming: PascalCase
- Special case:
- On collections of variables, which would be initialized via a long initializer list, lazy init
may be applied: e.g. Test test; test.FIRST = 1; test.SECOND = 2; ...
For this case, as it was shown in the example, one should change the name of the variable
to uppercase without m_ in the beginning.
Class:
- Usage: Used for all kinds of enclosed systems. All member variables are private,
but getters or setters are allowed. Use methods whereever you want.
- Naming: PascalCase
Method:
- Usage: For all kinds of systems.
- Naming: snake_case
- Special case:
- For getters -> get_varname() and for setters set_varname(value)
In order to prevent naming collisions, always use m_VarName as member variable.
- If the getter gets a boolean then -> is_varname()
- For all "computing" functions use operation_object() -> e.g. replace_string()
For multiple operations use operation_and_operation2_object() -> e.g. replace_and_convert_string()
Function:
- Usage: Should be used very sparingly. Helper functions.
- Naming: Own namespace + snake_case
Member Variables:
- Usage: Data storage
- Naming: m_VarName
Static Variables:
- Usage: Static systems
- Naming: s_VarName
Method or function parameters:
- Usage: -
- Naming: testParam
Preprocessor Statements:
- Usage: Avoid when possible
- Naming: GRIZZLY_STATEMENT
Enums:
- Usage: Only enum class
- Naming: class: EPascalCase; value: PascalCase
Templates:
- Usage: Defined in the header as inline function
- Naming: snake_case