|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <title>cpp-netlib: Style Guide</title> |
| 5 | + <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> |
| 6 | + <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"> |
| 7 | + <link href="static/cpp-netlib.css" rel="stylesheet"> |
| 8 | + </head> |
| 9 | + <body data-spy="scroll" data-target=".cpp-netlib-docs-sidebar"> |
| 10 | + <div id="wrap"> |
| 11 | + <div class="navbar navbar-fixed-top navbar-inverse cpp-netlib-navbar"> |
| 12 | + <div class="container"> |
| 13 | + <ul class="nav"> |
| 14 | + <li><a class="brand" href="index.html">cpp-netlib</a></li> |
| 15 | + <li><a href="process.html">Development Process</a></li> |
| 16 | + <li class="active"><a href="style-guide.html">Style Guide</a></li> |
| 17 | + <li><a href="proposals.html">Proposals</a></li> |
| 18 | + </ul> |
| 19 | + </div> |
| 20 | + </div> |
| 21 | + <header class="jumbotron subhead"> |
| 22 | + <div class="container"> |
| 23 | + <h1>Development Process</h1> |
| 24 | + <p class="lead">How we get things done.</p> |
| 25 | + </div> |
| 26 | + </header> |
| 27 | + <div class="container"> |
| 28 | + <div class="row"> |
| 29 | + <div class="span2 cpp-netlib-docs-sidebar"> |
| 30 | + <ul class="nav nav-list" data-spy="affix" data-offset-top="150"> |
| 31 | + <li><a href="#overview">Overview</a></li> |
| 32 | + <li><a href="#formatting">Formatting</a></li> |
| 33 | + <li><a href="#naming">Naming</a></li> |
| 34 | + <li><a href="#features">Features</a></li> |
| 35 | + <li><a href="#organization">Organization</a></li> |
| 36 | + </ul> |
| 37 | + </div> |
| 38 | + <div class="span9"> |
| 39 | + <section id="overview"> |
| 40 | + <div class="page-header"> |
| 41 | + <h1>Overview</h1> |
| 42 | + </div> |
| 43 | + <p>This is the style guide for the cpp-netlib project. We strive |
| 44 | + for consistency throughout the codebase to make it easier for |
| 45 | + developers and users to understand the code.</p> |
| 46 | + <p>The style guide is not exhaustive and is subject to change |
| 47 | + based on community agreement. If you have questions or |
| 48 | + clarifications to the contents of the style guide, get involved |
| 49 | + in the discussion at <a |
| 50 | + href="https://groups.google.com/group/cpp-netlib" |
| 51 | + target="_blank">https://groups.google.com/group/cpp-netlib</a>.</p> |
| 52 | + </section> |
| 53 | + <section id="formatting"> |
| 54 | + <div class="page-header"> |
| 55 | + <h1>Formatting</h1> |
| 56 | + </div> |
| 57 | + <p>We enforce the formatting rules prescribed by the Google Style |
| 58 | + Guide as implemented by the clang-format tool.</p> |
| 59 | + <dl> |
| 60 | + <dt id="spaces">Spaces vs Tabs</dt> |
| 61 | + <dd>Use spaces instead of tab characters.</dd> |
| 62 | + <dt id="indents">Indents</dt> |
| 63 | + <dd>Block indents two spaces, arguments to function calls indent 4 spaces from the start of the function name.</dd> |
| 64 | + <dt id="namespaces">Namespaces</dt> |
| 65 | + <dd>Namespaces do not start indent contexts.</dd> |
| 66 | + <dt id="braces">Braces</dt> |
| 67 | + <dd>Curly braces should be on the same line as function, namespace, class, enum, and loop declarations.</dd> |
| 68 | + <dt id="parentheses">Parentheses</dt> |
| 69 | + <dd>There should be no spaces before and after opening and closing parentheses.</dd> |
| 70 | + <dt id="commas">Commas</dt> |
| 71 | + <dd>There should be a space after every comma.</dd> |
| 72 | + </dl> |
| 73 | + </section> |
| 74 | + <section id="naming"> |
| 75 | + <div class="page-header"> |
| 76 | + <h1>Naming</h1> |
| 77 | + </div> |
| 78 | + <p>We follow naming conventions used by the standard library.</p> |
| 79 | + <dl> |
| 80 | + <dt id="types">Types</dt> |
| 81 | + <dd>Types should be named as nouns, are in all-lowercase characters, and have words separated by underscores.</dd> |
| 82 | + <dt id="template-parameters">Template Parameters</dt> |
| 83 | + <dd>Template parameter names should be general nouns, should start with an uppercase character, and have words concatenated each starting with uppercase characters.</dd> |
| 84 | + <dt id="functions">Functions</dt> |
| 85 | + <dd>Functions should be verbs, are in all-lowercase characters, and have words separated by underscores.</dd> |
| 86 | + <dt id="macros">Macros</dt> |
| 87 | + <dd>Macros should be all-uppercase characters, start with <code>NETWORK</code> and have words separated by underscores.</dd> |
| 88 | + </dl> |
| 89 | + </section> |
| 90 | + <section id="features"> |
| 91 | + <div class="page-header"> |
| 92 | + <h1>Features</h1> |
| 93 | + </div> |
| 94 | + <p>We use all the facilities afforded us by C++. In particular, the most current C++ standard is the one we code against.</p> |
| 95 | + </section> |
| 96 | + <section id="organization"> |
| 97 | + <div class="page-header"> |
| 98 | + <h1>Organization</h1> |
| 99 | + </div> |
| 100 | + <p>We organize the whole library in namespaces, and where appropriate as macro's and static class members.</p> |
| 101 | + <dl> |
| 102 | + <dt id="constants">Constants</dt> |
| 103 | + <dd>Prefer constants be defined as static class members, function-local static variables, enum classes, scoped enums, then macro's in that order.</dd> |
| 104 | + <dt id="details">Details</dt> |
| 105 | + <dd>Parts of the implementation considered as "implementation details" shall live in a nested namespace called <code>impl</code>.</dd> |
| 106 | + </dl> |
| 107 | + </section> |
| 108 | + </div> |
| 109 | + </div> |
| 110 | + </div> |
| 111 | + </div> |
| 112 | + <footer id="footer"> |
| 113 | + <div class="container"> |
| 114 | + <p class="muted credit">Copyright 2012 Dean Michael Berris; Glyn |
| 115 | + Matthews; Google, Inc.</p> |
| 116 | + <p class="muted credit">Distributed under the Boost Software License, |
| 117 | + Version 1.0. (See accompanying file <a |
| 118 | + href="LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a |
| 119 | + href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</p> |
| 120 | + </div> |
| 121 | + </footer> |
| 122 | + <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> |
| 123 | + <script src="bootstrap/js/bootstrap.min.js"></script> |
| 124 | + </body> |
| 125 | +</html> |
| 126 | + |
0 commit comments