The Style class contains all the recommended styles considerations. It has no special functionalities.
This is only a template class that developers can mimic.
More...
#include <Style.hpp>
The Style class contains all the recommended styles considerations. It has no special functionalities.
This is only a template class that developers can mimic.
This class includes coding rules and doxygen documentation examples.
Since doxygen 1.8.0, Markdown support is available in doxygen comments (see here).
Look at gstlearn READMEs for a quick overview of Markdown syntax.
This class demonstrates:
const
DECLARE_UNUSED
macro (need including geoslib_define.h)DECLARE_UNUSED
)Here are some rules about naming C++ types, functions, variables and symbols:
Here are some coding rules (good practices) for C++ developers:
goto
break
only in switch
casesconst
every whereusing namespace
More good practices available here
Important note: All C++ coding rules are configured in the .clang-format file. located in the root folder. Developers can use the "Clang format" VS code extension to benefit from the automatic formating feature
Here are some rules regarding constructors and destructors:
Main principles for documenting class methods are the following:
Public Member Functions | |
Style () | |
Style (const Style &r) | |
Style & | operator= (const Style &r) |
virtual | ~Style () |
double | getArgDouble () const |
int | getArgInt () const |
const VectorDouble & | getArgVectorDouble () const |
const VectorInt & | getArgVectorInt () const |
void | setArgDouble (double argDouble) |
void | setArgInt (int argInt) |
void | setArgVectorDouble (const VectorDouble &argVectorDouble) |
void | setArgVectorInt (const VectorInt &argVectorInt) |
Static Public Member Functions | |
static int | documentedStandard (int myArg) |
static int | documentedWithFormula (int myArg) |
static int | unusedArgument (int a) |
static void | myFunction (int myArgInt, double myArgDoubleDef=2.) |
Style::Style | ( | ) |
Default constructor
Always use the initialization list to set the default value of each class member. Put attributes in the same order than their declaration in the C++ header.
Style::Style | ( | const Style & | r | ) |
Copy constructor
Always use the initialization list to set the value of each class member. Put attributes in the same order than their declaration in the C++ header.
|
virtual |
Destructor
Always free pointers and clear the lists members of the class
|
static |
A method with standard argument documentation
[in] | myArg | Here should be placed the description of this argument |
|
static |
Documentation with Latex formula
The distance between \( p1=(x_1,y_1) \) and \( p2=(x_2,y_2) \) is \(\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\) (this formula may need to do this: https://github.com/doxygen/doxygen/issues/7484#issuecomment-572503569)
[in] | myArg | Here should be placed the description of this argument |
|
static |
Description of a static function
[in] | myArgInt | Integer argument |
[in] | myArgDoubleDef | Double argument |
Assignment operator
Always protect from self copy with the if statement
|
static |
A function where the argument is not used (could be the case in abstract methods)
[in] | a | Input argument not used (but documented) |