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

Commit8dc51c1

Browse files
committed
Pulled changes from 0.9
2 parents3312a7b +b3dc290 commit8dc51c1

File tree

379 files changed

+31510
-3069
lines changed

Some content is hidden

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

379 files changed

+31510
-3069
lines changed

‎.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ CMakeCache.txt
55
CMakeFiles
66
Makefile
77
Testing
8-
build
9-
_build
10-
bin
118
*.gch
12-
9+
libs/mime/test/mime-roundtrip
10+
*.a

‎CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
cmake_minimum_required(VERSION2.6)
77
project(CPP-NETLIB)
88
find_package(Boost1.41.0 )
9+
set(CMAKE_VERBOSE_MAKEFILEtrue)
910
if (Boost_FOUND)
1011
set(Boost_USE_STATIC_LIBSON)
1112
set(Boost_USE_MULTI_THREADEDON)
1213
include_directories(${Boost_INCLUDE_DIRS})
1314
endif()
1415
enable_testing()
16+
add_subdirectory(libs/network/build)
1517
add_subdirectory(libs/network/test)
1618
add_subdirectory(libs/mime/test)
1719
add_subdirectory(libs/network/example)
20+

‎Jamroot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import os ;
99
local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
1010

1111
use-project /boost : $(BOOST_ROOT) ;
12+
use-project /cpp-netlib : libs/network/build ;
1213

1314
using testing ;
1415

‎boost/network/constants.hpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ namespace boost { namespace network {
2626
return dot_;
2727
}
2828

29+
staticchardot_char() {return'.'; }
30+
2931
staticcharconst *http_slash() {
3032
staticchar http_slash_[] = {'H','T','T','P','/',0 };
3133
return http_slash_;
@@ -36,11 +38,15 @@ namespace boost { namespace network {
3638
return space_;
3739
}
3840

41+
staticcharspace_char() {return''; }
42+
3943
staticcharconst *slash() {
4044
staticchar slash_[] = {'/',0};
4145
return slash_;
4246
}
4347

48+
staticcharslash_char() {return'/'; }
49+
4450
staticcharconst *host() {
4551
staticchar host_[] = {'H','o','s','t',0};
4652
return host_;
@@ -50,6 +56,8 @@ namespace boost { namespace network {
5056
staticchar colon_[] = {':',0};
5157
return colon_;
5258
}
59+
60+
staticcharcolon_char() {return':'; }
5361

5462
staticcharconst *accept() {
5563
staticchar accept_[] = {'A','c','c','e','p','t',0};
@@ -91,10 +99,43 @@ namespace boost { namespace network {
9199
return cpp_netlib_slash_;
92100
}
93101

102+
staticcharquestion_mark_char() {
103+
return'?';
104+
}
105+
106+
staticcharhash_char() {
107+
return'#';
108+
}
109+
110+
staticcharconst *connection() {
111+
staticchar connection_[] = {
112+
'C','o','n','n','e','c','t','i','o','n',0
113+
};
114+
return connection_;
115+
}
116+
117+
staticcharconst *close() {
118+
staticchar close_[] = {
119+
'C','l','o','s','e',0
120+
};
121+
return close_;
122+
}
123+
124+
staticcharconst *https() {
125+
staticchar https_[] ="https";
126+
return https_;
127+
}
128+
94129
};
95130

96131
template<classTag>
97132
structconstants_wide {
133+
134+
staticwchar_tconst *https() {
135+
staticwchar_t https_[] =L"https";
136+
return https_;
137+
}
138+
98139
};
99140
}
100141

‎boost/network/detail/debug.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef BOOST_NETWORK_DEBUG_HPP_20110410
2+
#defineBOOST_NETWORK_DEBUG_HPP_20110410
3+
4+
// (c) Copyright 2011 Dean Michael Berris.
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
/** BOOST_NETWORK_MESSAGE is a debugging macro used by cpp-netlib to
10+
print out network-related errors through standard error. This is
11+
only useful when BOOST_NETWORK_DEBUG is turned on. Otherwise
12+
the macro amounts to a no-op.
13+
*/
14+
#ifdef BOOST_NETWORK_DEBUG
15+
#include<iostream>
16+
#ifndef BOOST_NETWORK_MESSAGE
17+
#defineBOOST_NETWORK_MESSAGE(msg) std::cerr <<"[DEBUG" << __FILE__ <<':' << __LINE__ <<"]:" << msg << std::endl;
18+
#endif
19+
#else
20+
#ifndef BOOST_NETWORK_MESSAGE
21+
#defineBOOST_NETWORK_MESSAGE(msg)
22+
#endif
23+
#endif
24+
25+
#endif/* end of include guard: BOOST_NETWORK_DEBUG_HPP_20110410*/

‎boost/network/detail/directive_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace boost { namespace network { namespace detail {
1818
//explicit directive_base(basic_message<tag> & message_)
1919
// : _message(message_)
2020
protected:
21-
virtual~directive_base()
21+
~directive_base()
2222
{ };// can only be extended
2323

2424
// mutable basic_message<tag> & _message;

‎boost/network/detail/wrapper_base.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,30 @@
99

1010
namespaceboost {namespacenetwork {
1111

12-
template<classTag>
13-
structbasic_message;
14-
1512
namespacedetail {
1613

17-
template<classTag>
14+
template<classTag,classMessage>
1815
structwrapper_base {
19-
explicitwrapper_base(basic_message<Tag> & message_)
16+
explicitwrapper_base(Message & message_)
2017
: _message(message_)
2118
{};
2219

2320
protected:
2421
~wrapper_base() {};// for extending only
2522

26-
basic_message<Tag> & _message;
23+
Message & _message;
2724
};
2825

29-
template<classTag>
26+
template<classTag,classMessage>
3027
structwrapper_base_const {
31-
explicitwrapper_base_const(basic_message<Tag>const & message_)
28+
explicitwrapper_base_const(Messageconst & message_)
3229
: _message(message_)
3330
{}
3431

3532
protected:
3633
~wrapper_base_const() {};// for extending only
3734

38-
basic_message<Tag>const & _message;
35+
Messageconst & _message;
3936
};
4037

4138
}// namespace detail

‎boost/network/message.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace boost { namespace network {
4444
typedef Tag tag;
4545

4646
typedeftypename headers_container<Tag>::type headers_container_type;
47+
typedeftypename headers_container_type::value_type header_type;
4748
typedeftypename string<Tag>::type string_type;
4849

4950
basic_message()
@@ -125,7 +126,7 @@ namespace boost { namespace network {
125126
private:
126127

127128
friendstructdetail::directive_base<Tag> ;
128-
friendstructdetail::wrapper_base<Tag> ;
129+
friendstructdetail::wrapper_base<Tag, basic_message<Tag>> ;
129130

130131
mutable headers_container_type _headers;
131132
mutable string_type _body;

‎boost/network/message/directives.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
#ifndef __NETWORK_MESSAGE_DIRECTIVES_HPP__
88
#define__NETWORK_MESSAGE_DIRECTIVES_HPP__
99

10-
/** Include all the various directive headers.
11-
*/
12-
1310
#include<boost/network/message/directives/detail/string_directive.hpp>
1411
#include<boost/network/message/directives/header.hpp>
1512
#include<boost/network/message/directives/remove_header.hpp>

‎boost/network/message/directives/detail/string_directive.hpp

Lines changed: 37 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -10,134 +10,51 @@
1010
#include<boost/variant/variant.hpp>
1111
#include<boost/variant/apply_visitor.hpp>
1212
#include<boost/variant/static_visitor.hpp>
13+
#include<boost/network/support/is_pod.hpp>
14+
#include<boost/utility/enable_if.hpp>
1315
#include<boost/mpl/if.hpp>
1416
#include<boost/mpl/or.hpp>
15-
#include<boost/network/message/directives/detail/string_value.hpp>
1617

17-
namespaceboost {namespacenetwork {namespacedetail {
18-
19-
/** This directive template technically implements a decorator pattern
20-
* which takes a concrete implementation and uses that as a base. This
21-
* particular directive template requires the Base type to just include
22-
* a nested template named `string_visitor` that takes a single template
23-
* class parameter which is supposed to be a Message class/struct.
24-
*
25-
* A typical directive implementation of the visitor will take a reference
26-
* to a message as the constructor parameter and then performs operations
27-
* on that message.
28-
*
29-
* To create your own string directive, you can use the preprocessor macro
30-
* BOOST_NETWORK_STRING_DIRECTIVE which takes three parameters: the name of
31-
* the directive, a name for the variable to use in the directive visitor,
32-
* and the body to be implemented in the visitor. An example directive for
33-
* setting the source of a message would look something like this given the
34-
* BOOST_NETWORK_STRING_DIRECTIVE macro:
35-
*
36-
* BOOST_NETWORK_STRING_DIRECTIVE(source, source_,
37-
* message.source(source_)
38-
* , message.source=source_);
39-
*
40-
*/
41-
template<classBase>
42-
structstring_directive :publicBase {
43-
boost::variant<
44-
string<tags::default_string>::type,
45-
string<tags::default_wstring>::type,
46-
boost::shared_future<string<tags::default_string>::type>,
47-
boost::shared_future<string<tags::default_wstring>::type>
48-
> string_;
49-
50-
explicitstring_directive(string<tags::default_string>::typeconst & input)
51-
: string_(input) {}
52-
explicitstring_directive(string<tags::default_wstring>::typeconst & input)
53-
: string_(input) {}
54-
explicitstring_directive(boost::shared_future<string<tags::default_string>::type>const & input)
55-
: string_(input) {}
56-
explicitstring_directive(boost::shared_future<string<tags::default_wstring>::type>const & input)
57-
: string_(input) {}
58-
59-
string_directive(string_directiveconst & other)
60-
: string_(other.string_) {}
61-
62-
template<classTag,template<class>classMessage>
63-
voidoperator()(Message<Tag>const & message)const {
64-
apply_visitor(typename Base::template string_visitor<Message<Tag> >(message), string_);
65-
}
66-
};
18+
/**
19+
*
20+
* To create your own string directive, you can use the preprocessor macro
21+
* BOOST_NETWORK_STRING_DIRECTIVE which takes three parameters: the name of
22+
* the directive, a name for the variable to use in the directive visitor,
23+
* and the body to be implemented in the visitor. An example directive for
24+
* setting the source of a message would look something like this given the
25+
* BOOST_NETWORK_STRING_DIRECTIVE macro:
26+
*
27+
* BOOST_NETWORK_STRING_DIRECTIVE(source, source_,
28+
* message.source(source_)
29+
* , message.source=source_);
30+
*
31+
*/
6732

33+
#ifndef BOOST_NETWORK_STRING_DIRECTIVE
6834
#defineBOOST_NETWORK_STRING_DIRECTIVE(name, value, body, pod_body) \
69-
structname##_directive_base { \
70-
\
71-
template<classMessage> \
72-
structnormal_visitor : boost::static_visitor<> { \
73-
Messageconst & message; \
74-
explicitnormal_visitor(Messageconst & message) : \
75-
message(message) {} \
76-
voidoperator()( \
77-
typename boost::network::detail::string_value< \
78-
typename Message::tag \
79-
>::typeconst & value \
80-
)const { \
81-
body; \
82-
} \
83-
template<classT>voidoperator()(Tconst &)const { \
84-
} \
85-
}; \
86-
\
87-
template<classMessage> \
88-
structpod_visitor : boost::static_visitor<> { \
89-
Messageconst & message; \
90-
explicitpod_visitor(Messageconst & message) : \
91-
message(message) {} \
92-
voidoperator()( \
93-
typename boost::network::detail::string_value< \
94-
typename Message::tag \
95-
>::typeconst & value \
96-
)const { \
97-
pod_body; \
98-
} \
99-
template<classT>voidoperator()(Tconst &)const { \
100-
} \
101-
}; \
102-
\
103-
template<classMessage> \
104-
structstring_visitor : \
105-
mpl::if_< \
106-
is_base_of< \
107-
tags::pod, \
108-
typename Message::tag \
109-
>, \
110-
pod_visitor<Message>, \
111-
normal_visitor<Message> \
112-
>::type \
113-
{ \
114-
typedeftypename mpl::if_< \
115-
is_base_of< \
116-
tags::pod, \
117-
typename Message::tag \
118-
>, \
119-
pod_visitor<Message>, \
120-
normal_visitor<Message> \
121-
>::type base; \
122-
explicitstring_visitor(Messageconst & message): \
123-
base(message) {} \
124-
string_visitor(string_visitorconst & other): \
125-
base(other) {} \
126-
usingbase::operator(); \
127-
}; \
35+
template<classValueType> \
36+
structname##_directive { \
37+
ValueTypeconst & value; \
38+
explicit name##_directive(ValueTypeconst & value_) \
39+
: value(value_) {} \
40+
name##_directive(name##_directiveconst & other) \
41+
: value(other.value) {} \
42+
template<classTag,template<class>classMessage> \
43+
typename enable_if<is_pod<Tag>,void>::type \
44+
operator()(Message<Tag> & message)const { \
45+
pod_body; \
46+
} \
47+
template<classTag,template<class>classMessage> \
48+
typename enable_if<mpl::not_<is_pod<Tag> >,void>::type \
49+
operator()(Message<Tag> & message)const { \
50+
body; \
51+
} \
12852
}; \
12953
\
130-
typedef boost::network::detail::string_directive<name##_directive_base> \
131-
name##_directive; \
132-
template<classT>inline name##_directiveconst \
54+
template<classT>inline name##_directive<T> \
13355
name (Tconst & input) { \
134-
return name##_directive(input); \
56+
return name##_directive<T>(input); \
13557
}
136-
137-
}/* detail*/
138-
139-
}/* network*/
140-
141-
}/* boost*/
58+
#endif/* BOOST_NETWORK_STRING_DIRECTIVE*/
14259

14360
#endif/* BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp