Skip to content

Commit cc58c81

Browse files
committed
Apply codestyle to all files
1 parent 0046c4f commit cc58c81

19 files changed

+319
-404
lines changed

include/network/optional.hpp

Lines changed: 113 additions & 121 deletions
Large diffs are not rendered by default.

include/network/string_view.hpp

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class basic_string_view {
2727
public:
2828
typedef traits traits_type;
2929
typedef charT value_type;
30-
typedef charT* pointer;
31-
typedef const charT* const_pointer;
32-
typedef charT& reference;
33-
typedef const charT& const_reference;
34-
typedef const charT* const_iterator;
30+
typedef charT *pointer;
31+
typedef const charT *const_pointer;
32+
typedef charT &reference;
33+
typedef const charT &const_reference;
34+
typedef const charT *const_iterator;
3535
typedef const_iterator iterator;
3636
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
3737
typedef const_reverse_iterator reverse_iterator;
@@ -47,32 +47,31 @@ class basic_string_view {
4747
/**
4848
* \brief Copy constructor.
4949
*/
50-
constexpr basic_string_view(const basic_string_view&) noexcept = default;
50+
constexpr basic_string_view(const basic_string_view &) noexcept = default;
5151

5252
/**
5353
* \brief Assignment operator.
5454
*/
55-
basic_string_view& operator=(const basic_string_view&) noexcept = default;
55+
basic_string_view &operator=(const basic_string_view &) noexcept = default;
5656

5757
/**
5858
* \brief Constructor.
5959
*/
6060
template <class Allocator>
6161
basic_string_view(
62-
const std::basic_string<charT, traits, Allocator>& str) noexcept
63-
: data_(str.data()),
64-
size_(str.size()) {}
62+
const std::basic_string<charT, traits, Allocator> &str) noexcept
63+
: data_(str.data()), size_(str.size()) {}
6564

6665
/**
6766
* \brief Constructor.
6867
*/
69-
constexpr basic_string_view(const charT* str)
68+
constexpr basic_string_view(const charT *str)
7069
: data_(str), size_(traits::length(str)) {}
7170

7271
/**
7372
* \brief Constructor.
7473
*/
75-
constexpr basic_string_view(const charT* str, size_type len)
74+
constexpr basic_string_view(const charT *str, size_type len)
7675
: data_(str), size_(len) {}
7776

7877
constexpr const_iterator begin() const noexcept { return data_; }
@@ -133,7 +132,7 @@ class basic_string_view {
133132

134133
void remove_suffix(size_type n) { size_ -= n; }
135134

136-
void swap(basic_string_view& s) noexcept {
135+
void swap(basic_string_view &s) noexcept {
137136
std::swap(data_, s.data_);
138137
std::swap(size_, s.size_);
139138
}
@@ -145,11 +144,11 @@ class basic_string_view {
145144

146145
template <class Allocator = std::allocator<charT>>
147146
std::basic_string<charT, traits, Allocator> to_string(
148-
const Allocator& a = Allocator()) const {
147+
const Allocator &a = Allocator()) const {
149148
return std::basic_string<charT, traits, Allocator>(begin(), end(), a);
150149
}
151150

152-
size_type copy(charT* s, size_type n, size_type pos = 0) const {
151+
size_type copy(charT *s, size_type n, size_type pos = 0) const {
153152
size_type rlen = std::min(n, size() - pos);
154153
std::copy_n(begin() + pos, rlen, s);
155154
return rlen;
@@ -179,15 +178,15 @@ class basic_string_view {
179178
return substr(pos1, n1).compare(s.substr(pos2, n2));
180179
}
181180

182-
constexpr int compare(const charT* s) const {
181+
constexpr int compare(const charT *s) const {
183182
return compare(basic_string_view(s));
184183
}
185184

186-
constexpr int compare(size_type pos1, size_type n1, const charT* s) const {
185+
constexpr int compare(size_type pos1, size_type n1, const charT *s) const {
187186
return substr(pos1, n1).compare(basic_string_view(s));
188187
}
189188

190-
constexpr int compare(size_type pos1, size_type n1, const charT* s,
189+
constexpr int compare(size_type pos1, size_type n1, const charT *s,
191190
size_type n2) const {
192191
return substr(pos1, n1).compare(basic_string_view(s, n2));
193192
}
@@ -261,8 +260,8 @@ constexpr bool operator>=(basic_string_view<charT, traits> lhs,
261260
* \brief Output stream operator.
262261
*/
263262
template <class charT, class traits>
264-
std::basic_ostream<charT, traits>& operator<<(
265-
std::basic_ostream<charT, traits>& os,
263+
std::basic_ostream<charT, traits> &operator<<(
264+
std::basic_ostream<charT, traits> &os,
266265
basic_string_view<charT, traits> str) {
267266
return os << str.to_string();
268267
}

include/network/uri.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
#include <network/uri/uri.hpp>
3636
#include <network/uri/uri_io.hpp>
3737

38-
#endif // NETWORK_URI_HPP
38+
#endif // NETWORK_URI_HPP

include/network/uri/config.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
/**
99
* \file
10-
* \brief Contains macros to configure compiler or platform-specific workarounds.
10+
* \brief Contains macros to configure compiler or platform-specific
11+
* workarounds.
1112
*/
1213

1314
#ifndef NETWORK_URI_CONFIG_INC
@@ -17,4 +18,4 @@
1718
#define NETWORK_URI_MSVC _MSC_VER
1819
#endif // _MSC_VER
1920

20-
#endif // NETWORK_URI_CONFIG_INC
21+
#endif // NETWORK_URI_CONFIG_INC

include/network/uri/detail/encode.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ void percent_encode(charT in, OutputIterator &out) {
3838

3939
template <class charT>
4040
bool is_unreserved(charT in) {
41+
// clang-format off
4142
return ((in >= 'a') && (in <= 'z')) ||
4243
((in >= 'A') && (in <= 'Z')) ||
4344
((in >= '0') && (in <= '9')) ||
4445
(in == '-') ||
4546
(in == '.') ||
4647
(in == '_') ||
4748
(in == '~');
49+
// clang-format on
4850
}
4951

5052
template <class charT, class OutputIterator>

include/network/uri/detail/uri_parts.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ class uri_part {
4141
return first;
4242
}
4343

44-
difference_type length() const noexcept {
45-
return last - first;
46-
}
44+
difference_type length() const noexcept { return last - first; }
4745

48-
string_view to_string_view() const noexcept { return string_view(ptr(), length()); }
46+
string_view to_string_view() const noexcept {
47+
return string_view(ptr(), length());
48+
}
4949

5050
private:
5151
const_iterator first, last;

include/network/uri/uri.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <functional>
1919
#include <memory>
2020
#include <string>
21-
#include <cstdlib>
2221
#include <network/string_view.hpp>
2322
#include <network/optional.hpp>
2423
#include <network/uri/config.hpp>
@@ -577,8 +576,8 @@ class uri {
577576
* \returns The iterator at the end + 1th in the output sequence.
578577
*/
579578
template <typename InputIter, typename OutputIter>
580-
static OutputIter encode_query_component(
581-
InputIter first, InputIter last, OutputIter out) {
579+
static OutputIter encode_query_component(InputIter first, InputIter last,
580+
OutputIter out) {
582581
return detail::encode_query_component(first, last, out);
583582
}
584583

@@ -594,10 +593,11 @@ class uri {
594593
* \returns The iterator at the end + 1th in the output sequence.
595594
*/
596595
template <typename InputIter, typename OutputIter>
597-
static OutputIter encode_query_key_value_pair(
598-
InputIter key_first, InputIter key_last,
599-
InputIter value_first, InputIter value_last,
600-
OutputIter out) {
596+
static OutputIter encode_query_key_value_pair(InputIter key_first,
597+
InputIter key_last,
598+
InputIter value_first,
599+
InputIter value_last,
600+
OutputIter out) {
601601
out = detail::encode_query_component(key_first, key_last, out);
602602
out++ = '=';
603603
return detail::encode_query_component(value_first, value_last, out);
@@ -676,8 +676,8 @@ inline uri make_uri(const Source &source, std::error_code &ec) {
676676
void swap(uri &lhs, uri &rhs) noexcept;
677677

678678
/**
679-
* \brief Equality operator for the \c uri.
680-
*/
679+
* \brief Equality operator for the \c uri.
680+
*/
681681
bool operator==(const uri &lhs, const uri &rhs) noexcept;
682682

683683
/**

include/network/uri/uri_errors.hpp

Lines changed: 69 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -15,108 +15,99 @@
1515
#include <network/uri/config.hpp>
1616

1717
#ifdef NETWORK_URI_MSVC
18-
# pragma warning(push)
19-
# pragma warning(disable : 4251 4231 4660)
20-
// Disable C4275 too because it's "essentially noise and can be silenced"
21-
// according to Stephen T. Lavavej at Microsoft. See:
22-
// https://connect.microsoft.com/VisualStudio/feedback/details/696593/vc-10-vs-2010-basic-string-exports.
23-
# pragma warning(disable : 4275)
18+
#pragma warning(push)
19+
#pragma warning(disable : 4251 4231 4660)
20+
// Disable C4275 too because it's "essentially noise and can be silenced"
21+
// according to Stephen T. Lavavej at Microsoft. See:
22+
// https://connect.microsoft.com/VisualStudio/feedback/details/696593/vc-10-vs-2010-basic-string-exports.
23+
#pragma warning(disable : 4275)
2424
#endif
2525

2626
namespace network {
2727

2828
#if !defined(DOXYGEN_SHOULD_SKIP_THIS)
29-
enum class uri_error {
29+
enum class uri_error {
3030

31-
// parser errors
32-
invalid_syntax = 1,
31+
// parser errors
32+
invalid_syntax = 1,
3333

34-
// builder errors
35-
invalid_uri,
36-
invalid_scheme,
37-
invalid_user_info,
38-
invalid_host,
39-
invalid_port,
40-
invalid_path,
41-
invalid_query,
42-
invalid_fragment,
34+
// builder errors
35+
invalid_uri,
36+
invalid_scheme,
37+
invalid_user_info,
38+
invalid_host,
39+
invalid_port,
40+
invalid_path,
41+
invalid_query,
42+
invalid_fragment,
4343

44-
// encoding errors
45-
not_enough_input,
46-
non_hex_input,
47-
conversion_failed,
48-
};
44+
// encoding errors
45+
not_enough_input,
46+
non_hex_input,
47+
conversion_failed,
48+
};
4949

50-
const std::error_category &uri_category();
50+
const std::error_category &uri_category();
5151

52-
std::error_code make_error_code(uri_error e);
53-
#endif // !defined(DOXYGEN_SHOULD_SKIP_THIS)
52+
std::error_code make_error_code(uri_error e);
53+
#endif // !defined(DOXYGEN_SHOULD_SKIP_THIS)
5454

55+
/**
56+
* \class uri_syntax_error uri.hpp network/uri.hpp
57+
* \brief An exception thrown by the \c uri constructor when a URI
58+
* cannot be parsed.
59+
*/
60+
class uri_syntax_error : public std::system_error {
61+
public:
5562
/**
56-
* \class uri_syntax_error uri.hpp network/uri.hpp
57-
* \brief An exception thrown by the \c uri constructor when a URI
58-
* cannot be parsed.
63+
* \brief Constructor.
5964
*/
60-
class uri_syntax_error : public std::system_error {
61-
62-
public:
63-
64-
/**
65-
* \brief Constructor.
66-
*/
67-
uri_syntax_error();
68-
69-
/**
70-
* \brief Destructor.
71-
*/
72-
virtual ~uri_syntax_error() noexcept;
73-
74-
};
65+
uri_syntax_error();
7566

7667
/**
77-
* \class uri_builder_error uri.hpp network/uri.hpp
78-
* \brief An exception thrown when the \c uri_builder cannot build a
79-
* valid URI.
68+
* \brief Destructor.
8069
*/
81-
class uri_builder_error : public std::system_error {
82-
83-
public:
84-
85-
/**
86-
* \brief Constructor.
87-
*/
88-
uri_builder_error();
89-
90-
/**
91-
* \brief Destructor.
92-
*/
93-
virtual ~uri_builder_error() noexcept;
94-
95-
};
70+
virtual ~uri_syntax_error() noexcept;
71+
};
9672

73+
/**
74+
* \class uri_builder_error uri.hpp network/uri.hpp
75+
* \brief An exception thrown when the \c uri_builder cannot build a
76+
* valid URI.
77+
*/
78+
class uri_builder_error : public std::system_error {
79+
public:
9780
/**
98-
* \class percent_decoding_error uri.hpp network/uri.hpp
99-
* \brief An exception thrown when during percent decoding.
81+
* \brief Constructor.
10082
*/
101-
class percent_decoding_error : public std::system_error {
102-
103-
public:
83+
uri_builder_error();
10484

105-
/**
106-
* \brief Constructor.
107-
*/
108-
explicit percent_decoding_error(uri_error error);
85+
/**
86+
* \brief Destructor.
87+
*/
88+
virtual ~uri_builder_error() noexcept;
89+
};
10990

110-
/**
111-
* \brief Destructor.
112-
*/
113-
virtual ~percent_decoding_error() noexcept;
91+
/**
92+
* \class percent_decoding_error uri.hpp network/uri.hpp
93+
* \brief An exception thrown when during percent decoding.
94+
*/
95+
class percent_decoding_error : public std::system_error {
96+
public:
97+
/**
98+
* \brief Constructor.
99+
*/
100+
explicit percent_decoding_error(uri_error error);
114101

115-
};
116-
} // namespace network
102+
/**
103+
* \brief Destructor.
104+
*/
105+
virtual ~percent_decoding_error() noexcept;
106+
};
107+
} // namespace network
117108

118109
#ifdef NETWORK_URI_MSVC
119110
#pragma warning(pop)
120111
#endif
121112

122-
#endif // NETWORK_URI_ERRORS_INC
113+
#endif // NETWORK_URI_ERRORS_INC

0 commit comments

Comments
 (0)