WPILibC++ 2023.4.3
wpi::HttpQueryMap Class Reference

Map for looking up elements of the query portion of a URI. More...

#include <wpinet/HttpUtil.h>

Public Member Functions

 HttpQueryMap ()=default
 Constructs an empty map (with no entries). More...
 
 HttpQueryMap (std::string_view query)
 Constructs from an escaped query string. More...
 
std::optional< std::string_viewGet (std::string_view name, SmallVectorImpl< char > &buf) const
 Gets an element of the query string. More...
 

Detailed Description

Map for looking up elements of the query portion of a URI.

Does not handle multiple elements with the same name. This is a reference type; it does not make a copy of the query string, so it is important that the query string has a lifetime at least as long as this object.

Constructor & Destructor Documentation

◆ HttpQueryMap() [1/2]

wpi::HttpQueryMap::HttpQueryMap ( )
default

Constructs an empty map (with no entries).

◆ HttpQueryMap() [2/2]

wpi::HttpQueryMap::HttpQueryMap ( std::string_view  query)
explicit

Constructs from an escaped query string.

Note: does not make a copy of the query string, so it must not be a temporary.

Parameters
queryquery string

Member Function Documentation

◆ Get()

std::optional< std::string_view > wpi::HttpQueryMap::Get ( std::string_view  name,
SmallVectorImpl< char > &  buf 
) const

Gets an element of the query string.

Both the name and the returned value are unescaped strings.

Parameters
namename (unescaped)
bufresult buffer for value
Returns
Optional unescaped value. Returns an empty optional if the name is not present in the query map.

The documentation for this class was generated from the following file: