[#boost-urls-url_view_base-scheme_id]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url&lowbar;view&lowbar;base]::scheme&lowbar;id
:relfileprefix: ../../../
:mrdocs:


Return the scheme

== Synopsis


Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L435[boost&sol;url&sol;url&lowbar;view&lowbar;base&period;hpp]&gt;`

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

== Description


This function returns a value which        depends on the scheme in the url&colon;

* If the scheme is a well&hyphen;known        scheme, corresponding value from
        the enumeration 
urls&colon;&colon;scheme
        is returned&period;
* If a scheme is present but is not        a well&hyphen;known scheme, the value
        returned is 
urls&colon;&colon;scheme&colon;&colon;unknown
&period;
* Otherwise, if the scheme is absent        the value returned is
        
urls&colon;&colon;scheme&colon;&colon;none
&period;


=== Example

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

=== Complexity

Constant&period;


=== Exception Safety

Throws nothing&period;


=== 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&period;1&period; Scheme (rfc3986)]

Return the scheme

This function returns a value which        depends on the scheme in the url&colon;

* If the scheme is a well&hyphen;known        scheme, corresponding value from
        the enumeration 
urls&colon;&colon;scheme
        is returned&period;
* If a scheme is present but is not        a well&hyphen;known scheme, the value
        returned is 
urls&colon;&colon;scheme&colon;&colon;unknown
&period;
* Otherwise, if the scheme is absent        the value returned is
        
urls&colon;&colon;scheme&colon;&colon;none
&period;


=== Example

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

=== Complexity

Constant&period;


=== Exception Safety

Throws nothing&period;


=== 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&period;1&period; Scheme (rfc3986)]



== See Also


xref:boost/urls/url_view_base/has_scheme.adoc[has&lowbar;scheme],            xref:boost/urls/url_view_base/scheme.adoc[scheme]&period;



xref:boost/urls/url_view_base/has_scheme.adoc[has&lowbar;scheme],            xref:boost/urls/url_view_base/scheme.adoc[scheme]&period;






[.small]#Created with https://www.mrdocs.com[MrDocs]#
