Class to map URL paths to classes which handle them. More...
#include <HttpResourceTree.h>
Public Member Functions | |
void | setDefault (HttpResource *resource) |
Set the default resource handler. More... | |
void | setDefault (const HttpResourceDelegate &onRequestComplete) |
Set the default resource handler, identified by "*" wildcard. More... | |
void | setDefault (const HttpPathDelegate &callback) |
Set the default resource handler, identified by "*" wildcard. More... | |
HttpResource * | getDefault () |
Get the current default resource handler, if any. More... | |
void | set (const String &path, const HttpResourceDelegate &onRequestComplete) |
Set a callback to handle the given path. More... | |
void | set (String path, const HttpPathDelegate &callback) |
Add a new path resource with a callback. More... | |
unsigned | count () const |
Get the number of entries in this map. More... | |
const String & | keyAt (unsigned idx) const |
String & | keyAt (unsigned idx) |
const HttpResource * | valueAt (unsigned idx) const |
Value | valueAt (unsigned idx) |
const HttpResource * | operator[] (const String &key) const |
Get value for given key, if it exists. More... | |
Value | operator[] (const String &key) |
Access map entry by reference. More... | |
Value | get (const String &key) |
Get map entry value. More... | |
void | set (const String &key, HttpResource *value) |
Set a key value. More... | |
HttpResource * | find (const String &key) const |
Find the value for a given key, if it exists. More... | |
int | indexOf (const String &key) const |
Get the index of a key. More... | |
bool | contains (const String &key) const |
Check if a key is contained within this map. More... | |
void | removeAt (unsigned index) |
Remove entry at given index. More... | |
bool | remove (const String &key) |
Remove a key from this map. More... | |
HttpResource * | extract (const String &key) |
Get the value for a given key and remove it from the map, without destroying it. More... | |
HttpResource * | extractAt (unsigned index) |
Get the value at a given index and remove it from the map, without destroying it. More... | |
void | clear () |
Clear the map of all entries. More... | |
Protected Attributes | |
Vector< Entry > | entries |
Detailed Description
Class to map URL paths to classes which handle them.
Member Function Documentation
◆ clear()
|
inlineinherited |
Clear the map of all entries.
◆ contains()
|
inlineinherited |
Check if a key is contained within this map.
- Parameters
-
key the key to check
- Return values
-
bool true if key exists
◆ count()
|
inlineinherited |
Get the number of entries in this map.
- Return values
-
int Entry count
◆ extract()
|
inlineinherited |
Get the value for a given key and remove it from the map, without destroying it.
- Parameters
-
key
- Return values
-
V*
- Note
- The returned object must be freed by the caller when no longer required
◆ extractAt()
|
inlineinherited |
Get the value at a given index and remove it from the map, without destroying it.
- Parameters
-
index
- Return values
-
V*
- Note
- The returned object must be freed by the caller when no longer required
◆ find()
|
inlineinherited |
Find the value for a given key, if it exists.
- Parameters
-
key
- Return values
-
V* Points to the object if it exists, otherwise nullptr
- Note
- If you need to modify the existing map entry, use
operator[]
orvalueAt()
◆ get()
|
inlineinherited |
Get map entry value.
- Parameters
-
key
- Return values
-
Value
- See also
operator[]
◆ getDefault()
|
inline |
Get the current default resource handler, if any.
- Return values
-
HttpResource*
◆ indexOf()
|
inlineinherited |
Get the index of a key.
- Parameters
-
key
- Return values
-
int The index of the key, or -1 if key does not exist
◆ keyAt() [1/2]
|
inlineinherited |
◆ keyAt() [2/2]
|
inlineinherited |
◆ operator[]() [1/2]
|
inlineinherited |
Get value for given key, if it exists.
- Parameters
-
key
- Return values
-
const V* Will be null if not found in the map
- Note
- The caller must not use
delete
on the returned value
◆ operator[]() [2/2]
|
inlineinherited |
Access map entry by reference.
- Parameters
-
key
- Return values
-
Value Guarded access to mapped value corresponding to given key
- Note
- If the given key does not exist in the map it will NOT be created
- See also
valueAt()
◆ remove()
|
inlineinherited |
Remove a key from this map.
- Parameters
-
key The key identifying the entry to remove
- Return values
-
bool true if the value was found and removed
◆ removeAt()
|
inlineinherited |
Remove entry at given index.
- Parameters
-
index location to remove from this map
◆ set() [1/3]
|
inline |
Set a callback to handle the given path.
- Parameters
-
path URL path onRequestComplete Delegate to handle this path
- Note
- Path should start with slash. Trailing slashes will be removed.
- Any existing handler for this path is replaced
◆ set() [2/3]
void HttpResourceTree::set | ( | String | path, |
const HttpPathDelegate & | callback | ||
) |
Add a new path resource with a callback.
- Parameters
-
path URL path callback The callback that will handle this path
- Note
- Path should start with slash. Trailing slashes will be removed
- Any existing handler for this path is replaced
◆ set() [3/3]
|
inlineinherited |
Set a key value.
- Parameters
-
key value
◆ setDefault() [1/3]
|
inline |
Set the default resource handler.
- Parameters
-
resource The default resource handler
◆ setDefault() [2/3]
|
inline |
Set the default resource handler, identified by "*" wildcard.
- Parameters
-
onRequestComplete The default resource handler
◆ setDefault() [3/3]
|
inline |
Set the default resource handler, identified by "*" wildcard.
◆ valueAt() [1/2]
|
inlineinherited |
◆ valueAt() [2/2]
|
inlineinherited |
Member Data Documentation
◆ entries
|
protectedinherited |
The documentation for this class was generated from the following file: