doc/coding_style.dox
changeset 40 8f4e8273a458
child 41 b11737922197
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc/coding_style.dox	Mon Jan 07 19:22:09 2008 +0100
     1.3 @@ -0,0 +1,118 @@
     1.4 +/* -*- C++ -*-
     1.5 + *
     1.6 + * This file is a part of LEMON, a generic C++ optimization library
     1.7 + *
     1.8 + * Copyright (C) 2003-2008
     1.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11 + *
    1.12 + * Permission to use, modify and distribute this software is granted
    1.13 + * provided that this copyright notice appears in all copies. For
    1.14 + * precise terms see the accompanying LICENSE file.
    1.15 + *
    1.16 + * This software is provided "AS IS" with no warranty of any kind,
    1.17 + * express or implied, and with no claim as to its suitability for any
    1.18 + * purpose.
    1.19 + *
    1.20 + */
    1.21 +
    1.22 +/*!
    1.23 +
    1.24 +\page coding_style LEMON Coding Style 
    1.25 +
    1.26 +\section naming_conv Naming Conventions
    1.27 +
    1.28 +In order to make development easier we have made some conventions
    1.29 +according to coding style. These include names of types, classes,
    1.30 +functions, variables, constants and exceptions. If these conventions
    1.31 +are met in one's code then it is easier to read and maintain
    1.32 +it. Please comply with these conventions if you want to contribute
    1.33 +developing LEMON library.
    1.34 +
    1.35 +\note When the coding style requires the capitalization of an abbreviation,
    1.36 +only the first letter should be upper case.
    1.37 +
    1.38 +\code
    1.39 +XmlReader
    1.40 +\endcode
    1.41 +
    1.42 +
    1.43 +\warning In some cases we diverge from these rules.
    1.44 +This primary done because STL uses different naming convention and
    1.45 +in certain cases
    1.46 +it is beneficial to provide STL compatible interface.
    1.47 +
    1.48 +\subsection cs-files File Names
    1.49 +
    1.50 +The header file names should look like the following.
    1.51 +
    1.52 +\code
    1.53 +header_file.h
    1.54 +\endcode
    1.55 +
    1.56 +Note that all standard LEMON headers are located in the \c lemon subdirectory,
    1.57 +so you should include them from C++ source like this:
    1.58 +
    1.59 +\code
    1.60 +#include <lemon/header_file.h>
    1.61 +\endcode
    1.62 +
    1.63 +The source code files use the same style and they have '.cc' extension.
    1.64 +
    1.65 +\code
    1.66 +source_code.cc
    1.67 +\endcode
    1.68 +
    1.69 +\subsection cs-class Classes and other types
    1.70 +
    1.71 +The name of a class or any type should look like the following.
    1.72 +
    1.73 +\code
    1.74 +AllWordsCapitalizedWithoutUnderscores 
    1.75 +\endcode
    1.76 +
    1.77 +\subsection cs-func Methods and other functions
    1.78 +
    1.79 +The name of a function should look like the following.
    1.80 +
    1.81 +\code
    1.82 +firstWordLowerCaseRestCapitalizedWithoutUnderscores 
    1.83 +\endcode
    1.84 +
    1.85 +\subsection cs-funcs Constants, Macros
    1.86 +
    1.87 +The names of constants and macros should look like the following.
    1.88 +
    1.89 +\code
    1.90 +ALL_UPPER_CASE_WITH_UNDERSCORES 
    1.91 +\endcode
    1.92 +
    1.93 +\subsection cs-loc-var Class and instance member variables, auto variables 
    1.94 +
    1.95 +The names of class and instance member variables and auto variables (=variables used locally in methods) should look like the following.
    1.96 +
    1.97 +\code
    1.98 +all_lower_case_with_underscores 
    1.99 +\endcode
   1.100 +
   1.101 +\subsection cs-excep Exceptions
   1.102 +
   1.103 +When writing exceptions please comply the following naming conventions.
   1.104 +
   1.105 +\code
   1.106 +ClassNameEndsWithException
   1.107 +\endcode
   1.108 +
   1.109 +or
   1.110 +
   1.111 +\code
   1.112 +ClassNameEndsWithError
   1.113 +\endcode
   1.114 +
   1.115 +\section header-template Template Header File
   1.116 +
   1.117 +Each LEMON header file should look like this:
   1.118 +
   1.119 +\include template.h
   1.120 +
   1.121 +*/