:relfileprefix: ../../../
[#boost-urls-url_view_base-scheme_id]

= xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/url_view_base.adoc[pass:[url_view_base]]::scheme_id


Return the scheme


== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L424[boost/url/url_view_base.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
xref:boost/urls.adoc[urls]::xref:boost/urls/scheme.adoc[scheme]
scheme_id() const noexcept;
----

== Description


This function returns a value which
depends on the scheme in the url:

* If the scheme is a well-known
scheme, corresponding value from
the enumeration
xref:boost/urls/scheme.adoc[urls::scheme]
is returned.

* If a scheme is present but is not
a well-known scheme, the value
returned is
xref:boost/urls/scheme/unknown.adoc[urls::scheme::unknown]
.

* Otherwise, if the scheme is absent
the value returned is
xref:boost/urls/scheme/none.adoc[urls::scheme::none]
.

=== Example
[,cpp]
----
assert( url_view( "wss://www.example.com/crypto.cgi" ).scheme_id() == scheme::wss );
----

=== Complexity

Constant.

=== Exception Safety

Throws nothing.

=== BNF
[,cpp]
----
URI             = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

absolute-URI    = scheme ":" hier-part [ "?" query ]

scheme          = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3.1. Scheme (rfc3986)]








== See Also


xref:boost/urls/url_view_base/has_scheme.adoc[has_scheme]
,
xref:boost/urls/url_view_base/scheme.adoc[scheme]
.



