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

Commite4cb9f3

Browse files
committed
Merge pull request#582 from deanberris/initial-doxygen
Doxygen+Sphinx+Breathe = Inline Documentation
2 parents30e081e +86146c3 commite4cb9f3

File tree

10 files changed

+2611
-34
lines changed

10 files changed

+2611
-34
lines changed

‎.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ libs/mime/test/mime-roundtrip
1111
_build
1212
/.project
1313
build/
14+
libs/network/doc/doxygen/
15+
.DS_Store

‎.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "deps/googlemock"]
55
path=deps/googlemock
66
url=https://github.com/google/googlemock.git
7+
[submodule "libs/network/doc/_ext/breathe"]
8+
path=libs/network/doc/_ext/breathe
9+
url=https://github.com/michaeljones/breathe.git

‎Doxyfile

Lines changed: 2384 additions & 0 deletions
Large diffs are not rendered by default.

‎boost/network/protocol/http/client.hpp

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,49 @@ namespace boost {
3131
namespacenetwork {
3232
namespacehttp {
3333

34+
/**
35+
* Basic Client API.
36+
*
37+
* This template defines an HTTP client object that is non-copyable and is
38+
* implemented depending on the `Tag` parameter. It also hard-codes the version
39+
* of HTTP to support.
40+
*
41+
* @tparam Tag The Tag type used to determine certain traits of the
42+
* implementation. We use the Tag as an input to other template metafunctions
43+
* to determine things like the string type, whether to use TCP or UDP for the
44+
* resolver, etc.
45+
* @tparam version_major The HTTP major version.
46+
* @tparam version_minor The HTTP minor version.
47+
*
48+
*/
3449
template<classTag,unsigned version_major,unsigned version_minor>
35-
structbasic_client : basic_client_facade<Tag, version_major, version_minor> {
36-
private:
50+
classbasic_client :publicbasic_client_facade<Tag, version_major, version_minor> {
3751
typedef basic_client_facade<Tag, version_major, version_minor>
3852
base_facade_type;
3953

4054
public:
41-
typedef basic_request<Tag> request;
42-
typedef basic_response<Tag> response;
43-
typedeftypename string<Tag>::type string_type;
4455
typedef Tag tag_type;
4556
typedef client_options<Tag> options;
4657

47-
// Constructors
48-
// =================================================================
49-
// This constructor takes a singleoptions argument of type
50-
// client_options. See boost/network/protocol/http/client/options.hpp
51-
// for more details.
58+
/**
59+
* This constructor takes a single options argument of type
60+
* client_options. See boost/network/protocol/http/client/options.hpp for
61+
* more details.
62+
*/
5263
explicitbasic_client(optionsconst& options) : base_facade_type(options) {}
5364

54-
// This default constructor sets up the default options.
65+
/** This default constructor sets up the default options.*/
5566
basic_client() : base_facade_type(options()) {}
56-
//
57-
// =================================================================
5867
};
5968

6069
#ifndef BOOST_NETWORK_HTTP_CLIENT_DEFAULT_TAG
6170
#defineBOOST_NETWORK_HTTP_CLIENT_DEFAULT_TAG tags::http_async_8bit_udp_resolve
6271
#endif
6372

73+
/**
74+
* The default HTTP client type is an asynchronous UDP-resolving HTTP/1.1
75+
* client.
76+
*/
6477
typedef basic_client<BOOST_NETWORK_HTTP_CLIENT_DEFAULT_TAG,1,1> client;
6578

6679
}// namespace http

‎boost/network/protocol/http/client/facade.hpp

Lines changed: 161 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,37 @@ template <class Tag>
2424
structbasic_response;
2525

2626
template<classTag,unsigned version_major,unsigned version_minor>
27-
structbasic_client_facade {
28-
27+
classbasic_client_facade {
28+
typedef basic_client_impl<Tag, version_major, version_minor> pimpl_type;
29+
public:
30+
/**
31+
* The type to use for strings associated with this client. Typically resolves
32+
* to `std::string`.
33+
*/
2934
typedeftypename string<Tag>::type string_type;
35+
36+
/** The request type. This models the HTTP Request concept.*/
3037
typedef basic_request<Tag> request;
38+
39+
/** The response type. This models the HTTP Response concept.*/
3140
typedef basic_response<Tag> response;
32-
typedef basic_client_impl<Tag, version_major, version_minor> pimpl_type;
41+
42+
/**
43+
* This callback is invoked with a range representing part of the response's
44+
* body as it comes in. In case of errors, the second argument is an error
45+
* code.
46+
*/
3347
typedef function<void(iterator_range<charconst*>const&,
3448
system::error_codeconst&)> body_callback_function_type;
49+
50+
/**
51+
* Functions that model this signature will be used to generate part of the
52+
* body while the request is being performed. This allows users to provide a
53+
* generator function that will generate the body of the request piece-wise.
54+
*
55+
* Implementations should return `true` if there is more to the body of the
56+
* request, and `false` otherwise.
57+
*/
3558
typedef function<bool(string_type&)> body_generator_function_type;
3659

3760
explicitbasic_client_facade(client_options<Tag>const& options) {
@@ -40,19 +63,49 @@ struct basic_client_facade {
4063

4164
~basic_client_facade() { pimpl->wait_complete(); }
4265

66+
/**
67+
* Perform a HEAD request.
68+
*/
4369
responsehead(requestconst& request) {
4470
return pimpl->request_skeleton(request,"HEAD",false,
4571
body_callback_function_type(),
4672
body_generator_function_type());
4773
}
4874

75+
/**
76+
* Perform a GET request.
77+
*
78+
* @param[in] request The request object including the URI and headers.
79+
* @param[in] body_handler If provided, a callback invoked for parts of the
80+
* response's body.
81+
* @returns A response object.
82+
* @throw std::exception May throw exceptions on errors, derived from
83+
* `std::exception`.
84+
*/
4985
responseget(requestconst& request,
5086
body_callback_function_type body_handler =
5187
body_callback_function_type()) {
5288
return pimpl->request_skeleton(request,"GET",true, body_handler,
5389
body_generator_function_type());
5490
}
5591

92+
/**
93+
* Perform a POST request.
94+
*
95+
* @param[in] request A copy of the request object including the URI and
96+
* headers.
97+
* @param[in] body The whole contents of the body. If provided, this overrides
98+
* the body in the `request`.
99+
* @param[in] content_type The content type for the request. This overrides
100+
* the content type in the `request`.
101+
* @param[in] body_handler The callback invoked for parts of the response body
102+
* as they come in.
103+
* @param[in] body_generator If provided, is invoked to generate parts of the
104+
* request's body as it is being sent.
105+
* @returns A response object.
106+
* @throws std::exception May throw exceptions on errors, derived from
107+
* `std::exception`.
108+
*/
56109
responsepost(request request, string_typeconst& body = string_type(),
57110
string_typeconst& content_type = string_type(),
58111
body_callback_function_type body_handler =
@@ -82,28 +135,82 @@ struct basic_client_facade {
82135
body_generator);
83136
}
84137

138+
/**
139+
* Perform a POST request.
140+
*
141+
* @param[in] request The request including the URI and headers.
142+
* @param[in] body_generator The function to call to generate part of the body
143+
* while the request is being performed.
144+
* @param[in] callback If provided, the function to call for parts of the
145+
* response's body as they come in.
146+
* @returns A response object.
147+
* @throws std::exception May throw exceptions derived from std::exception in
148+
* case of errors.
149+
*/
85150
responsepost(requestconst& request,
86151
body_generator_function_type body_generator,
87-
body_callback_function_typecallback =
88-
body_generator_function_type()) {
89-
return pimpl->request_skeleton(request,"POST",true,callback,
90-
body_generator);
152+
body_callback_function_typebody_handler =
153+
body_callback_function_type()) {
154+
return pimpl->request_skeleton(request,"POST",true,body_handler,
155+
body_generator);
91156
}
92157

93-
responsepost(requestconst& request, body_callback_function_type callback,
158+
/**
159+
* Perform a POST request.
160+
*
161+
* @param[in] request The request including the URI and headers.
162+
* @param[in] body_generator The function to call to generate part of the body
163+
* while the request is being performed.
164+
* @param[in] callback If provided, the function to call for parts of the
165+
* response's body as they come in.
166+
* @returns A response object.
167+
* @throws std::exception May throw exceptions derived from std::exception in
168+
* case of errors.
169+
*/
170+
responsepost(requestconst& request, body_callback_function_type body_handler,
94171
body_generator_function_type body_generator =
95172
body_generator_function_type()) {
96-
returnpost(request,string_type(),string_type(),callback,
97-
body_generator);
173+
returnpost(request,string_type(),string_type(),body_handler,
174+
body_generator);
98175
}
99176

177+
/**
178+
* Perform a POST request.
179+
*
180+
* @param[in] request The request object including the URI and headers.
181+
* @param[in] body The whole contents of the body.
182+
* @param[in] body_handler The callback invoked for parts of the response body
183+
* as they come in.
184+
* @param[in] body_generator If provided, is invoked to generate parts of the
185+
* request's body as it is being sent.
186+
* @returns A response object.
187+
* @throws std::exception May throw exceptions on errors, derived from
188+
* `std::exception`.
189+
*/
100190
responsepost(requestconst& request, string_typeconst& body,
101-
body_callback_function_typecallback,
191+
body_callback_function_typebody_handler,
102192
body_generator_function_type body_generator =
103193
body_generator_function_type()) {
104-
returnpost(request, body,string_type(),callback, body_generator);
194+
returnpost(request, body,string_type(),body_handler, body_generator);
105195
}
106196

197+
/**
198+
* Perform a PUT request.
199+
*
200+
* @param[in] request A copy of the request object including the URI and
201+
* headers.
202+
* @param[in] body The whole contents of the body. If provided, this overrides
203+
* the body in the `request`.
204+
* @param[in] content_type The content type for the request. This overrides
205+
* the content type in the `request`.
206+
* @param[in] body_handler The callback invoked for parts of the response body
207+
* as they come in.
208+
* @param[in] body_generator If provided, is invoked to generate parts of the
209+
* request's body as it is being sent.
210+
* @returns A response object.
211+
* @throws std::exception May throw exceptions on errors, derived from
212+
* `std::exception`.
213+
*/
107214
responseput(request request, string_typeconst& body = string_type(),
108215
string_typeconst& content_type = string_type(),
109216
body_callback_function_type body_handler =
@@ -133,26 +240,62 @@ struct basic_client_facade {
133240
body_generator);
134241
}
135242

243+
/**
244+
* Perform a PUT request.
245+
*
246+
* @param[in] request The request including the URI and headers.
247+
* @param[in] callback If provided, the function to call for parts of the
248+
* response's body as they come in.
249+
* @param[in] body_generator The function to call to generate part of the body
250+
* while the request is being performed.
251+
* @returns A response object.
252+
* @throws std::exception May throw exceptions derived from std::exception in
253+
* case of errors.
254+
*/
136255
responseput(requestconst& request, body_callback_function_type callback,
137256
body_generator_function_type body_generator =
138257
body_generator_function_type()) {
139258
returnput(request,string_type(),string_type(), callback, body_generator);
140259
}
141260

261+
/**
262+
* Perform a POST request.
263+
*
264+
* @param[in] request The request object including the URI and headers.
265+
* @param[in] body The whole contents of the body.
266+
* @param[in] body_handler The callback invoked for parts of the response body
267+
* as they come in.
268+
* @param[in] body_generator If provided, is invoked to generate parts of the
269+
* request's body as it is being sent.
270+
* @returns A response object.
271+
* @throws std::exception May throw exceptions on errors, derived from
272+
* `std::exception`.
273+
*/
142274
responseput(requestconst& request, string_type body,
143-
body_callback_function_type callback,
144-
body_generator_function_type body_generator =
145-
body_generator_function_type()) {
146-
returnput(request, body,string_type(), callback, body_generator);
275+
body_callback_function_type body_handler,
276+
body_generator_function_type body_generator = {}) {
277+
returnput(request, body,string_type(), body_handler, body_generator);
147278
}
148279

280+
/**
281+
* Perform a DELETE request.
282+
*
283+
* @param[in] request The request object including the URI and the headers.
284+
* @param[in] body_handler The callback invoked for parts of the response body
285+
* as they come in, if provided.
286+
* @returns A response object.
287+
* @throws std::exception May throw exceptions on errors, derived from
288+
* `std::exception`.
289+
*/
149290
responsedelete_(requestconst& request,
150-
body_callback_function_type body_handler =
151-
body_callback_function_type()) {
291+
body_callback_function_type body_handler = {}) {
152292
return pimpl->request_skeleton(request,"DELETE",true, body_handler,
153293
body_generator_function_type());
154294
}
155295

296+
/**
297+
* Clears the cache of resolved endpoints.
298+
*/
156299
voidclear_resolved_cache() { pimpl->clear_resolved_cache(); }
157300

158301
protected:

‎boost/network/protocol/http/client/options.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace network {
1717
namespacehttp {
1818

1919
template<classTag>
20-
structclient_options {
20+
classclient_options {
21+
public:
2122
typedeftypename string<Tag>::type string_type;
2223

2324
client_options()

‎boost/network/protocol/http/client/pimpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct client_base<Tag, version_major, version_minor,
5555
}// namespace impl
5656

5757
template<classTag,unsigned version_major,unsigned version_minor>
58-
structbasic_client;
58+
classbasic_client;
5959

6060
template<classTag,unsigned version_major,unsigned version_minor>
6161
structbasic_client_impl

‎libs/network/doc/_ext/breathe

Submodulebreathe added at853385e

‎libs/network/doc/conf.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
1919
sys.path.append(os.path.abspath('_ext'))
20+
sys.path.append(os.path.abspath('_ext/breathe'))
21+
22+
# Use breathe for doxygen integration
2023

2124
# -- General configuration -----------------------------------------------------
2225

@@ -27,10 +30,17 @@
2730
'sphinx.ext.autodoc',
2831
'sphinx.ext.doctest',
2932
'sphinx.ext.coverage',
33+
'breathe',
3034
]
3135

3236
todo_include_todos=True
3337

38+
# Tell breathe about the doxygen project.
39+
breathe_projects= {'cppnetlib':os.path.abspath('doxygen/xml') }
40+
41+
# Default breathe project
42+
breathe_default_project='cppnetlib'
43+
3444
# Add any paths that contain templates here, relative to this directory.
3545
# templates_path = ['_templates']
3646

@@ -70,7 +80,9 @@
7080

7181
# List of directories, relative to source directory, that shouldn't be searched
7282
# for source files.
73-
exclude_trees= ['build','doxyxml','ext']
83+
exclude_trees= ['_build','doxygen','_ext']
84+
85+
exclude_patterns= ['_ext/breathe/*']
7486

7587
# If true, '()' will be appended to :func: etc. cross-reference text.
7688
# add_function_parentheses = True

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp