Project

General

Profile

CodingRules » History » Version 4

Jules Waldhart, 2016-05-30 16:24
more about enums

1 1 Jules Waldhart
h1. Coding Rules
2
3 4 Jules Waldhart
*Table of Contents*
4
5
{{toc}}
6
7 1 Jules Waldhart
An unordered list of stuff we would like devs to follow
8
9 4 Jules Waldhart
h2. Naming
10 1 Jules Waldhart
11 4 Jules Waldhart
h3. Classes, attributes, variables
12
13 3 Jules Waldhart
* ClassesAreCamelCase with first letter capital, also are all types (typedef, enum, struct,...)
14
* methodsAreCamelCase with first letter lowercase
15
* _attributeStartWithUnderscore and is camelcase
16 1 Jules Waldhart
* localVariable or local_variable, first letter lowercase
17
* avoid calling @a=function(1.0,6,false,true)@, declare local variables with descriptive name for the parameters: @a=function(step_size,iteration_nb,enable_XYZ,multi_thread)@
18
19 4 Jules Waldhart
h3. Enums
20
21
Put enums in an existing namespace or class, and/or *create a struct and put it inside*. That struct can also contain methods to convert to/from string and other types.
22
23
<pre>
24
struct RobotType{
25
   enum Value {Robot, Human, Object};
26
   std::string toString(Value v);
27
   ...
28
}
29
</pre>
30
31
h2. Unimplemented stuff
32 3 Jules Waldhart
33 2 Jules Waldhart
* not implemented functions: put an @assert(false);@ in it, it will abort in debug mode, and do nothing in release. (instead of a print or whatever, which is totally unclear)
34 1 Jules Waldhart
* but mainly, avoid to commit unimplemented functions.