COIN-OR::LEMON - Graph Library

source: lemon-0.x/doc/coding_style.dox

Last change on this file was 2553:bfced05fa852, checked in by Alpar Juttner, 13 years ago

Happy New Year to LEMON (+ better update-copyright-header script)

File size: 2.8 KB
RevLine 
[2391]1/* -*- C++ -*-
2 *
3 * This file is a part of LEMON, a generic C++ optimization library
4 *
[2553]5 * Copyright (C) 2003-2008
[2391]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
[507]19/*!
20
[921]21\page coding_style LEMON Coding Style
[507]22
[811]23\section naming_conv Naming Conventions
[507]24
[667]25In order to make development easier we have made some conventions
26according to coding style. These include names of types, classes,
27functions, variables, constants and exceptions. If these conventions
28are met in one's code then it is easier to read and maintain
29it. Please comply with these conventions if you want to contribute
[921]30developing LEMON library.
[603]31
[2157]32\note When the coding style requires the capitalization of an abbreviation,
33only the first letter should be upper case.
34
35\code
36XmlReader
37\endcode
38
39
[955]40\warning In some cases we diverge from these rules.
41This primary done because STL uses different naming convention and
42in certain cases
43it is beneficial to provide STL compatible interface.
44
45\subsection cs-files File Names
46
47The header file names should look like the following.
48
49\code
50header_file.h
51\endcode
52
[1083]53Note that all standard LEMON headers are located in the \c lemon subdirectory,
[955]54so you should include them from C++ source like this:
55
56\code
57#include <lemon/header_file.h>
58\endcode
59
60The source code files use the same style and they have '.cc' extension.
61
62\code
63source_code.cc
64\endcode
65
[614]66\subsection cs-class Classes and other types
[603]67
[955]68The name of a class or any type should look like the following.
[507]69
70\code
71AllWordsCapitalizedWithoutUnderscores
72\endcode
73
[614]74\subsection cs-func Methods and other functions
[603]75
[955]76The name of a function should look like the following.
[507]77
78\code
79firstWordLowerCaseRestCapitalizedWithoutUnderscores
80\endcode
81
[614]82\subsection cs-funcs Constants, Macros
[603]83
[955]84The names of constants and macros should look like the following.
[507]85
86\code
87ALL_UPPER_CASE_WITH_UNDERSCORES
88\endcode
89
[614]90\subsection cs-loc-var Class and instance member variables, auto variables
[507]91
[955]92The names of class and instance member variables and auto variables (=variables used locally in methods) should look like the following.
[507]93
94\code
95all_lower_case_with_underscores
96\endcode
97
[614]98\subsection cs-excep Exceptions
[507]99
[955]100When writing exceptions please comply the following naming conventions.
[603]101
[507]102\code
103ClassNameEndsWithException
104\endcode
105
[1788]106or
107
108\code
109ClassNameEndsWithError
110\endcode
111
[991]112\section header-template Template Header File
113
[1083]114Each LEMON header file should look like this:
[991]115
116\include template.h
117
[507]118*/
Note: See TracBrowser for help on using the repository browser.