Modify the Attributes interface of the HttpRequest class (#389)
This commit is contained in:
parent
2401c6a88a
commit
6c850ea886
|
@ -22,8 +22,8 @@
|
|||
namespace drogon
|
||||
{
|
||||
/**
|
||||
* @brief This class represents a attribute stored in the request context.
|
||||
* One can get or set any type of data to a attribute object.
|
||||
* @brief This class represents the attributes stored in the HTTP request.
|
||||
* One can add/get any type of data to/from an Attributes object.
|
||||
*/
|
||||
class Attributes
|
||||
{
|
||||
|
@ -118,9 +118,7 @@ class Attributes
|
|||
/**
|
||||
* @brief Constructor, usually called by the framework
|
||||
*/
|
||||
Attributes()
|
||||
{
|
||||
}
|
||||
Attributes() = default;
|
||||
|
||||
private:
|
||||
using AttributesMap = std::map<std::string, any>;
|
||||
|
|
|
@ -229,11 +229,13 @@ class HttpRequest
|
|||
return session();
|
||||
}
|
||||
|
||||
/// Get the attributes store to which the request belongs.
|
||||
virtual AttributesPtr attributes() const = 0;
|
||||
/// Get the attributes store, users can add/get any type of data to/from
|
||||
/// this store
|
||||
virtual const AttributesPtr &attributes() const = 0;
|
||||
|
||||
/// Get the attributes store to which the request belongs.
|
||||
AttributesPtr getAttributes() const
|
||||
/// Get the attributes store, users can add/get any type of data to/from
|
||||
/// this store
|
||||
const AttributesPtr &getAttributes() const
|
||||
{
|
||||
return attributes();
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ class HttpRequestImpl : public HttpRequest
|
|||
sessionPtr_ = session;
|
||||
}
|
||||
|
||||
virtual AttributesPtr attributes() const override
|
||||
virtual const AttributesPtr &attributes() const override
|
||||
{
|
||||
if (!attributesPtr_)
|
||||
{
|
||||
|
|
2
trantor
2
trantor
|
@ -1 +1 @@
|
|||
Subproject commit 312a91e3e9cffa0ce24b4a87b674c64c6470ee96
|
||||
Subproject commit ec56d4748d0e29f2369b6d1e9e2b8a4c7bed8892
|
Loading…
Reference in New Issue