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