Skip to content

Commit f4bcc0f

Browse files
committed
Update documentation
1 parent c4678bf commit f4bcc0f

File tree

5 files changed

+52
-3
lines changed

5 files changed

+52
-3
lines changed

doc/uuid/changes.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Added SIMD implementation of `to_chars`, which can offer up to 5.5x performance improvement in UUID formatting. (Andrey Semashev)
1313
* Added SIMD implementation of `from_chars`, which can offer up to 13x performance improvement in UUID parsing. (Andrey Semashev)
1414
* Added `uuid_from_string` to `boost/uuid/uuid_io.hpp`.
15+
* Added a dedicated `invalid_uuid` exception class, derived from `std::runtime_error` for backward compatibility.
1516

1617
== Changes in Boost 1.90.0
1718

doc/uuid/invalid_uuid.adoc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[#invalid_uuid]
2+
== <boost/uuid/invalid_uuid.hpp>
3+
4+
:idprefix: invalid_uuid_
5+
6+
=== Synopsis
7+
8+
[source,c++]
9+
----
10+
namespace boost {
11+
namespace uuids {
12+
13+
class invalid_uuid: public std::runtime_error
14+
{
15+
public:
16+
17+
invalid_uuid( std::ptrdiff_t pos, from_chars_error err );
18+
19+
std::ptrdiff_t position() const noexcept;
20+
from_chars_error error() const noexcept;
21+
};
22+
23+
}} // namespace boost::uuids
24+
----
25+
26+
=== invalid_uuid
27+
28+
Functions that parse a string UUID representation throw an exception of type `invalid_uuid` to indicate failure.
29+
30+
```
31+
invalid_uuid( std::ptrdiff_t pos, from_chars_error err );
32+
```
33+
34+
Effects: :: Constructs an `invalid_uuid` object, initializing its internal members to `pos` and `err` and the `runtime_error` base class with an appropriate error message.
35+
Postconditions: :: `this\->position() == pos && this\->error() == err`.
36+
37+
```
38+
std::ptrdiff_t position() const noexcept;
39+
```
40+
41+
Returns: :: The zero-based position in the input string at which parsing failed.
42+
43+
```
44+
from_chars_error error() const noexcept;
45+
```
46+
47+
Returns: :: The error code describing the reason parsing failed.

doc/uuid/reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
include::uuid_all.adoc[]
55
include::uuid.adoc[]
66
include::uuid_io.adoc[]
7+
include::invalid_uuid.adoc[]
78
include::generators.adoc[]
89
include::nil_generator.adoc[]
910
include::string_generator.adoc[]

doc/uuid/string_generator.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
5252
{hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh}
5353
```
5454

55-
Invalid input will generate a `std::runtime_error` exception.
55+
Invalid input will throw an `invalid_uuid` exception.
5656

5757
```
5858
template<class Str>

doc/uuid/uuid_io.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Requires: :: `Ch` must be a character type (one of `char`, `wchar_t`, `char8_t`,
285285

286286
Effects: ::
287287
Parses a `uuid` string representation from the characters in the range `[str, str + std::char_traits<Ch>::length(str))` and stores the result in `u`.
288-
On error, throws `std::runtime_error`.
288+
On error, throws `invalid_uuid`.
289289

290290
NOTE: Unlike `from_chars`, this function does not allow extra input; if after a complete UUID is parsed, unconsumed characters remain, an exception is thrown.
291291

@@ -300,6 +300,6 @@ Requires: ::
300300

301301
Effects: ::
302302
Parses a `uuid` string representation from the characters in the range `[str.data(), str.data() + str.size())` and stores the result in `u`.
303-
On error, throws `std::runtime_error`.
303+
On error, throws `invalid_uuid`.
304304

305305
NOTE: Unlike `from_chars`, this function does not allow extra input; if after a complete UUID is parsed, unconsumed characters remain, an exception is thrown.

0 commit comments

Comments
 (0)