doc/coding_style.dox
author Balazs Dezso <deba@inf.elte.hu>
Wed, 11 Jan 2012 22:43:50 +0100
changeset 1027 8b2b9e61d8ce
parent 440 88ed40ad0d4f
child 1092 dceba191c00d
permissions -rw-r--r--
Remove asRedBludeNode() function (#69)
alpar@209
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
alpar@40
     2
 *
alpar@209
     3
 * This file is a part of LEMON, a generic C++ optimization library.
alpar@40
     4
 *
alpar@440
     5
 * Copyright (C) 2003-2009
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@209
    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@209
    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@209
    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@209
    87
ALL_UPPER_CASE_WITH_UNDERSCORES
alpar@40
    88
\endcode
alpar@40
    89
alpar@209
    90
\subsection cs-loc-var Class and instance member variables, auto variables
alpar@40
    91
alpar@210
    92
The names of class and instance member variables and auto variables
alpar@210
    93
(=variables used locally in methods) should look like the following.
alpar@40
    94
alpar@40
    95
\code
alpar@209
    96
all_lower_case_with_underscores
alpar@40
    97
\endcode
alpar@40
    98
alpar@41
    99
\subsection pri-loc-var Private member variables
alpar@41
   100
kpeter@919
   101
Private member variables should start with underscore.
alpar@41
   102
alpar@41
   103
\code
kpeter@919
   104
_start_with_underscore
alpar@41
   105
\endcode
alpar@41
   106
alpar@40
   107
\subsection cs-excep Exceptions
alpar@40
   108
alpar@40
   109
When writing exceptions please comply the following naming conventions.
alpar@40
   110
alpar@40
   111
\code
alpar@40
   112
ClassNameEndsWithException
alpar@40
   113
\endcode
alpar@40
   114
alpar@40
   115
or
alpar@40
   116
alpar@40
   117
\code
alpar@40
   118
ClassNameEndsWithError
alpar@40
   119
\endcode
alpar@40
   120
alpar@40
   121
\section header-template Template Header File
alpar@40
   122
alpar@40
   123
Each LEMON header file should look like this:
alpar@40
   124
alpar@40
   125
\include template.h
alpar@40
   126
alpar@40
   127
*/