Skip to content

Commit

Permalink
api updates 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dakka committed Feb 23, 2024
1 parent d1472cf commit 65a1e76
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

------------------------------------------------------------------------
[![Ubuntu](https://github.com/fix8mt/uri/actions/workflows/cmake-single-platform.yml/badge.svg)](https://github.com/fix8mt/uri/actions/workflows/cmake-single-platform.yml)
<a href="https://en.wikipedia.org/wiki/C%2B%2B20" target="_blank">![C++20](http://img.shields.io/badge/C++20-required-orange.svg)</a>
<a href="http://www.boost.org/LICENSE_1_0.txt" target="_blank">![Boost Licence](http://img.shields.io/badge/license-boost-blue.svg)</a>
<a href="https://en.wikipedia.org/wiki/C%2B%2B20"><img src="https://github.com/fix8mt/uri/blob/master/assets/badgecpprequired.svg"></a>
<a href="https://http://www.boost.org/LICENSE_1_0.txt"><img src="https://github.com/fix8mt/uri/blob/master/assets/badgeboostlic.svg"></a>

# Quick links
|**Link**|**Description**|
Expand Down Expand Up @@ -53,7 +53,8 @@ This is a lightweight URI parser implementation featuring zero-copy, minimal sto

# 2. Examples
## i. Use `basic_uri` as a view
This example parses a list of URI strings and prints out `host` component. `basic_uri` creates a no-copy view of the source.
This example parses a list of URI strings and prints out `host` component. `basic_uri` creates a no-copy view of the source. `get_component()`
returns a `std::string_view`.

<details><summary><i>source</i></summary>
<p>
Expand All @@ -66,11 +67,12 @@ using namespace FIX8;

int main(int argc, char *argv[])
{
using namespace std::literals;
static constexpr const std::array uris
{
"https://www.blah.com:3000/test",
"https://dakka@www.staylate.net:3000/",
"https://www.buyexample.com/over/there?name=ferret&time=any#afrag",
"https://www.blah.com:3000/test"sv,
"https://dakka@www.staylate.net:3000/"sv,
"https://www.buyexample.com/over/there?name=ferret&time=any#afrag"sv,
};
for (const auto& pp : uris)
std::cout << basic_uri(pp).get_component(uri::host) << '\n';
Expand Down
1 change: 1 addition & 0 deletions assets/badgeboostlic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/badgecpprequired.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions examples/uritest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@ int main(int argc, char *argv[])
std::cout << sizeof(uri_fixed<"telnet://user:password@192.0.2.16:80/">) << '\n';
std::cout << *ptr << '\n';
*/
/*
using namespace std::literals;
static constexpr const std::array uris
{
"https://www.blah.com:3000/test"sv,
"https://dakka@www.staylate.net:3000/"sv,
"https://www.buyexample.com/over/there?name=ferret&time=any#afrag"sv,
};
for (const auto& pp : uris)
{
std::cout << typeid(pp).name() << '\n';
std::cout << basic_uri(pp).get_component(uri::host) << '\n';
}
*/
}
break;
case 'l':
Expand Down

0 comments on commit 65a1e76

Please sign in to comment.