|
3 | 3 |
|
4 | 4 | .. class:: ctll::fixed_string
|
5 | 5 |
|
6 |
| - *Some documentation* |
| 6 | + A compile-time fixed string. |
7 | 7 |
|
8 | 8 | Example: ::
|
9 | 9 |
|
|
15 | 15 |
|
16 | 16 | .. class:: template<class Iterator, class... Captures> ctre::regex_results
|
17 | 17 |
|
18 |
| - .. function:: template<size_t Id> constexpr auto get() |
19 |
| - template<class Id> constexpr auto get() |
| 18 | + .. type:: char_type = typename std::iterator_traits<Iterator>::value_type |
20 | 19 |
|
21 |
| - Returns the capture specified by ``Id``. |
| 20 | + The character type used by the ``Iterator``. |
| 21 | + |
| 22 | + .. function:: template<size_t Id> constexpr captured_content<Id, void>::storage<Iterator> get() |
| 23 | + template<class Name> constexpr captured_content<deduced, Name>::storage<Iterator> get() |
| 24 | + template<ctll::fixed_string Name> constexpr captured_content<deduced, Name>::storage<Iterator> get() |
| 25 | + |
| 26 | + Returns the capture specified by ``Id`` or ``Name``. ID ``0`` is the full match, ID ``1`` is the first capture group, ID ``2`` is the second, etc. |
| 27 | + Named groups are specified using ``(?<name>)``. |
| 28 | + |
| 29 | + Example: :: |
| 30 | + |
| 31 | + if (auto m = ctre::match<"(?<chars>[a-z]+([0-9]+)">("abc123")) { |
| 32 | + //TODO I can't seem to get named captures to work |
| 33 | + m.get<2>(); //123 |
| 34 | + } |
22 | 35 |
|
23 | 36 | .. function:: constexpr size_t size()
|
24 | 37 |
|
25 | 38 | Returns the number of captures in this result object.
|
26 | 39 |
|
27 |
| -.. function:: template<class... Args> constexpr ctre::regex_results<deduced> match(Args&&... args) |
| 40 | + .. function:: constexpr operator bool() const noexcept |
| 41 | + |
| 42 | + Returns whether the match was successful. |
| 43 | + |
| 44 | + .. function:: constexpr operator std::basic_string_view<char_type>() const noexcept |
| 45 | + constexpr std::basic_string_view<char_type> to_view() const noexcept |
| 46 | + constexpr std::basic_string_view<char_type> view() const noexcept |
| 47 | + |
| 48 | + Converts the match to a string view. |
| 49 | + |
| 50 | + .. function:: constexpr explicit operator std::basic_string<char_type>() const noexcept |
| 51 | + constexpr std::basic_string<char_type> to_string() const noexcept |
| 52 | + constexpr std::basic_string<char_type> str() const noexcept |
| 53 | + |
| 54 | + Converts the match to a string view. |
| 55 | + |
| 56 | + .. function:: constexpr auto operator*() const noexcept |
| 57 | + constexpr auto operator*() noexcept |
| 58 | + |
| 59 | + TODO I can't tell what these are supposed to do. |
| 60 | + |
| 61 | +.. struct:: template<size_t Id, typename Name = void> captured_content |
| 62 | + |
| 63 | + .. struct:: template <typename Iterator> storage |
28 | 64 |
|
29 |
| - *Some documentation* |
| 65 | + .. function:: constexpr auto begin() const noexcept |
| 66 | + constexpr auto end() const noexcept |
30 | 67 |
|
31 |
| -.. function:: template<class... Args> constexpr ctre::regex_results<deduced> search(Args&&... args) |
| 68 | + Returns the begin or end iterator for the captured content. |
32 | 69 |
|
33 |
| - *Some documentation* |
| 70 | + .. function:: constexpr operator bool() const noexcept |
34 | 71 |
|
35 |
| -*More functions and types* |
| 72 | + Returns whether the match was successful. |
| 73 | + |
| 74 | + .. function:: constexpr auto size() const noexcept |
| 75 | + |
| 76 | + Returns the number of characters in the capture. |
| 77 | + |
| 78 | + .. function:: constexpr operator std::basic_string_view<char_type>() const noexcept |
| 79 | + constexpr std::basic_string_view<char_type> to_view() const noexcept |
| 80 | + constexpr std::basic_string_view<char_type> view() const noexcept |
| 81 | + |
| 82 | + Converts the capture to a string view. |
| 83 | + |
| 84 | + .. function:: constexpr explicit operator std::basic_string<char_type>() const noexcept |
| 85 | + constexpr std::basic_string<char_type> to_string() const noexcept |
| 86 | + constexpr std::basic_string<char_type> str() const noexcept |
| 87 | + |
| 88 | + Converts the capture to a string view. |
| 89 | + |
| 90 | + .. function:: constexpr static size_t get_id() noexcept |
| 91 | + |
| 92 | + Returns ``Id`` |
| 93 | + |
| 94 | +.. function:: template<auto & RE, class... Args> constexpr ctre::regex_results<deduced> match(Args&&... args) |
| 95 | + template<ctll::fixed_string RE, class... Args> constexpr ctre::regex_results<deduced> match(Args&&... args) |
| 96 | + |
| 97 | + Matches ``RE`` against the whole input. |
| 98 | + ``Args...`` must be either a string-like object with ``begin`` and ``end`` member functions, or a pair of forward iterators. |
| 99 | + |
| 100 | +.. function:: template<auto & RE, class... Args> constexpr ctre::regex_results<deduced> search(Args&&... args) |
| 101 | + template<ctll::fixed_string RE, class... Args> constexpr ctre::regex_results<deduced> search(Args&&... args) |
| 102 | + |
| 103 | + Searches for a match somewhere within the input. |
| 104 | + ``Args...`` must be either a string-like object with ``begin`` and ``end`` member functions, or a pair of forward iterators. |
| 105 | + |
0 commit comments