User Tools

Site Tools


development:player:code-formatting-conventions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
development:player:code-formatting-conventions [2013/06/30 23:40]
127.0.0.1 external edit
development:player:code-formatting-conventions [2015/10/03 09:54] (current)
Line 129: Line 129:
 ---- ----
 Use the following format: Use the following format:
-<code cpp>////////////////////////////////////////////////////////////​ +<code cpp>
-// Headers +
-////////////////////////////////////////////////////////////​+
 #include "​header1.h"​ #include "​header1.h"​
 #include "​header2.h"</​code>​ #include "​header2.h"</​code>​
Line 144: Line 142:
   * Backend/​Multimedia headers (e.g. graphics.h)   * Backend/​Multimedia headers (e.g. graphics.h)
   * Engine headers (e.g. game_character.h)   * Engine headers (e.g. game_character.h)
-  * Readers ​headers (e.g. lmu_reader.h)+  * liblcf ​headers (e.g. lmu_reader.h)
  
 For each headers group alphabetically sort the includes. For each headers group alphabetically sort the includes.
Line 157: Line 155:
 ==Documentation== ==Documentation==
 Use Doxygen like documentation,​ with the following format for functions: Use Doxygen like documentation,​ with the following format for functions:
-<code cpp>////////////////////////////////////////////////////////////​ +<code cpp>/** 
-/// Description of MyFunction. + Description of MyFunction. 
-/// A more detailed description here. + A more detailed description here. 
-/// @param var1 : this is a description for var1 + @param var1 : this is a description for var1 
-/// @param var2 : this is a description for var2 + @param var2 : this is a description for var2 
-/// @return here goes a description for return value + @return here goes a description for return value 
-///////////////////////////////////////////////////////////​/+ */
 virtual int MyFunction(double var1, std::string var2);</​code>​ virtual int MyFunction(double var1, std::string var2);</​code>​
  
 With the exception of getters and setters: With the exception of getters and setters:
-<code cpp>/// @return description of variable+<code cpp>/** @return description of variable ​*/
 int GetVariable();​ int GetVariable();​
  
-/// @param variable : description of variable+/** @param variable : description of variable ​*/
 void SetVariable(int variable);</​code>​ void SetVariable(int variable);</​code>​
  
 And for variables: And for variables:
-<code cpp>/// Description of example_variable.+<code cpp>/** Description of example_variable. ​*/
 std::string example_variable;</​code>​ std::string example_variable;</​code>​
  
 Remember to document only declarations and not implementations,​ i.e. in headers. An exception could be .cpp static functions or variables, if documenting is really necessary. Remember to document only declarations and not implementations,​ i.e. in headers. An exception could be .cpp static functions or variables, if documenting is really necessary.
- 
-==Separators== 
-For organizing better .cpp files add <​nowiki>////////////////////////////////////////////////////////////</​nowiki>​ (60 slashes) between different functions. Normally constructors,​ the destructor, functions and their overloads, and all properties (getters and setters) should be separated in "​groups"​ with these separators. 
  
 ==Code descriptions== ==Code descriptions==
-We prefer a global function description with Doxygen headers rather than inside the function descriptions. Only when code is really hard to follow, or there is something hardcoded then add some <​nowiki>//</​nowiki> ​comments explaining the situation. Do not add redundant comments, like actions that should be already understand easily.+We prefer a global function description with Doxygen headers rather than inside the function descriptions. Only when code is really hard to follow, or there is something hardcoded then add some comments explaining the situation. Do not add redundant comments, like actions that should be already understand easily.
  
 ==Special comments== ==Special comments==
 <code cpp>// TODO: what is left to do <code cpp>// TODO: what is left to do
 // FIXME: what code and in what circumstances it does not work, and if possible why it does not work well</​code>​ // FIXME: what code and in what circumstances it does not work, and if possible why it does not work well</​code>​
development/player/code-formatting-conventions.txt · Last modified: 2015/10/03 09:54 (external edit)