COIN-OR::LEMON - Graph Library

Changes between Initial Version and Version 1 of CodingStyle


Ignore:
Timestamp:
07/06/08 11:25:16 (16 years ago)
Author:
Alpar Juttner
Comment:

Rename from CodingConventions? to CodingStyle

Legend:

Unmodified
Added
Removed
Modified
  • CodingStyle

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