Skip to content

Commit e1c9031

Browse files
committed
chore: op<< is dll exported
1 parent be06301 commit e1c9031

File tree

4 files changed

+33
-47
lines changed

4 files changed

+33
-47
lines changed

include/boost/url/ipv4_address.hpp

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -313,29 +313,30 @@ class ipv4_address
313313
return ipv4_address(0xFFFFFFFF);
314314
}
315315

316-
/** Format the address to an output stream.
317-
318-
IPv4 addresses written to output streams
319-
are written in their dotted decimal format.
316+
/** Format the address to an output stream.
320317
321-
@param os The output stream.
318+
IPv4 addresses written to output streams
319+
are written in their dotted decimal format.
322320
323-
@param addr The address to format.
324-
*/
321+
@param os The output stream.
322+
@param addr The address to format.
323+
@return The output stream.
324+
*/
325325
friend
326326
std::ostream&
327327
operator<<(
328328
std::ostream& os,
329329
ipv4_address const& addr)
330330
{
331-
char buf[ipv4_address::max_str_len];
332-
os << addr.to_buffer(buf, sizeof(buf));
331+
addr.write_ostream(os);
333332
return os;
334333
}
335334

336335
private:
337336
friend class ipv6_address;
338337

338+
BOOST_URL_DECL void write_ostream(std::ostream&) const;
339+
339340
BOOST_URL_DECL
340341
std::size_t
341342
print_impl(
@@ -349,20 +350,6 @@ class ipv4_address
349350
uint_type addr_ = 0;
350351
};
351352

352-
/** Format the address to an output stream.
353-
354-
IPv4 addresses written to output streams
355-
are written in their dotted decimal format.
356-
357-
@param os The output stream.
358-
@param addr The address to format.
359-
@return The output stream.
360-
*/
361-
std::ostream&
362-
operator<<(
363-
std::ostream& os,
364-
ipv4_address const& addr);
365-
366353
//------------------------------------------------
367354

368355
/** Return an IPv4 address from an IP address string in dotted decimal form

include/boost/url/ipv6_address.hpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,8 @@ class ipv6_address
345345

346346
/** Format the address to an output stream
347347
348-
This hidden friend function writes the
349-
address to an output stream using
350-
standard notation.
348+
This function writes the address to an
349+
output stream using standard notation.
351350
352351
@return The output stream, for chaining.
353352
@@ -361,15 +360,13 @@ class ipv6_address
361360
std::ostream& os,
362361
ipv6_address const& addr)
363362
{
364-
char buf[ipv6_address::max_str_len];
365-
auto const s = addr.to_buffer(
366-
buf, sizeof(buf));
367-
os << s;
363+
addr.write_ostream(os);
368364
return os;
369365
}
370366

371-
372367
private:
368+
BOOST_URL_DECL void write_ostream(std::ostream&) const;
369+
373370
BOOST_URL_DECL
374371
std::size_t
375372
print_impl(
@@ -383,22 +380,6 @@ class ipv6_address
383380
bytes_type addr_{{}};
384381
};
385382

386-
/** Format the address to an output stream
387-
388-
This function writes the address to an
389-
output stream using standard notation.
390-
391-
@return The output stream, for chaining.
392-
393-
@param os The output stream to write to.
394-
395-
@param addr The address to write.
396-
*/
397-
std::ostream&
398-
operator<<(
399-
std::ostream& os,
400-
ipv6_address const& addr);
401-
402383
//------------------------------------------------
403384

404385
/** Parse a string containing an IPv6 address.

src/ipv4_address.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ is_multicast() const noexcept
101101
0xE0000000;
102102
}
103103

104+
void
105+
ipv4_address::
106+
write_ostream(std::ostream& os) const
107+
{
108+
char buf[ipv4_address::max_str_len];
109+
os << to_buffer(buf, sizeof(buf));
110+
}
111+
104112
std::size_t
105113
ipv4_address::
106114
print_impl(

src/ipv6_address.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ loopback() noexcept
9696
return a;
9797
}
9898

99+
void
100+
ipv6_address::
101+
write_ostream(
102+
std::ostream& os) const
103+
{
104+
char buf[ipv6_address::max_str_len];
105+
auto const s = to_buffer(buf, sizeof(buf));
106+
os << s;
107+
}
108+
99109
std::size_t
100110
ipv6_address::
101111
print_impl(

0 commit comments

Comments
 (0)