doc/coding_style.dox
author "Balazs Dezso <deba@inf.elte.hu>"
Thu, 17 Apr 2008 19:33:19 +0200
changeset 136 b82dc494bafc
parent 40 8f4e8273a458
child 209 765619b7cbb2
permissions -rw-r--r--
Icc compatibility fixes (ticket #84)
alpar@40
     1
/* -*- C++ -*-
alpar@40
     2
 *
alpar@40
     3
 * This file is a part of LEMON, a generic C++ optimization library
alpar@40
     4
 *
alpar@40
     5
 * Copyright (C) 2003-2008
alpar@40
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@40
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@40
     8
 *
alpar@40
     9
 * Permission to use, modify and distribute this software is granted
alpar@40
    10
 * provided that this copyright notice appears in all copies. For
alpar@40
    11
 * precise terms see the accompanying LICENSE file.
alpar@40
    12
 *
alpar@40
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@40
    14
 * express or implied, and with no claim as to its suitability for any
alpar@40
    15
 * purpose.
alpar@40
    16
 *
alpar@40
    17
 */
alpar@40
    18
alpar@40
    19
/*!
alpar@40
    20
alpar@40
    21
\page coding_style LEMON Coding Style 
alpar@40
    22
alpar@40
    23
\section naming_conv Naming Conventions
alpar@40
    24
alpar@40
    25
In order to make development easier we have made some conventions
alpar@40
    26
according to coding style. These include names of types, classes,
alpar@40
    27
functions, variables, constants and exceptions. If these conventions
alpar@40
    28
are met in one's code then it is easier to read and maintain
alpar@40
    29
it. Please comply with these conventions if you want to contribute
alpar@40
    30
developing LEMON library.
alpar@40
    31
alpar@40
    32
\note When the coding style requires the capitalization of an abbreviation,
alpar@40
    33
only the first letter should be upper case.
alpar@40
    34
alpar@40
    35
\code
alpar@40
    36
XmlReader
alpar@40
    37
\endcode
alpar@40
    38
alpar@40
    39
alpar@40
    40
\warning In some cases we diverge from these rules.
alpar@41
    41
This is primary done because STL uses different naming convention and
alpar@40
    42
in certain cases
alpar@40
    43
it is beneficial to provide STL compatible interface.
alpar@40
    44
alpar@40
    45
\subsection cs-files File Names
alpar@40
    46
alpar@40
    47
The header file names should look like the following.
alpar@40
    48
alpar@40
    49
\code
alpar@40
    50
header_file.h
alpar@40
    51
\endcode
alpar@40
    52
alpar@40
    53
Note that all standard LEMON headers are located in the \c lemon subdirectory,
alpar@40
    54
so you should include them from C++ source like this:
alpar@40
    55
alpar@40
    56
\code
alpar@40
    57
#include <lemon/header_file.h>
alpar@40
    58
\endcode
alpar@40
    59
alpar@40
    60
The source code files use the same style and they have '.cc' extension.
alpar@40
    61
alpar@40
    62
\code
alpar@40
    63
source_code.cc
alpar@40
    64
\endcode
alpar@40
    65
alpar@40
    66
\subsection cs-class Classes and other types
alpar@40
    67
alpar@40
    68
The name of a class or any type should look like the following.
alpar@40
    69
alpar@40
    70
\code
alpar@40
    71
AllWordsCapitalizedWithoutUnderscores 
alpar@40
    72
\endcode
alpar@40
    73
alpar@40
    74
\subsection cs-func Methods and other functions
alpar@40
    75
alpar@40
    76
The name of a function should look like the following.
alpar@40
    77
alpar@40
    78
\code
alpar@40
    79
firstWordLowerCaseRestCapitalizedWithoutUnderscores 
alpar@40
    80
\endcode
alpar@40
    81
alpar@40
    82
\subsection cs-funcs Constants, Macros
alpar@40
    83
alpar@40
    84
The names of constants and macros should look like the following.
alpar@40
    85
alpar@40
    86
\code
alpar@40
    87
ALL_UPPER_CASE_WITH_UNDERSCORES 
alpar@40
    88
\endcode
alpar@40
    89
alpar@40
    90
\subsection cs-loc-var Class and instance member variables, auto variables 
alpar@40
    91
alpar@40
    92
The names of class and instance member variables and auto variables (=variables used locally in methods) should look like the following.
alpar@40
    93
alpar@40
    94
\code
alpar@40
    95
all_lower_case_with_underscores 
alpar@40
    96
\endcode
alpar@40
    97
alpar@41
    98
\subsection pri-loc-var Private member variables
alpar@41
    99
alpar@41
   100
Private member variables should start with underscore
alpar@41
   101
alpar@41
   102
\code
alpar@41
   103
_start_with_underscores
alpar@41
   104
\endcode
alpar@41
   105
alpar@40
   106
\subsection cs-excep Exceptions
alpar@40
   107
alpar@40
   108
When writing exceptions please comply the following naming conventions.
alpar@40
   109
alpar@40
   110
\code
alpar@40
   111
ClassNameEndsWithException
alpar@40
   112
\endcode
alpar@40
   113
alpar@40
   114
or
alpar@40
   115
alpar@40
   116
\code
alpar@40
   117
ClassNameEndsWithError
alpar@40
   118
\endcode
alpar@40
   119
alpar@40
   120
\section header-template Template Header File
alpar@40
   121
alpar@40
   122
Each LEMON header file should look like this:
alpar@40
   123
alpar@40
   124
\include template.h
alpar@40
   125
alpar@40
   126
*/