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

Commitce408d7

Browse files
committed
Added extra examples for HTTP client and server and generally updated the documentation.
1 parent0106771 commitce408d7

19 files changed

+368
-175
lines changed

‎libs/network/doc/appendices.qbk

Lines changed: 5 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -5,115 +5,10 @@
55
http://www.boost.org/LICENSE_1_0.txt).
66
]
77

8-
[section:appendix_1 Appendix 1: Message Concepts]
8+
[section:appendices Appendices]
99

10-
[section:message_concept Message]
10+
[include message_concept.qbk]
11+
[include uri_concept.qbk]
12+
[include http_uri_concept.qbk]
1113

12-
__message__ is
13-
[@http://www.boost.org/doc/html/DefaultConstructible.html
14-
DefaultConstructible],
15-
[@http://www.boost.org/doc/html/CopyConstructible.html
16-
CopyConstructible] and [@http://www.boost.org/doc/html/Assignable.html
17-
Assignable].
18-
19-
[heading Description]
20-
21-
A type models the URI Concept if the type adheres to the following
22-
usage semantics, and is DefaultConstructible and EqualityComparable.
23-
24-
[variablelist Notation
25-
[[`M`] [A Message Type.]]
26-
[[`m`, `m_`] [A Message Type instance.]]
27-
[[`S`] [A String Type.]]
28-
[[`s`] [A String Type instance.]]
29-
[[`O`] [An Ostringstream Type.]]
30-
[[`o`] [An Ostringstream Type instance.]]
31-
[[`C`] [A Header Container Type.]]
32-
[[`c`] [A Header Container Type instance.]]
33-
]
34-
35-
[heading Valid Expressions]
36-
37-
[table
38-
[[Expression] [Return Type] [Description]]
39-
[[`M m_(m);`] [] [M must be Copy constructible.]]
40-
[[`M m_; m_ = m;`] [] [M must be Assignable.]]
41-
[[`swap(m, m_);`] [void] [Swap should be availabe via ADL.]]
42-
[[`M::string_type`] [S] [M should have a nested type `string_type` of type `S`.]]
43-
[[`M::headers_container_type`] [C] [M should have a nested type `headers_container_type` of type `C`.]]
44-
]
45-
46-
47-
[endsect] [/message_concept]
48-
49-
[endsect] [/appendix_1]
50-
51-
[section:appendix_2 Appendix 2: URI Concepts]
52-
53-
This page describes the URI Concepts implemented within cpp-netlib.
54-
The following concepts are also implemented as Boost.Concept_check
55-
types enforced by the URI library.
56-
57-
URI Concepts are organized into a hierarchy of conepts.
58-
59-
[section:uri_concept URI]
60-
61-
[heading Description]
62-
63-
A type models the URI Concept if the type adheres to the following
64-
usage semantics, and is DefaultConstructible and EqualityComparable.
65-
66-
[variablelist Notation
67-
[[`U`] [A URI Type.]]
68-
[[`u`, `u_`] [A URI Type instance.]]
69-
[[`S`] [A String Type.]]
70-
[[`s`] [A String Type instance.]]
71-
]
72-
73-
[heading Valid Expressions]
74-
75-
For any URI, the following expressions must be valid:
76-
77-
[table
78-
[[Expression] [Return Type] [Description]]
79-
[[`U u_(u)`;] [] [U must be Copy constructible.]]
80-
[[`U u_; u_ = u;`] [] [U must be Assignable.]]
81-
[[`U u_(s)`;] [] [U can be constructed from a string `s`.]]
82-
[[`swap(u, u_);`] [void] [Swap should be availabe via ADL.]]
83-
[[`protocol(u);`] [S] [Return the protocol part of the URI.]]
84-
[[`rest(u);`] [S] [Return the rest of the URI, excluding the protocol part.]]
85-
[[`valid(u);`] [bool] [Return true whether the URI is a valid URI.]]
86-
[[`U::string_type`] [S] [U should have a nested type `string_type` of type `S`.]]
87-
]
88-
89-
[endsect] [/uri_concept]
90-
91-
[section:http_uri HTTP URI]
92-
93-
A type models the HTTP URI Concept if the type adheres to the following
94-
usage semantics, and if the type also models the URI Concept.
95-
96-
[variablelist Notation
97-
[[`H`] [An HTTP URI Type.]]
98-
[[`h`,`h_`] [An HTTP URI Type instance.]]
99-
[[`S`] [A String Type.]]
100-
[[`s`] [A String Type instance.]]
101-
]
102-
103-
[heading Valid Expressions]
104-
105-
For any HTTP URI, the following expressions must be valid:
106-
107-
[table
108-
[[Expression] [Return Type] [Description]]
109-
[[`user_info(h)`] [S] [Retrieve the user-info part of the HTTP URI.]]
110-
[[`host(h)`] [S] [Retrieve the host part of the HTTP URI.]]
111-
[[`port(h)`] [uint16_t] [Retrieve the port part of the HTTP URI.]]
112-
[[`path(h)`] [S] [Retrieve the path part of the HTTP URI.]]
113-
[[`query(h)`] [S] [Retrieve the query part of the HTTP URI.]]
114-
[[`fragment(h)`][S] [Retrieve the fragment part of the HTTP URI.]]
115-
]
116-
117-
[endsect] [/http_uri]
118-
119-
[endsect] [/appendix_2]
14+
[endsect] [/ appendices]

‎libs/network/doc/contributors.qbk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
http://www.boost.org/LICENSE_1_0.txt).
66
]
77

8+
[section:contributors Contributors]
9+
[endsect] [/ contributors]

‎libs/network/doc/examples.qbk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[/
2-
(C) Copyright 2008, 2009 Glyn Matthews.
2+
(C) Copyright 2008, 2009, 2010 Glyn Matthews.
33
Distributed under the Boost Software License, Version 1.0.
44
(See accompanying file LICENSE_1_0.txt or copy at
55
http://www.boost.org/LICENSE_1_0.txt).
66
]
77

88

99
[section:examples Examples]
10+
[include examples/hello_world.qbk]
1011
[include examples/http_client.qbk]
1112
[include examples/simple_wget.qbk]
1213
[endsect]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[/
2+
(C) Copyright 2010 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
9+
[section:hello_world Hello World]
10+
11+
[import ../../example/hello_world_server.cpp]
12+
[hello_world_server_main]
13+
14+
[import ../../example/hello_world_client.cpp]
15+
[hello_world_client_main]
16+
17+
[endsect] [/hello_world]
18+

‎libs/network/doc/examples/http_client.qbk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
[section:http_client HTTP Client]
1010
[import ../../example/http_client.cpp]
1111
[http_client_main]
12-
[endsect]
12+
[endsect] [/http_client]
1313

‎libs/network/doc/examples/simple_wget.qbk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
[section:simple_wget Simple 'wget' Clone]
1111
[import ../../example/simple_wget.cpp]
1212
[simple_wget_main]
13-
[endsect]
13+
[endsect] [/simple_wget]
1414

‎libs/network/doc/http_uri_concept.qbk

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[/
2+
(C) Copyright 2010 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
9+
[section:http_uri HTTP URI Concept]
10+
11+
A type models the HTTP URI Concept if the type adheres to the following
12+
usage semantics, and if the type also models the URI Concept.
13+
14+
[variablelist Notation
15+
[[`H`] [An HTTP URI Type.]]
16+
[[`h`,`h_`] [An HTTP URI Type instance.]]
17+
[[`S`] [A String Type.]]
18+
[[`s`] [A String Type instance.]]
19+
]
20+
21+
[heading Valid Expressions]
22+
23+
For any HTTP URI, the following expressions must be valid:
24+
25+
[table
26+
[[Expression] [Return Type] [Description]]
27+
[[`user_info(h)`] [S] [Retrieve the user-info part of the HTTP URI.]]
28+
[[`host(h)`] [S] [Retrieve the host part of the HTTP URI.]]
29+
[[`port(h)`] [uint16_t] [Retrieve the port part of the HTTP URI.]]
30+
[[`path(h)`] [S] [Retrieve the path part of the HTTP URI.]]
31+
[[`query(h)`] [S] [Retrieve the query part of the HTTP URI.]]
32+
[[`fragment(h)`][S] [Retrieve the fragment part of the HTTP URI.]]
33+
]
34+
35+
[endsect] [/ http_uri]

‎libs/network/doc/intro.qbk

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@
1111
[section:motivation Motivation]
1212
Modern applications that communicate over the internet have never been
1313
more prevalent, ranging through diverse areas such as high performance
14-
servers to embedded systems for smart phonesor navigation systems.
14+
servers to embedded systems for smart phonesand navigation systems.
1515

1616
Currently, there are no open source network libraries available that
17-
use modern object-oriented techniques in C++. With the introduction
18-
of __boost_asio__, developing portable network C++ applications has
19-
become a very much easier task. What is still lacking is a set of
20-
libraries that utilise __boost_asio__ in order to provide application
21-
level support so that C++ developers are able to develop internet and
22-
distributed applications more effectively.
17+
use modern object-oriented techniques in C++. Any developer will
18+
understand the familiar problem of searching for a protocol library
19+
for their project, failing to find anything suitable and too often
20+
having to hand-roll their own.
21+
22+
By leveraging __boost__, and in particular __boost_asio__, developers
23+
can create portable network C++ applications much more easily. What
24+
is still lacking is a set of libraries that utilise __boost_asio__ in
25+
order to provide application level support so that C++ developers are
26+
able to develop internet and distributed applications more
27+
effectively. This is the niche that the developers of the __cnl__ see
28+
their project filling.
2329

2430
[endsect] [/motivation]
2531

@@ -28,25 +34,23 @@ The objectives of the __cnl__ are to:
2834

2935
* develop a high quality, portable, easy to use C++ networking library
3036
* enable developers to easily extend the library
31-
* lower the barrier to entry for cross-platform network-aware C++
37+
* lower the barrier to entry for cross-platform, network-aware C++
3238
applications
3339

34-
The goal of __cnl__ has never been to build a fully-featured web
35-
server - there are plenty of excellent options already available. The
36-
niche that this library targets is for light-weight networking
37-
functionality for C++ applications that have demanding performance
38-
requirements or memory constraints, but that also need to be portable.
39-
This type of application is becoming increasingly common as software
40-
becomes more distributed, and applications need to communicate with
41-
services.
40+
The goal of the __cnl__ has never been to build a fully-featured web
41+
server - there are plenty of excellent options already available.
42+
This project targets light-weight networking functionality for C++
43+
applications that have demanding performance requirements or memory
44+
constraints, but that also need to be portable. This type of
45+
application is becoming increasingly common as software becomes more
46+
distributed, and applications need to run on a wide range of devices.
4247

4348
While many languages provide direct library support for high level
44-
network programming, this feature is missing in C++. Therefore, this
45-
library has been developed with the intention of eventually being
46-
submitted to __boost__, a collection of general, high quality
47-
libraries for C++ developers.
49+
network programming, this feature is missing in standard C++.
50+
Therefore, this library has been developed with the intention of
51+
eventually being submitted to __boost__.
4852

49-
Eventually, __cnl__ will be extended to support many of the
53+
Eventually,the__cnl__ will be extended to support many of the
5054
application layer protocols such as SMTP, FTP, SOAP, XMPP etc.
5155

5256
[endsect] [/objectives]

‎libs/network/doc/message.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ template <
1212
classbasic_message {
1313
public:
1414
/*<< Defines the underlying string type, so that the message can
15-
be specialized for different text encodings >>*/
15+
be specialized for different text encodings. >>*/
1616
typedeftypename string<Tag>::type string_type;
17-
/*<< Defines a container for message headers >>*/
17+
/*<< Defines a container for message headers. >>*/
1818
typedeftypename headers_container<Tag>::type headers_container_type;
1919

20-
/*<< Copy constructor >>*/
20+
/*<< Copy constructor. >>*/
2121
basic_message(const basic_message &);
22-
/*<< Assignment operator >>*/
22+
/*<< Assignment operator. >>*/
2323
basic_message &operator = (const basic_message &);
24-
/*<< Swap function >>*/
24+
/*<< Swap function. >>*/
2525
voidswap(basic_message &);
2626

27-
/*<< Accesses the message headers >>*/
27+
/*<< Accesses the message headers. >>*/
2828
headers_container_type &headers()const;
29-
/*<< Accesses the message body >>*/
29+
/*<< Accesses the message body. >>*/
3030
string_type &body()const;
31-
/*<< Accesses the source of the message >>*/
31+
/*<< Accesses the source of the message. >>*/
3232
string_type &source()const;
33-
/*<< Accesses the destination of the message >>*/
33+
/*<< Accesses the destination of the message. >>*/
3434
string_type &destination()const;
3535
};
3636

‎libs/network/doc/message_concept.qbk

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[/
2+
(C) Copyright 2010 Glyn Matthews.
3+
Distributed under the Boost Software License, Version 1.0.
4+
(See accompanying file LICENSE_1_0.txt or copy at
5+
http://www.boost.org/LICENSE_1_0.txt).
6+
]
7+
8+
9+
[section:message_concept Message Concept]
10+
11+
__message__ is
12+
[@http://www.boost.org/doc/html/DefaultConstructible.html
13+
DefaultConstructible],
14+
[@http://www.boost.org/doc/html/CopyConstructible.html
15+
CopyConstructible] and [@http://www.boost.org/doc/html/Assignable.html
16+
Assignable].
17+
18+
[heading Description]
19+
20+
A type models the Message Concept if the type adheres to the following
21+
usage semantics, and is DefaultConstructible and EqualityComparable.
22+
23+
[variablelist Notation
24+
[[`M`] [A Message Type.]]
25+
[[`m`, `m_`] [A Message Type instance.]]
26+
[[`S`] [A String Type.]]
27+
[[`s`] [A String Type instance.]]
28+
[[`O`] [An Ostringstream Type.]]
29+
[[`o`] [An Ostringstream Type instance.]]
30+
[[`C`] [A Header Container Type.]]
31+
[[`c`] [A Header Container Type instance.]]
32+
]
33+
34+
[heading Valid Expressions]
35+
36+
[table
37+
[[Expression] [Return Type] [Description]]
38+
[[`M m_(m);`] [] [M must be Copy constructible.]]
39+
[[`M m_; m_ = m;`] [] [M must be Assignable.]]
40+
[[`swap(m, m_);`] [void] [Swap should be availabe via ADL.]]
41+
[[`M::string_type`] [S] [M should have a nested type `string_type` of type `S`.]]
42+
[[`M::headers_container_type`] [C] [M should have a nested type `headers_container_type` of type `C`.]]
43+
]
44+
45+
46+
[endsect] [/ message_concept]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp