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