Skip to content

Commit b230c76

Browse files
committed
Run clang-format on message/
1 parent 28797ac commit b230c76

39 files changed

+615
-632
lines changed

message/src/network/detail/debug.hpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,26 @@
1616
The user can force the logging to be enabled by defining NETWORK_ENABLE_LOGGING.
1717
*/
1818
#if defined(NETWORK_DEBUG) && !defined(NETWORK_ENABLE_LOGGING)
19-
# define NETWORK_ENABLE_LOGGING
19+
#define NETWORK_ENABLE_LOGGING
2020
#endif
2121

2222
#ifdef NETWORK_ENABLE_LOGGING
2323

24-
# include <network/logging/logging.hpp>
25-
# ifndef NETWORK_MESSAGE
26-
# define NETWORK_MESSAGE(msg) { network::logging::log( network::logging::log_record( __FILE__, __LINE__ ) << msg ); }
27-
# endif
24+
#include <network/logging/logging.hpp>
25+
#ifndef NETWORK_MESSAGE
26+
#define NETWORK_MESSAGE(msg) \
27+
{ \
28+
network::logging::log(network::logging::log_record(__FILE__, __LINE__) \
29+
<< msg); \
30+
}
31+
#endif
2832

2933
#else
3034

31-
# ifndef NETWORK_MESSAGE
32-
# define NETWORK_MESSAGE(msg)
33-
# endif
34-
35+
#ifndef NETWORK_MESSAGE
36+
#define NETWORK_MESSAGE(msg)
3537
#endif
3638

39+
#endif
3740

3841
#endif /* end of include guard: NETWORK_DEBUG_HPP_20110410 */

message/src/network/detail/directive_base.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
/** Defines the base type from which all directives inherit
1212
* to allow friend access to message and other types' internals.
1313
*/
14-
namespace network { namespace detail {
14+
namespace network {
15+
namespace detail {} // namespace detail
1516

16-
} // namespace detail
17+
} // namespace network
1718

18-
} // namespace network
19-
20-
#endif // NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
19+
#endif // NETWORK_DETAIL_DIRECTIVE_BASE_HPP__

message/src/network/detail/wrapper_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
#ifndef NETWORK_DETAIL_WRAPPER_BASE_HPP__
99
#define NETWORK_DETAIL_WRAPPER_BASE_HPP__
1010

11-
#endif // NETWORK_DETAIL_WRAPPER_BASE_HPP__
11+
#endif // NETWORK_DETAIL_WRAPPER_BASE_HPP__
1212

message/src/network/message.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
#include <network/message/message_concept.hpp>
2929
#endif
3030

31-
#endif // NETWORK_MESSAGE_HPP_20111021
31+
#endif // NETWORK_MESSAGE_HPP_20111021

message/src/network/message/basic_message.hpp

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,36 @@ struct basic_storage_pimpl;
1616

1717
struct basic_storage_base : message_base {
1818
basic_storage_base();
19-
basic_storage_base(basic_storage_base const &);
20-
basic_storage_base(basic_storage_base &&);
21-
virtual void set_destination(std::string const & destination);
22-
virtual void set_source(std::string const & source);
23-
virtual void append_header(std::string const & name,
24-
std::string const & value);
25-
virtual void remove_headers(std::string const & name);
19+
basic_storage_base(basic_storage_base const&);
20+
basic_storage_base(basic_storage_base && );
21+
virtual void set_destination(std::string const& destination);
22+
virtual void set_source(std::string const& source);
23+
virtual void append_header(std::string const& name, std::string const& value);
24+
virtual void remove_headers(std::string const& name);
2625
virtual void remove_headers();
27-
virtual void set_body(std::string const & body);
28-
virtual void append_body(std::string const & data);
29-
30-
virtual void get_destination(std::string & destination);
31-
virtual void get_source(std::string & source);
32-
virtual void get_headers(function<void(std::string const &, std::string const &)> inserter);
33-
virtual void get_headers(std::string const & name, function<void(std::string const &, std::string const &)> inserter);
34-
virtual void get_body(std::string & body);
35-
virtual void get_body(function<void(iterator_range<char const *>)> chunk_reader, size_t size);
36-
37-
virtual void swap(basic_storage_base & other);
26+
virtual void set_body(std::string const& body);
27+
virtual void append_body(std::string const& data);
28+
29+
virtual void get_destination(std::string& destination);
30+
virtual void get_source(std::string& source);
31+
virtual void get_headers(
32+
function<void(std::string const&, std::string const&)> inserter);
33+
virtual void get_headers(
34+
std::string const& name,
35+
function<void(std::string const&, std::string const&)> inserter);
36+
virtual void get_body(std::string& body);
37+
virtual void get_body(
38+
function<void(iterator_range<char const*>)> chunk_reader,
39+
size_t size);
40+
41+
virtual void swap(basic_storage_base& other);
3842

3943
virtual ~basic_storage_base();
4044
protected:
4145
scoped_ptr<basic_storage_pimpl> pimpl;
4246
};
4347

44-
void swap(basic_storage_base & l, basic_storage_base & r);
48+
void swap(basic_storage_base& l, basic_storage_base& r);
4549

4650
} // namespace network
4751

message/src/network/message/basic_message.ipp

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace network {
1111

1212
struct basic_storage_pimpl {
1313
basic_storage_pimpl();
14-
basic_storage_pimpl(basic_storage_pimpl const &);
14+
basic_storage_pimpl(basic_storage_pimpl const&);
1515

1616
virtual basic_storage_pimpl* clone();
1717
protected:
@@ -23,88 +23,85 @@ struct basic_storage_pimpl {
2323
};
2424

2525
basic_storage_base::basic_storage_base()
26-
: pimpl(new (std::nothrow) basic_storage_pimpl())
27-
{}
26+
: pimpl(new (std::nothrow) basic_storage_pimpl()) {}
2827

29-
basic_storage_base::basic_storage_base(basic_storage_base const & other)
30-
: pimpl(other.clone())
31-
{}
28+
basic_storage_base::basic_storage_base(basic_storage_base const& other)
29+
: pimpl(other.clone()) {}
3230

33-
void basic_storage_base::set_destination(std::string const & destination) {
31+
void basic_storage_base::set_destination(std::string const& destination) {
3432
pimpl->destination_ = destination;
3533
}
3634

37-
void basic_storage_base::set_source(std::string const & source) {
35+
void basic_storage_base::set_source(std::string const& source) {
3836
pimpl->source_ = source;
3937
}
4038

41-
void basic_storage_base::append_header(std::string const & name,
42-
std::string const & value) {
39+
void basic_storage_base::append_header(std::string const& name,
40+
std::string const& value) {
4341
pimpl->headers_.insert(std::make_pair(name, value));
4442
}
4543

46-
void basic_storage_base::remove_headers(std::string const & name) {
44+
void basic_storage_base::remove_headers(std::string const& name) {
4745
pimpl->headers_.erase(name);
4846
}
4947

5048
void basic_storage_base::remove_headers() {
5149
basic_storage_pimpl::headers_container_type().swap(pimpl->headers_);
5250
}
5351

54-
void basic_storage_base::set_body(std::string const & body) {
52+
void basic_storage_base::set_body(std::string const& body) {
5553
pimpl->body = body;
5654
}
5755

58-
void basic_storage_base::append_body(std::string const & data) {
56+
void basic_storage_base::append_body(std::string const& data) {
5957
pimpl->body.append(data);
6058
}
6159

62-
void basic_storage_base::get_destination(std::string & destination) {
60+
void basic_storage_base::get_destination(std::string& destination) {
6361
destination = pimpl->destination;
6462
}
6563

66-
void basic_storage_base::get_source(std::string & source) {
64+
void basic_storage_base::get_source(std::string& source) {
6765
source = pimpl->source;
6866
}
6967

70-
void basic_storage_base::get_headers(function<void(std::string const &, std::string const &)> inserter) {
68+
void basic_storage_base::get_headers(
69+
function<void(std::string const&, std::string const&)> inserter) {
7170
copy(pimpl->headers_, inserter);
7271
}
7372

74-
void basic_storage_base::get_headers(std::string const & name, function<void(std::string const &, std::string const &)> inserter) {
75-
basic_storage_pimpl::headers_container_type::const_iterator
76-
it = pimpl->headers_.find(name),
77-
pe = pimpl->headers_.end();
73+
void basic_storage_base::get_headers(
74+
std::string const& name,
75+
function<void(std::string const&, std::string const&)> inserter) {
76+
basic_storage_pimpl::headers_container_type::const_iterator it =
77+
pimpl->headers_.find(name), pe = pimpl->headers_.end();
7878
for (; it != pe; ++it)
7979
inserter(it->first, it->second);
8080
}
8181

82-
void basic_storage_base::get_body(std::string & body) {
82+
void basic_storage_base::get_body(std::string& body) {
8383
// TODO use iostreams!
8484
body = pimpl_->body;
8585
}
8686

87-
void basic_storage_base::get_body(function<void(iterator_range<char const *>)> chunk_reader, size_t size) {
87+
void basic_storage_base::get_body(
88+
function<void(iterator_range<char const*>)> chunk_reader,
89+
size_t size) {
8890
// TODO use iostreams!
89-
std::string::const_iterator it = pimpl->body.begin(),
90-
pe = pimpl->body.end();
91+
std::string::const_iterator it = pimpl->body.begin(), pe = pimpl->body.end();
9192
std::advance(it, size);
9293
chunk_reader(make_iterator_range(it, pe));
9394
pimpl->body.assign(it, pe);
9495
}
9596

96-
basic_storage_base::~basic_storage_base() {
97-
pimpl->reset();
98-
}
97+
basic_storage_base::~basic_storage_base() { pimpl->reset(); }
9998

100-
void basic_storage_base::swap(basic_storage_base & other) {
99+
void basic_storage_base::swap(basic_storage_base& other) {
101100
std::swap(pimpl, other.pimpl);
102101
}
103102

104-
void swap(basic_storage_base & l, basic_storage_base & r) {
105-
l.swap(r);
106-
}
103+
void swap(basic_storage_base& l, basic_storage_base& r) { l.swap(r); }
107104

108105
} /* network */
109-
106+
110107
#endif /* NETWORK_MESSAGE_BASIC_MESSAGE_IPP_20110911 */

message/src/network/message/directives.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ NETWORK_STRING_DIRECTIVE(source);
1717
NETWORK_STRING_DIRECTIVE(destination);
1818
NETWORK_STRING_DIRECTIVE(body);
1919

20-
} // namespace network
20+
} // namespace network
2121

22-
#endif // NETWORK_MESSAGE_DIRECTIVES_HPP__
22+
#endif // NETWORK_MESSAGE_DIRECTIVES_HPP__

message/src/network/message/directives/detail/string_directive.hpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,20 @@
2727
//
2828

2929
#ifndef NETWORK_STRING_DIRECTIVE
30-
#define NETWORK_STRING_DIRECTIVE(name) \
31-
struct name##_directive { \
32-
std::string const & value; \
33-
explicit name##_directive(std::string const & value_) \
34-
: value(value_) {} \
35-
name##_directive(name##_directive const & other) \
36-
: value(other.value) {} \
37-
template <class Message> \
38-
void operator()(Message & message) const { \
39-
message.set_##name(value); \
40-
} \
41-
}; \
42-
\
43-
inline name##_directive const \
44-
name (std::string const & input) { \
45-
return name##_directive(input); \
46-
}
30+
#define NETWORK_STRING_DIRECTIVE(name) \
31+
struct name##_directive { \
32+
std::string const& value; \
33+
explicit name##_directive(std::string const& value_) : value(value_) {} \
34+
name##_directive(name##_directive const& other) : value(other.value) {} \
35+
template <class Message> void operator()(Message& message) const { \
36+
message.set_##name(value); \
37+
} \
38+
} \
39+
;
40+
41+
inline name##_directive const name(std::string const& input) {
42+
return name##_directive(input);
43+
}
4744
#endif /* NETWORK_STRING_DIRECTIVE */
4845

4946
#endif /* NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_DIRECTIVE_HPP_20100915 */

message/src/network/message/directives/detail/string_value.hpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,18 @@
1515
#include <boost/mpl/if.hpp>
1616
#include <boost/mpl/or.hpp>
1717

18-
namespace network { namespace detail {
18+
namespace network {
19+
namespace detail {
1920

2021
template <class Tag>
21-
struct string_value :
22-
mpl::if_<
23-
is_async<Tag>,
24-
boost::shared_future<typename string<Tag>::type>,
25-
typename mpl::if_<
26-
mpl::or_<
27-
is_sync<Tag>,
28-
is_same<Tag, tags::default_string>,
29-
is_same<Tag, tags::default_wstring>
30-
>,
31-
typename string<Tag>::type,
32-
unsupported_tag<Tag>
33-
>::type
34-
>
35-
{};
22+
struct string_value
23+
: mpl::if_<is_async<Tag>,
24+
boost::shared_future<typename string<Tag>::type>,
25+
typename mpl::if_<mpl::or_<is_sync<Tag>,
26+
is_same<Tag, tags::default_string>,
27+
is_same<Tag, tags::default_wstring>>,
28+
typename string<Tag>::type,
29+
unsupported_tag<Tag>>::type> {};
3630

3731
} // namespace detail
3832
} // namespace network

message/src/network/message/directives/header.hpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,20 @@ namespace network {
1414
namespace impl {
1515

1616
struct header_directive {
17-
explicit header_directive(std::string const & name,
18-
std::string const & value);
19-
void operator() (message_base & msg) const;
17+
explicit header_directive(std::string const& name, std::string const& value);
18+
void operator()(message_base& msg) const;
2019
private:
21-
std::string const & name_;
22-
std::string const & value_;
20+
std::string const& name_;
21+
std::string const& value_;
2322
};
2423

25-
} // namespace impl
24+
} // namespace impl
2625

27-
inline impl::header_directive
28-
header(std::string const & header_name, std::string const & header_value) {
29-
return impl::header_directive(header_name, header_value);
26+
inline impl::header_directive header(std::string const& header_name,
27+
std::string const& header_value) {
28+
return impl::header_directive(header_name, header_value);
3029
}
3130

32-
} // namespace network
31+
} // namespace network
3332

34-
#endif // NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__
33+
#endif // NETWORK_MESSAGE_DIRECTIVES_HEADER_HPP__

0 commit comments

Comments
 (0)