Qore Programming Language Reference Manual
1.12.0
|
A container for efficient path prefix lookup. More...
Public Member Methods | |
constructor () | |
Creates an empty TreeMap container. More... | |
copy () | |
Throws an exception; objects of this class cannot be copied. More... | |
destructor () | |
Releases any resource held by the instance. More... | |
auto | get (string path, *reference< *string > unmatched) |
Retrieves a value from the TreeMap and optionally returns the unmatched path suffix. More... | |
*hash | getAll () |
Retrieves the entire TreeMap as a hash; returns NOTHING if the TreeMap is empty. More... | |
nothing | put (string path, auto value) |
Puts the mapping of path to value into the container. More... | |
auto | take (string path) |
Removes a value from the TreeMap and returns the value removed. More... | |
A container for efficient path prefix lookup.
The primary use of this class is in HttpServer for matching request URIs to handlers.
Example:
Qore::TreeMap::constructor | ( | ) |
Qore::TreeMap::copy | ( | ) |
Throws an exception; objects of this class cannot be copied.
TREEMAP-COPY-ERROR | objects of this class cannot be copied |
Qore::TreeMap::destructor | ( | ) |
Releases any resource held by the instance.
Releases any resource held by the instance.
Retrieves a value from the TreeMap and optionally returns the unmatched path suffix.
Looks for an entry whose key is the longest prefix of path
.
path | the path to lookup |
unmatched | an optional reference to the path suffix; if path is not found, then NOTHING is assigned to the reference |
path
or NOTHING if no such mapping exists*hash Qore::TreeMap::getAll | ( | ) |
nothing Qore::TreeMap::put | ( | string | path, |
auto | value | ||
) |
Puts the mapping of path
to value
into the container.
path | the path to which value will be mapped |
value | the value to put into the TreeMap |
auto Qore::TreeMap::take | ( | string | path | ) |
Removes a value from the TreeMap and returns the value removed.
path
must be an exact match
path | the path to remove |