Mercurial > hg > orthanc
diff OrthancFramework/Sources/HttpServer/HttpContentNegociation.h @ 5338:78c59b02b121
accept parameters are now provided to HttpContentNegociation::IHandler::Handle()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Jun 2023 08:29:43 +0200 |
parents | 0ea402b4d901 |
children | 48b8dae6dc77 |
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/HttpContentNegociation.h Tue Jun 27 17:55:09 2023 +0200 +++ b/OrthancFramework/Sources/HttpServer/HttpContentNegociation.h Wed Jun 28 08:29:43 2023 +0200 @@ -39,7 +39,7 @@ class ORTHANC_PUBLIC HttpContentNegociation : public boost::noncopyable { public: - typedef std::map<std::string, std::string> HttpHeaders; + typedef std::map<std::string, std::string> Dictionary; class IHandler : public boost::noncopyable { @@ -49,7 +49,8 @@ } virtual void Handle(const std::string& type, - const std::string& subtype) = 0; + const std::string& subtype, + const Dictionary& parameters) = 0; }; private: @@ -66,9 +67,9 @@ bool IsMatch(const std::string& type, const std::string& subtype) const; - void Call() const + void Call(const Dictionary& parameters) const { - handler_.Handle(type_, subtype_); + handler_.Handle(type_, subtype_, parameters); } }; @@ -86,19 +87,17 @@ const std::string& source, char separator); - static float GetQuality(const Tokens& parameters); - - static void SelectBestMatch(std::unique_ptr<Reference>& best, + static void SelectBestMatch(std::unique_ptr<Reference>& target, const Handler& handler, const std::string& type, const std::string& subtype, - float quality); + const Dictionary& parameters); public: void Register(const std::string& mime, IHandler& handler); - bool Apply(const HttpHeaders& headers); + bool Apply(const Dictionary& headers); bool Apply(const std::string& accept); };