| 1 | /*! |
|---|
| 2 | |
|---|
| 3 | \page coding_style LEMON Coding Style |
|---|
| 4 | |
|---|
| 5 | \section naming_conv Naming Conventions |
|---|
| 6 | |
|---|
| 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 |
|---|
| 12 | developing LEMON library. |
|---|
| 13 | |
|---|
| 14 | \note When the coding style requires the capitalization of an abbreviation, |
|---|
| 15 | only the first letter should be upper case. |
|---|
| 16 | |
|---|
| 17 | \code |
|---|
| 18 | XmlReader |
|---|
| 19 | \endcode |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | \warning In some cases we diverge from these rules. |
|---|
| 23 | This primary done because STL uses different naming convention and |
|---|
| 24 | in certain cases |
|---|
| 25 | it is beneficial to provide STL compatible interface. |
|---|
| 26 | |
|---|
| 27 | \subsection cs-files File Names |
|---|
| 28 | |
|---|
| 29 | The header file names should look like the following. |
|---|
| 30 | |
|---|
| 31 | \code |
|---|
| 32 | header_file.h |
|---|
| 33 | \endcode |
|---|
| 34 | |
|---|
| 35 | Note that all standard LEMON headers are located in the \c lemon subdirectory, |
|---|
| 36 | so you should include them from C++ source like this: |
|---|
| 37 | |
|---|
| 38 | \code |
|---|
| 39 | #include <lemon/header_file.h> |
|---|
| 40 | \endcode |
|---|
| 41 | |
|---|
| 42 | The source code files use the same style and they have '.cc' extension. |
|---|
| 43 | |
|---|
| 44 | \code |
|---|
| 45 | source_code.cc |
|---|
| 46 | \endcode |
|---|
| 47 | |
|---|
| 48 | \subsection cs-class Classes and other types |
|---|
| 49 | |
|---|
| 50 | The name of a class or any type should look like the following. |
|---|
| 51 | |
|---|
| 52 | \code |
|---|
| 53 | AllWordsCapitalizedWithoutUnderscores |
|---|
| 54 | \endcode |
|---|
| 55 | |
|---|
| 56 | \subsection cs-func Methods and other functions |
|---|
| 57 | |
|---|
| 58 | The name of a function should look like the following. |
|---|
| 59 | |
|---|
| 60 | \code |
|---|
| 61 | firstWordLowerCaseRestCapitalizedWithoutUnderscores |
|---|
| 62 | \endcode |
|---|
| 63 | |
|---|
| 64 | \subsection cs-funcs Constants, Macros |
|---|
| 65 | |
|---|
| 66 | The names of constants and macros should look like the following. |
|---|
| 67 | |
|---|
| 68 | \code |
|---|
| 69 | ALL_UPPER_CASE_WITH_UNDERSCORES |
|---|
| 70 | \endcode |
|---|
| 71 | |
|---|
| 72 | \subsection cs-loc-var Class and instance member variables, auto variables |
|---|
| 73 | |
|---|
| 74 | The names of class and instance member variables and auto variables (=variables used locally in methods) should look like the following. |
|---|
| 75 | |
|---|
| 76 | \code |
|---|
| 77 | all_lower_case_with_underscores |
|---|
| 78 | \endcode |
|---|
| 79 | |
|---|
| 80 | \subsection cs-excep Exceptions |
|---|
| 81 | |
|---|
| 82 | When writing exceptions please comply the following naming conventions. |
|---|
| 83 | |
|---|
| 84 | \code |
|---|
| 85 | ClassNameEndsWithException |
|---|
| 86 | \endcode |
|---|
| 87 | |
|---|
| 88 | or |
|---|
| 89 | |
|---|
| 90 | \code |
|---|
| 91 | ClassNameEndsWithError |
|---|
| 92 | \endcode |
|---|
| 93 | |
|---|
| 94 | \section header-template Template Header File |
|---|
| 95 | |
|---|
| 96 | Each LEMON header file should look like this: |
|---|
| 97 | |
|---|
| 98 | \include template.h |
|---|
| 99 | |
|---|
| 100 | */ |
|---|