Skip to content

Commit 37dd419

Browse files
committed
Updated docs to use Sphinx... it's looking great :)
1 parent 8f2785e commit 37dd419

File tree

105 files changed

+4713
-34
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+4713
-34
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ CMakeFiles
66
Makefile
77
Testing
88
build
9+
_build
910
bin
1011

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 01d66de409ce597a9fdf28debf9bbc6f
4+
tags: fbb0d17656682115ca4d033fb2f83ba1

libs/network/doc/rst/cpp-netlib.rst renamed to libs/network/doc/rst/_build/dirhtml/_sources/cpp-netlib.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
:Authors: Glyn Matthews <glyn.matthews@gmail.com>
66
Dean Michael Berris <mikhailberis@gmail.com>
77
:Date: Jun 16, 2010
8-
:Version: 2.0
8+
:Version: 0.7
99
:Description: Complete user documentation, with examples, for the cpp-netlib.
10-
:Copyright: Copyright Glyn Matthews, Dean Mikhail Beris
11-
2008-2010. Distributed under the Boost Software License,
12-
Version 1.0. (See accompanying file LICENSE_1_0.txt
13-
or copy at http://www.boost.org/LICENSE_1_0.txt)
10+
:Copyright: Copyright Glyn Matthews, Dean Michael Berris 2008-2010.
11+
Distributed under the Boost Software License, Version
12+
1.0. (See accompanying file LICENSE_1_0.txt or copy at
13+
http://www.boost.org/LICENSE_1_0.txt)
1414

1515
-----------------
1616
Getting Started
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Quick installation guide
2+
========================
3+
4+
Installing an official release
5+
------------------------------
6+
7+
All stable versions of ``cpp-netlib`` can be downloaded from Github:
8+
``http://github.com/cpp-netlib/cpp-netlib/downloads``. Each release
9+
is available as gzipped (Using the command ``tar xzf
10+
cpp-netlib.tar.gz``) or bzipped (Using ``tar xjf cpp-netlib.tar.bz2``)
11+
tarball, or as a zipfile (``unzip cpp-netlib.zip``, or on Windows
12+
using a tool such as 7zip_).
13+
14+
.. _7zip: http://www.7-zip.org/
15+
16+
17+
Installing a development version
18+
--------------------------------
19+
20+
The ``cpp-netlib`` uses Git_ for source control, so to use any
21+
development versions Git must be installed on your system.
22+
23+
Using the command line, the command to get the latest code is:
24+
25+
::
26+
shell$ git clone git://github.com/mikhailberis/cpp-netlib.git
27+
28+
This should be enough information get to started. To do more complex
29+
things with Git, such as pulling changes or checking out a new branch,
30+
refer to the `Git documentation`_.
31+
32+
Windows users need to use msysGit_, and to invoke the command above
33+
from a shell.
34+
35+
For fans of Subversion_, the same code can be checked out from
36+
`http://svn.github.com/mikhailberis/cpp-netlib.git`.
37+
38+
.. _Git: http://git-scm.com/
39+
.. _`Git documentation`: http://git-scm.com/documentation
40+
.. _msysGit: http://code.google.com/p/msysgit/downloads/list
41+
.. _Subversion: http://subversion.tigris.org/
42+
43+
Getting Boost
44+
-------------
45+
46+
``cpp-netlib`` depends on Boost_. It should work for Boost 1.41.0 and
47+
above. If Boost is not installed on your system, the environment
48+
variable ``BOOST_ROOT`` must be defined, which must be the full path
49+
name of the top directory of the Boost distribution. Although Boost is
50+
mostly header only, applications built using ``cpp-netlib`` still
51+
requires linking with `Boost.System`_.
52+
53+
.. _Boost: http://www.boost.org/doc/libs/release/more/getting_started/index.html
54+
.. _`Boost.System`: http://www.boost.org/libs/system/index.html
55+
56+
Getting CMake
57+
-------------
58+
59+
The ``cpp-netlib`` uses CMake_.
60+
61+
.. _CMake: http://www.cmake.org/
62+
63+
Configuring ``cpp-netlib``
64+
==========================
65+
66+
Instructions for Windows Users
67+
------------------------------
68+
69+
Instructions for Linux Users
70+
----------------------------
71+
72+
Building and Running the Examples
73+
---------------------------------
74+
75+
Troubleshooting
76+
===============
77+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. A short paragraph on the history of the project.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
.. include:: http/http_client.rst
3+
.. include:: http/hello_world_server.rst
4+
.. include:: http/hello_world_client.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"Hello world" server
2+
====================
3+
4+
5+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
HTTP client
2+
===========
3+
4+
The first code example is the simplest thing you can do with the
5+
``cpp-netlib``. The application is a simple HTTP client. All we are
6+
doing is creating and sending an HTTP request to a server and printing
7+
the response body. Without further ado, the code to do this as
8+
follows:
9+
10+
::
11+
12+
#include <boost/network/protocol/http/client.hpp>
13+
#include <iostream>
14+
15+
int
16+
main(int argc, char *argv[]) {
17+
using namespace boost::network;
18+
19+
if (argc != 2) {
20+
std::cout << "Usage: " << argv[0] << " [url]" << std::endl;
21+
return 1;
22+
}
23+
24+
http::client client;
25+
http::client::request request(argv[1]);
26+
request << header("Connection", "close");
27+
http::client::response response = client.get(request);
28+
std::cout << body(response) << std::endl;
29+
30+
return 0;
31+
}
32+
33+
Since this is the first example, each line will be presented and
34+
explained in detail.
35+
36+
::
37+
38+
#include <boost/network/protocol/http/client.hpp>
39+
40+
All the code needed for the HTTP client resides in this header.
41+
42+
::
43+
44+
http::client client;
45+
46+
First we create a ``client`` object. The ``client`` contains all the
47+
connection and protocol logic. The default HTTP client is version
48+
1.1, as specified in `RFC 2616`_.
49+
50+
::
51+
52+
http::client::request request(argv[1]);
53+
54+
Next, we create a ``request`` object, with a URI string passed as a
55+
constructor argument.
56+
57+
::
58+
59+
request << header("Connection", "close");
60+
61+
``cpp-netlib`` makes use of stream syntax and *directives* to allow
62+
developers to build complex message structures with greater
63+
flexibility and clarity. Here, we add the HTTP header "Connection:
64+
close" to the request in order to signal that the connection will be
65+
closed after the request has completed.
66+
67+
::
68+
69+
http::client::response response = client.get(request);
70+
71+
Once we've built the request, we then make an HTTP GET request
72+
throught the ``http::client`` from which an ``http::response`` is
73+
returned. ``http::client`` supports all common HTTP methods.
74+
75+
::
76+
77+
std::cout << body(response) << std::endl;
78+
79+
Finally, though we don't check any error checking, the response body
80+
is printed to the console using the ``body`` directive.
81+
82+
.. _`RFC 2616`: http://www.w3.org/Protocols/rfc2616/rfc2616.html
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. cpp-netlib documentation master file, created by
2+
sphinx-quickstart on Wed Jun 16 23:53:37 2010.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to cpp-netlib's documentation!
7+
======================================
8+
9+
Contents:
10+
11+
.. toctree::
12+
:maxdepth: 2
13+
14+
Indices and tables
15+
==================
16+
17+
* :ref:`genindex`
18+
* :ref:`modindex`
19+
* :ref:`search`
20+

0 commit comments

Comments
 (0)