Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/more/header.htm @ 18

Last change on this file since 18 was 12, checked in by landauf, 17 years ago

added boost

File size: 4.8 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5<title>Boost Header policy</title>
6<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
7<meta name="ProgId" content="FrontPage.Editor.Document">
8<meta name="Microsoft Border" content="none, default">
9</head>
10
11<body bgcolor="#FFFFFF" text="#000000">
12
13<table border="1" bgcolor="#007F7F" cellpadding="2">
14  <tr>
15    <td bgcolor="#FFFFFF"><img src="../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"></td>
16    <td><a href="../index.htm"><font face="Arial" color="#FFFFFF"><big>Home</big></font></a></td>
17    <td><a href="../libs/libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries</big></font></a></td>
18    <td><a href="../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People</big></font></a></td>
19    <td><a href="faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ</big></font></a></td>
20    <td><a href="index.htm"><font face="Arial" color="#FFFFFF"><big>More</big></font></a></td>
21  </tr>
22</table>
23<h1>Boost Header Policy</h1>
24<p>Header files are the place where a library comes into contact with user code
25and other libraries.&nbsp; To co-exist peacefully and productively, headers must
26be &quot;good neighbors&quot;.</p>
27<p>Here are the standards for namespace boost headers.&nbsp;&nbsp;&nbsp; Many of
28these are also reasonable guidelines for general use.
29<ul>
30  <li>Headers should have a .hpp (lowercase) filename extension.&nbsp;</li>
31  <li>Wrap the header in #ifndef guards so that multiple inclusion is
32    benign.&nbsp; Use a naming convention that minimizes the chance of clashes
33    with macro names from other's code.&nbsp; The <a href="#Sample header">sample
34    header</a> uses the Boost convention of all uppercase letters, with the
35    header name prefixed by the namespace name, and suffixed with HPP, separated
36    by underscores.</li>
37  <li>Wrap the header contents in a namespace to prevent global namespace
38    pollution. The namespace approach to pollution control is strongly preferred
39    to older approaches such as adding funny prefixes to global names.&nbsp;
40    Libraries which are designed to work well with other Boost libraries should
41    be placed namespace <tt>boost</tt>.</li>
42
43  <li>Make sure that a translation unit consisting of just the
44  contents of the header file will compile successfully.
45
46  <li>Place the header file in a sub-directory to prevent conflict with
47    identically named header files in other libraries.&nbsp; The parent
48    directory is added to the compiler's include search path.&nbsp; Then both
49    your code and user code specifies the sub-directory in <tt>#include</tt>
50    directives.&nbsp; Thus the header <a href="#Sample header">sample header</a>&nbsp;
51    would be included by <tt>#include &lt;boost/furball.hpp&gt;</tt></li>
52  <li>The preferred ordering for class definitions is public members, protected
53    members, and finally private members.</li>
54  <li>Include the boost/config.hpp <a href="../libs/config/config.htm">configuration
55    header</a> if there is a need to deal with compiler or platform
56    configuration issues.</li>
57</ul>
58<h2><a name="Sample header"></a>Sample Header</h2>
59<pre><tt>//&nbsp; Boost general library furball.hpp header file&nbsp; ---------------------------//
60
61//&nbsp; (C) Copyright Your Name 1998. Permission to copy, use, modify, sell and
62//&nbsp; distribute this software is granted provided this copyright notice appears
63//&nbsp; in all copies. This software is provided &quot;as is&quot; without express or implied
64//&nbsp; warranty, and with no claim as to its suitability for any purpose.
65
66//&nbsp; See http://www.boost.org for updates, documentation, and revision history.
67
68#ifndef BOOST_FURBALL_HPP
69#define BOOST_FURBALL_HPP
70
71namespace boost {
72
73//&nbsp; Furball class declaration&nbsp; -----------------------------------------------//
74
75&nbsp; class furball
76  {
77    public:
78&nbsp;     void throw_up();
79    private:
80      int whatever;
81&nbsp;&nbsp;};&nbsp; // furball
82
83} // namespace
84
85#endif&nbsp; // BOOST_FURBALL_HPP</tt></pre>
86<h2>Coding Style</h2>
87<p>The alert reader will have noticed that the <a href="#Sample header">sample
88header</a> employs a certain coding style for indentation, positioning braces,
89commenting ending braces, and similar formatting issues.&nbsp; These stylistic
90issues are viewed as personal preferences and are not part of the Boost Header
91Policy.</p>
92<hr>
93<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->02 October, 2003<!--webbot bot="Timestamp" endspan i-checksum="38549" --></p>
94
95<p>© Copyright Beman Dawes 1998</p>
96<p> Use, modification, and distribution are subject to the Boost Software
97License, Version 1.0. (See accompanying file <a href="../LICENSE_1_0.txt">
98LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
99www.boost.org/LICENSE_1_0.txt</a>)</p>
100
101</body>
102
103</html>
Note: See TracBrowser for help on using the repository browser.