|
Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
|
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 |
Class to map URL paths to classes which handle them.
|
inlineinherited |
Clear the map of all entries.
|
inlineinherited |
Check if a key is contained within this map.
| key | the key to check |
| bool | true if key exists |
|
inlineinherited |
Get the number of entries in this map.
| int | Entry count |
|
inlineinherited |
Get the value for a given key and remove it from the map, without destroying it.
| key |
| V* |
|
inlineinherited |
Get the value at a given index and remove it from the map, without destroying it.
| index |
| V* |
|
inlineinherited |
Find the value for a given key, if it exists.
| key |
| V* | Points to the object if it exists, otherwise nullptr |
operator[] or valueAt()
|
inlineinherited |
Get map entry value.
| key |
| Value |
operator[]
|
inline |
Get the current default resource handler, if any.
| HttpResource* |
|
inlineinherited |
Get the index of a key.
| key |
| int | The index of the key, or -1 if key does not exist |
|
inlineinherited |
Get value for given key, if it exists.
| key |
| const | V* Will be null if not found in the map |
delete on the returned value
|
inlineinherited |
Access map entry by reference.
| key |
| Value | Guarded access to mapped value corresponding to given key |
valueAt()
|
inlineinherited |
Remove a key from this map.
| key | The key identifying the entry to remove |
| bool | true if the value was found and removed |
|
inlineinherited |
Remove entry at given index.
| index | location to remove from this map |
|
inline |
Set a callback to handle the given path.
| path | URL path |
| onRequestComplete | Delegate to handle this path |
| void HttpResourceTree::set | ( | String | path, |
| const HttpPathDelegate & | callback | ||
| ) |
Add a new path resource with a callback.
| path | URL path |
| callback | The callback that will handle this path |
|
inlineinherited |
Set a key value.
| key | |
| value |
|
inline |
Set the default resource handler.
| resource | The default resource handler |
|
inline |
Set the default resource handler, identified by "*" wildcard.
| resource | The default resource handler |
|
inline |
Set the default resource handler, identified by "*" wildcard.