Skip to content

Replaced the accessors that return optional string_view objects with two separate functions. #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 12, 2016

Conversation

glynos
Copy link
Member

@glynos glynos commented Apr 11, 2016

This is what we talked about earlier (or last night, if you are reading about this when you wake up).

I removed the use of optional, and updated all the tests. For me, all tests are green. So the following is up for discussion:

  1. Do we need "bool has_x() const" if string_view::data() can be tested against nullptr;
  2. What do we do with "template intT port() const"?

For 1, I think (weakly) that the answer is "yes"
For 2, I think throw an exception on error

I'm already comfortable with the idea of no longer using optional in this context, my experience already is that is much easier for the user to use and understand.

@glynos
Copy link
Member Author

glynos commented Apr 11, 2016

P.S. If we agree, I want to start integrating this (as a submodule) into the cpp-netlib

@deanberris
Copy link
Member

Do we need "bool has_x() const" if string_view::data() can be tested against nullptr;

I think so. It's useful to have these specific checks.

What do we do with "template intT port() const"?

I think we can turn this into a string_view too. If users want to turn this into a number, they can choose the many ways to do it.

I'm already comfortable with the idea of no longer using optional in this context, my experience already is that is much easier for the user to use and understand.

SGTM

* \brief Tests whether this URI has a scheme component.
* \return \c true if the URI has a scheme, \c false otherwise.
*/
bool has_scheme() const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probably should be noexcept alongside const.

@deanberris
Copy link
Member

LGTM

@deanberris deanberris merged commit beb37d4 into cpp-netlib:master Apr 12, 2016
@glynos glynos deleted the accessor_changes branch April 12, 2016 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants