[507] | 1 | /*! |
---|
| 2 | |
---|
[921] | 3 | \page coding_style LEMON Coding Style |
---|
[507] | 4 | |
---|
[811] | 5 | \section naming_conv Naming Conventions |
---|
[507] | 6 | |
---|
[667] | 7 | In order to make development easier we have made some conventions |
---|
| 8 | according to coding style. These include names of types, classes, |
---|
| 9 | functions, variables, constants and exceptions. If these conventions |
---|
| 10 | are met in one's code then it is easier to read and maintain |
---|
| 11 | it. Please comply with these conventions if you want to contribute |
---|
[921] | 12 | developing LEMON library. |
---|
[603] | 13 | |
---|
[955] | 14 | \warning In some cases we diverge from these rules. |
---|
| 15 | This primary done because STL uses different naming convention and |
---|
| 16 | in certain cases |
---|
| 17 | it is beneficial to provide STL compatible interface. |
---|
| 18 | |
---|
| 19 | \subsection cs-files File Names |
---|
| 20 | |
---|
| 21 | The header file names should look like the following. |
---|
| 22 | |
---|
| 23 | \code |
---|
| 24 | header_file.h |
---|
| 25 | \endcode |
---|
| 26 | |
---|
| 27 | Note that all standard Lemon headers are located in the \c lemon subdirectory, |
---|
| 28 | so you should include them from C++ source like this: |
---|
| 29 | |
---|
| 30 | \code |
---|
| 31 | #include <lemon/header_file.h> |
---|
| 32 | \endcode |
---|
| 33 | |
---|
| 34 | The source code files use the same style and they have '.cc' extension. |
---|
| 35 | |
---|
| 36 | \code |
---|
| 37 | source_code.cc |
---|
| 38 | \endcode |
---|
| 39 | |
---|
[614] | 40 | \subsection cs-class Classes and other types |
---|
[603] | 41 | |
---|
[955] | 42 | The name of a class or any type should look like the following. |
---|
[507] | 43 | |
---|
| 44 | \code |
---|
| 45 | AllWordsCapitalizedWithoutUnderscores |
---|
| 46 | \endcode |
---|
| 47 | |
---|
[614] | 48 | \subsection cs-func Methods and other functions |
---|
[603] | 49 | |
---|
[955] | 50 | The name of a function should look like the following. |
---|
[507] | 51 | |
---|
| 52 | \code |
---|
| 53 | firstWordLowerCaseRestCapitalizedWithoutUnderscores |
---|
| 54 | \endcode |
---|
| 55 | |
---|
[614] | 56 | \subsection cs-funcs Constants, Macros |
---|
[603] | 57 | |
---|
[955] | 58 | The names of constants and macros should look like the following. |
---|
[507] | 59 | |
---|
| 60 | \code |
---|
| 61 | ALL_UPPER_CASE_WITH_UNDERSCORES |
---|
| 62 | \endcode |
---|
| 63 | |
---|
[614] | 64 | \subsection cs-loc-var Class and instance member variables, auto variables |
---|
[507] | 65 | |
---|
[955] | 66 | The names of class and instance member variables and auto variables (=variables used locally in methods) should look like the following. |
---|
[507] | 67 | |
---|
| 68 | \code |
---|
| 69 | all_lower_case_with_underscores |
---|
| 70 | \endcode |
---|
| 71 | |
---|
[614] | 72 | \subsection cs-excep Exceptions |
---|
[507] | 73 | |
---|
[955] | 74 | When writing exceptions please comply the following naming conventions. |
---|
[603] | 75 | |
---|
[507] | 76 | \code |
---|
| 77 | ClassNameEndsWithException |
---|
| 78 | \endcode |
---|
| 79 | |
---|
[991] | 80 | \section header-template Template Header File |
---|
| 81 | |
---|
| 82 | Each Lemon header file should look like this: |
---|
| 83 | |
---|
| 84 | \include template.h |
---|
| 85 | |
---|
[507] | 86 | */ |
---|