Skip to content

Commit 8b0bb38

Browse files
committed
Use core::string_view directly instead of alias
Replace all uses of string_view and basic_string_view with core::string_view and core::basic_string_view respectively throughout the codebase. This improves clarity in both documentation and source code by explicitly showing that the library uses boost::core::string_view. The type aliases in string_type.hpp are retained for backward compatibility, but all internal usage now references the core:: qualified names directly. Changes include: - All header files (.hpp) - All inline implementation files (.ipp) - Example files (.cpp, .hpp) - Test files (.cpp, .hpp) - Documentation files (.qbk) Closes #3046
1 parent 67106eb commit 8b0bb38

111 files changed

Lines changed: 610 additions & 609 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ bin64/
55
Win32/
66
x64/
77

8+
replace_string_view.py

doc/qbk/04_http/08_chunked_encoding.qbk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ interface provided by __parser__:
179179
void
180180
callback(
181181
std::uint64_t size, // Size of the chunk, zero for the last chunk
182-
string_view extensions, // The chunk-extensions in raw form
182+
core::string_view extensions, // The chunk-extensions in raw form
183183
error_code& ec); // May be set by the callback to indicate an error
184184
```
185185
]
@@ -205,7 +205,7 @@ interface provided by __parser__:
205205
std::size_t
206206
callback(
207207
std::uint64_t remain, // Octets remaining in this chunk, includes `body`
208-
string_view body, // A buffer holding some or all of the remainder of the chunk body
208+
core::string_view body, // A buffer holding some or all of the remainder of the chunk body
209209
error_code& ec); // May be set by the callback to indicate an error
210210
```
211211
]

doc/qbk/07_concepts/Fields.qbk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In this table:
3030
* `c` denotes a (possibly const) value of type `F`.
3131
* `b` is a value of type `bool`
3232
* `n` is a value of type `boost::optional<std::uint64_t>`.
33-
* `s` is a value of type [link beast.ref.boost__beast__string_view `string_view`].
33+
* `s` is a value of type [link beast.ref.boost__beast__string_view `core::string_view`].
3434
* `v` is a value of type `unsigned int` representing the HTTP-version.
3535

3636
[table Valid expressions
@@ -43,7 +43,7 @@ In this table:
4343
]
4444
][
4545
[`c.get_method_impl()`]
46-
[`string_view`]
46+
[`core::string_view`]
4747
[
4848
Returns the method text.
4949
The implementation only calls this function for request
@@ -52,14 +52,14 @@ In this table:
5252
]
5353
][
5454
[`c.get_target_impl()`]
55-
[`string_view`]
55+
[`core::string_view`]
5656
[
5757
Returns the target string.
5858
The implementation only calls this function for request headers.
5959
]
6060
][
6161
[`c.get_reason_impl()`]
62-
[`string_view`]
62+
[`core::string_view`]
6363
[
6464
Returns the obsolete request text.
6565
The implementation only calls this for response headers when

doc/qbk/08_design/1_http_message.qbk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ struct header<true, Fields> : Fields
257257
int version;
258258

259259
verb method() const;
260-
string_view method_string() const;
260+
core::string_view method_string() const;
261261
void method(verb);
262-
void method(string_view);
262+
void method(core::string_view);
263263

264-
string_view target(); const;
265-
void target(string_view);
264+
core::string_view target(); const;
265+
void target(core::string_view);
266266

267267
private:
268268
verb method_;
@@ -274,8 +274,8 @@ struct header<false, Fields> : Fields
274274
{
275275
int version;
276276
int result;
277-
string_view reason() const;
278-
void reason(string_view);
277+
core::string_view reason() const;
278+
void reason(core::string_view);
279279
};
280280
```
281281

@@ -298,14 +298,14 @@ struct header<false, Fields> : Fields
298298
int version;
299299
int status;
300300

301-
string_view
301+
core::string_view
302302
reason() const
303303
{
304304
return this->reason_impl(); // protected member of Fields
305305
}
306306

307307
void
308-
reason(string_view s)
308+
reason(core::string_view s)
309309
{
310310
this->reason_impl(s); // protected member of Fields
311311
}

doc/qbk/release_notes.qbk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
[*Miscellaneous]
259259

260260
* [issue 2363] Remove `BOOST_BEAST_USE_STD_STRING_VIEW`
261-
* [issue 2417] use boost::core::string_view. This improves inter-conversion between string_view implementations. Some observable differences for users:
261+
* [issue 2417] use boost::core::string_view. This improves inter-conversion between core::string_view implementations. Some observable differences for users:
262262
* `core::string_view` no longer supports the `.to_string()` or `.clear()` extensions from Utility
263263
* code that relied on `.max_size()` returning `.size(),` needs to be fixed to use `.size()` instead
264264
* `remove_suffix()` and `remove_prefix()` were more lenient than the standard specs; be sure you don't rely on it clamping the argument to valid range
@@ -426,7 +426,7 @@
426426
* [issue 1956] Deprecate `string_param` (API Change)
427427
['Actions Required]
428428
`string_param`, which was previously the argument type when setting field values
429-
has been replaced by `string_view`. Because of this, it is no longer possible to
429+
has been replaced by `core::string_view`. Because of this, it is no longer possible to
430430
set message field values directly as integrals.
431431
Users are requied to convert numeric arguments to a string type prior to calling
432432
`fields::set` et. al.

example/doc/http_examples.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ response<empty_body>
376376
do_head_request(
377377
SyncStream& stream,
378378
DynamicBuffer& buffer,
379-
string_view target,
379+
core::string_view target,
380380
error_code& ec)
381381
{
382382
// Do some type checking to be a good citizen
@@ -979,7 +979,7 @@ print_chunked_body(
979979
// after each chunk header and also after the last chunk.
980980
auto header_cb =
981981
[&](std::uint64_t size, // Size of the chunk, or zero for the last chunk
982-
string_view extensions, // The raw chunk-extensions string. Already validated.
982+
core::string_view extensions, // The raw chunk-extensions string. Already validated.
983983
error_code& ev) // We can set this to indicate an error
984984
{
985985
// Parse the chunk extensions so we can access them easily
@@ -1008,7 +1008,7 @@ print_chunked_body(
10081008
// more times for each piece of a chunk body.
10091009
auto body_cb =
10101010
[&](std::uint64_t remain, // The number of bytes left in this chunk
1011-
string_view body, // A buffer holding chunk body data
1011+
core::string_view body, // A buffer holding chunk body data
10121012
error_code& ec) // We can set this to indicate an error
10131013
{
10141014
// If this is the last piece of the chunk body,

include/boost/beast/_experimental/test/impl/stream.ipp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ template<class Executor>
123123
basic_stream<Executor>::
124124
basic_stream(
125125
net::io_context& ioc,
126-
string_view s)
126+
core::string_view s)
127127
: in_(detail::stream_service::make_impl(ioc.get_executor(), nullptr))
128128
{
129129
in_->b.commit(net::buffer_copy(
@@ -136,7 +136,7 @@ basic_stream<Executor>::
136136
basic_stream(
137137
net::io_context& ioc,
138138
fail_count& fc,
139-
string_view s)
139+
core::string_view s)
140140
: in_(detail::stream_service::make_impl(ioc.get_executor(), &fc))
141141
{
142142
in_->b.commit(net::buffer_copy(
@@ -161,7 +161,7 @@ connect(basic_stream& remote)
161161
}
162162

163163
template<class Executor>
164-
string_view
164+
core::string_view
165165
basic_stream<Executor>::
166166
str() const
167167
{
@@ -175,7 +175,7 @@ str() const
175175
template<class Executor>
176176
void
177177
basic_stream<Executor>::
178-
append(string_view s)
178+
append(core::string_view s)
179179
{
180180
std::lock_guard<std::mutex> lock{in_->m};
181181
in_->b.commit(net::buffer_copy(

include/boost/beast/_experimental/test/stream.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class basic_stream
281281
*/
282282
basic_stream(
283283
net::io_context& ioc,
284-
string_view s);
284+
core::string_view s);
285285

286286
/** Construct a stream
287287
@@ -301,7 +301,7 @@ class basic_stream
301301
basic_stream(
302302
net::io_context& ioc,
303303
fail_count& fc,
304-
string_view s);
304+
core::string_view s);
305305

306306
/// Establish a connection
307307
void
@@ -333,12 +333,12 @@ class basic_stream
333333
}
334334

335335
/// Returns a string view representing the pending input data
336-
string_view
336+
core::string_view
337337
str() const;
338338

339339
/// Appends a string to the pending input data
340340
void
341-
append(string_view s);
341+
append(core::string_view s);
342342

343343
/// Clear the pending input area
344344
void

include/boost/beast/core/detail/impl/temporary_buffer.ipp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ namespace detail {
2323

2424
void
2525
temporary_buffer::
26-
append(string_view s)
26+
append(core::string_view s)
2727
{
2828
grow(s.size());
2929
unchecked_append(s);
3030
}
3131

3232
void
3333
temporary_buffer::
34-
append(string_view s1, string_view s2)
34+
append(core::string_view s1, core::string_view s2)
3535
{
3636
grow(s1.size() + s2.size());
3737
unchecked_append(s1);
@@ -40,7 +40,7 @@ append(string_view s1, string_view s2)
4040

4141
void
4242
temporary_buffer::
43-
unchecked_append(string_view s)
43+
unchecked_append(core::string_view s)
4444
{
4545
auto n = s.size();
4646
std::memcpy(&data_[size_], s.data(), n);

include/boost/beast/core/detail/static_ostream.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class static_ostream_buffer
5050
{
5151
}
5252

53-
string_view
53+
core::string_view
5454
str() const
5555
{
5656
if(! s_.empty())
@@ -128,7 +128,7 @@ class static_ostream : public std::basic_ostream<char>
128128
imbue(std::locale::classic());
129129
}
130130

131-
string_view
131+
core::string_view
132132
str() const
133133
{
134134
return osb_.str();

0 commit comments

Comments
 (0)