Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit483d15f

Browse files
committed
Adding 0.8-beta documentation as a subdirectory.
1 parentf82253e commit483d15f

File tree

76 files changed

+10895
-0
lines changed

Some content is hidden

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

76 files changed

+10895
-0
lines changed

‎0.8-beta/_images/boost.png

13.1 KB
Loading

‎0.8-beta/_images/ftp_uri.png

25 KB
Loading

‎0.8-beta/_images/http_uri.png

20.2 KB
Loading

‎0.8-beta/_images/mailto_uri.png

9.98 KB
Loading

‎0.8-beta/_sources/directives.txt

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
Directives
2+
==========
3+
4+
The :mod:`cpp-netlib` uses a technique for allowing message-passing
5+
semantics in a chainable fashion in the form of directives. The basic
6+
concept for directives is, in a general sense, an encapsulated
7+
transformation that can be applied to objects that abide by the
8+
directive protocol.
9+
10+
Using the object-oriented notion of message passing, where an object
11+
accepts a message (usually a function call) we define a simple DSEL in
12+
order for the protocol to be supported by certain object types. In the
13+
:mod:`cpp-netlib` the protocol implemented is similar to that of the
14+
standard iostream formatting system:
15+
16+
.. code-block:: c++
17+
18+
object << directive1(...)
19+
<< directive2(...)
20+
...
21+
<< directiveN(...);
22+
23+
In :mod:`cpp-netlib` the directives are simple function objects that
24+
take a target object as reference and returns a reference to the same
25+
object as a result. In code the directive pattern looks like the
26+
following:
27+
28+
.. code-block:: c++
29+
30+
struct directive_type {
31+
template <class Input>
32+
Input & operator()(Input & input) const {
33+
// do something to input
34+
return input;
35+
}
36+
};
37+
38+
To simplify directive creation, usually factory or generator functions
39+
are defined to return concrete objects of the directive's type.
40+
41+
.. code-block:: c++
42+
43+
inline
44+
directive_type directive(...) {
45+
return directive_type();
46+
}
47+
48+
The trivial implementation of the directive protocol then boils down
49+
to the specialization of the shift-left operator on the target type.
50+
51+
.. code-block:: c++
52+
53+
template <class Directive>
54+
inline target_type & operator<<
55+
(target_type & x, Directive const & f) {
56+
return f(x);
57+
}
58+
59+
.. todo::
60+
61+
An example using a directive.
62+
63+
The rationale for implementing directives include the following:
64+
65+
* **Encapsulation** - by moving logic into the directive types the
66+
target object's interface can remain rudimentary and even hidden
67+
to the user's immediate attention. Adding this layer of
68+
indirection also allows for changing the underlying
69+
implementations while maintaining the same syntactic and semantic
70+
properties.
71+
* **Flexibility** - by allowing the creation of directives that are
72+
independent from the target object's type, generic operations can
73+
be applied based on the concept being modeled by the target
74+
type. The flexibility also afforded comes in the directive's
75+
generator function, which can also generate different concrete
76+
directive specializations based on parameters to the function.
77+
* **Extensibility** - because the directives are independent of the
78+
target object's type, new directives can be added and supported
79+
without having to change the target object at all.
80+
* **Reuse** - truly generic directives can then be used for a broad
81+
set of target object types that model the same concepts supported
82+
by the directive. Because the directives are self-contained
83+
objects, the state and other object references it keeps are only
84+
accessible to it and can be re-used in different contexts as well.
85+
86+
Extending a system that uses directives is trivial in header-only
87+
systems because new directives are simply additive. The protocol is
88+
simple and can be applied to a broad class of situations.
89+
90+
In a header-only library, the static nature of the wiring and chaining
91+
of the operations lends itself to compiler abuse. A deep enough
92+
nesting of the directives can lead to prolonged compilation times.

‎0.8-beta/_sources/examples.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Examples
2+
========
3+
4+
The :mod:`cpp-netlib` is a practical library that is designed to aid
5+
the development of applications for that need to communicate using
6+
common networking protocols. The following set of examples describe a
7+
series of realistic examples that use the :mod:`cpp-netlib` for these
8+
kinds of application.
9+
10+
.. toctree::
11+
:maxdepth: 2
12+
13+
examples_http.rst
14+
.. examples_xmpp.rst

‎0.8-beta/_sources/examples_http.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
HTTP examples
2+
=============
3+
4+
The HTTP component of the :mod:`cpp-netlib` contains a client and server.
5+
The examples that follow show how to use both for programs that can be
6+
embedded into larger applications.
7+
8+
.. toctree::
9+
:maxdepth: 2
10+
11+
http_client.rst
12+
hello_world_server.rst
13+
hello_world_client.rst

‎0.8-beta/_sources/generic_message.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Generic message
2+
===============
3+
4+
.. todo::
5+
6+
Is this section repeated?

‎0.8-beta/_sources/getting_started.txt

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
.. _getting_started:
2+
3+
*****************
4+
Getting Started
5+
*****************
6+
7+
Downloading an official release
8+
===============================
9+
10+
All stable versions of :mod:`cpp-netlib` can be downloaded from
11+
Github_ from this url:
12+
13+
http://github.com/cpp-netlib/cpp-netlib/downloads
14+
15+
Each release is available as gzipped (Using the command
16+
``tar xzf cpp-netlib.tar.gz``) or bzipped (Using ``tar xjf
17+
cpp-netlib.tar.bz2``) tarball, or as a zipfile (``unzip
18+
cpp-netlib.zip``, or on Windows using a tool such as 7zip_).
19+
20+
.. _Github: http://github.com/cpp-netlib/cpp-netlib/downloads
21+
.. _7zip: http://www.7-zip.org/
22+
23+
Downloading a development version
24+
=================================
25+
26+
The :mod:`cpp-netlib` uses Git_ for source control, so to use any
27+
development versions Git must be installed on your system.
28+
29+
Using the command line, the command to get the latest code is:
30+
31+
::
32+
33+
shell$ git clone git://github.com/mikhailberis/cpp-netlib.git
34+
35+
This should be enough information get to started. To do more complex
36+
things with Git, such as pulling changes or checking out a new branch,
37+
refer to the `Git documentation`_.
38+
39+
.. note:: If you look at the Git repository closely, this is the repository of
40+
*mikhailberis* instead of *cpp-netlib*. The reason is that the main developer
41+
and maintainer of the project is Dean Michael Berris, who goes by the alias
42+
*mikhailberis* on the Internet.
43+
44+
Dean does the merging and maintenance of the whole library, similar to how
45+
`Linus Torvalds`_ of the Linux project acts as the gatekeeper of the project.
46+
47+
.. _`Linus Torvalds`: http://en.wikipedia.org/wiki/Linus_Torvalds
48+
49+
Windows users need to use msysGit_, and to invoke the command above
50+
from a shell.
51+
52+
For fans of Subversion_, the same code can be checked out from
53+
http://svn.github.com/mikhailberis/cpp-netlib.git.
54+
55+
.. _Git: http://git-scm.com/
56+
.. _`Git documentation`: http://git-scm.com/documentation
57+
.. _msysGit: http://code.google.com/p/msysgit/downloads/list
58+
.. _Subversion: http://subversion.tigris.org/
59+
60+
.. note:: The :mod:`cpp-netlib` project is hosted on GitHub_ and follows the
61+
prescribed development model for GitHub_ based projects. This means in case
62+
you want to submit patches, you will have to create a fork of the project
63+
(read up on forking_) and then submit a pull request (read up on submitting
64+
`pull requests`_).
65+
66+
.. _forking: http://help.github.com/forking/
67+
.. _`pull requests`: http://help.github.com/pull-requests/
68+
69+
Getting Boost
70+
=============
71+
72+
:mod:`cpp-netlib` depends on Boost_. It should work for any version
73+
of Boost above 1.43.0. If Boost is not installed on your system, the
74+
latest package can be found on the `Boost web-site`_. The environment
75+
variable ``BOOST_ROOT`` must be defined, which must be the full path
76+
name of the top directory of the Boost distribution. Although Boost
77+
is mostly header only, applications built using :mod:`cpp-netlib`
78+
still requires linking with `Boost.System`_, `Boost.Date_time`_, and
79+
`Boost.Regex`_.
80+
81+
.. _Boost: http://www.boost.org/doc/libs/release/more/getting_started/index.html
82+
.. _`Boost web-site`: http://www.boost.org/users/download/
83+
.. _`Boost.System`: http://www.boost.org/libs/system/index.html
84+
.. _`Boost.Date_time`: http://www.boost.org/libs/date_time/index.html
85+
.. _`Boost.Regex`: http://www.boost.org/libs/regex/index.html
86+
87+
.. note:: You can follow the steps in the `Boost Getting Started`_ guide to
88+
install Boost into your development system.
89+
90+
.. _`Boost Getting Started`:
91+
http://www.boost.org/doc/libs/release/more/getting_started/index.html
92+
93+
Getting CMake
94+
=============
95+
96+
The :mod:`cpp-netlib` uses CMake_ to generate platform-specific build files. If
97+
you intend to run the test suite, you can follow the instructions below.
98+
Otherwise, you don't need CMake to use :mod:`cpp-netlib` in your project. The
99+
:mod:`cpp-netlib` requires CMake version 2.8 or higher.
100+
101+
.. _CMake: http://www.cmake.org/
102+
103+
Let's assume that you have unpacked the :mod:`cpp-netlib` at the top of your
104+
HOME directory. On Unix-like systems you will typically be able to change into
105+
your HOME directory using the command ``cd ~``. This sample below assumes that
106+
the ``~/cpp-netlib`` directory exists, and is the top-level directory of the
107+
:mod:`cpp-netlib` release.
108+
109+
Building with CMake
110+
===================
111+
112+
To build the tests that come with cpp-netlib, we first need to configure the
113+
build system to use our compiler of choice. This is done by running the
114+
``cmake`` command at the top-level directory of :mod:`cpp-netlib` with
115+
additional parameters::
116+
117+
$ cd ~/cpp-netlib
118+
$ cmake -DCMAKE_BUILD_TYPE=Debug \
119+
> -DCMAKE_C_COMPILER=gcc \
120+
> -DCMAKE_CXX_COMPILER=g++ \
121+
> .
122+
123+
Building on Linux
124+
~~~~~~~~~~~~~~~~~
125+
126+
On Linux, this will generate the appropriate Makefiles that will enable you to
127+
build and run the tests and examples that come with :mod:`cpp-netlib`. To build
128+
the tests, you can run ``make`` in the same top-level directory of
129+
:mod:`cpp-netlib`::
130+
131+
$ make
132+
133+
.. note:: Just like with traditional GNU Make, you can add the ``-j`` parameter
134+
to specify how many parallel builds to run. In case you're in a sufficiently
135+
powerful system and would like to parallelize the build into 4 jobs, you can
136+
do this with::
137+
138+
make -j4
139+
140+
As a caveat, :mod:`cpp-netlib` is heavy on template metaprogramming and will
141+
require a lot of computing and memory resources to build the individual
142+
tests. Do this at the risk of thrashing_ your system.
143+
144+
.. _thrashing: http://en.wikipedia.org/wiki/Thrashing_(computer_science)
145+
146+
Once the build has completed, you can now run the test suite by issuing::
147+
148+
$ make test
149+
150+
Building On Windows
151+
~~~~~~~~~~~~~~~~~~~
152+
153+
If you're using the Microsoft Visual C++ compiler or the Microsoft Visual Studio
154+
IDE and you would like to build cpp-netlib from within Visual Studio, you can
155+
look for the solution and project files as the artifacts of the call to
156+
``cmake`` -- the file should be named ``cpp-netlib.sln`` (the solution) along
157+
with a number of project files for Visual Studio.
158+
159+
Reporting Issues, Getting Support
160+
=================================
161+
162+
In case you find yourself stuck or if you've found a bug (or you want to just
163+
join the discussion) you have a few options to choose from.
164+
165+
For reporting bugs, feature requests, and asking questions about the
166+
implementation and/or the documentation, you can go to the GitHub issues page
167+
for the project at http://github.com/cpp-netlib/cpp-netlib/issues.
168+
169+
You can also opt to join the developers mailing list for a more personal
170+
interaction with the developers of the project. You can join the mailing list
171+
through https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel.
172+
173+
You may also choose to get commercial support from:
174+
175+
Dean Michael Berris - <me@deanberris.com>
176+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp