mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 12:37:08 +11:00
🔥🎨 replaced template specializations with class instaniations
This commit is contained in:
parent
18b7923d7f
commit
6dbb9fd98a
2 changed files with 11 additions and 12 deletions
|
|
@ -1,9 +1,7 @@
|
||||||
#include "json_filter.h"
|
#include "json_filter.h"
|
||||||
|
|
||||||
template <>
|
template <bool check_content_type>
|
||||||
JsonFilter<true>::JsonFilter() {}
|
JsonFilter<check_content_type>::JsonFilter() {}
|
||||||
template <>
|
|
||||||
JsonFilter<false>::JsonFilter() {}
|
|
||||||
|
|
||||||
__attribute__((always_inline)) inline bool Contains(std::string_view str, const std::string &val) { return str.find(val) != std::string::npos; }
|
__attribute__((always_inline)) inline bool Contains(std::string_view str, const std::string &val) { return str.find(val) != std::string::npos; }
|
||||||
|
|
||||||
|
|
@ -34,3 +32,6 @@ void JsonFilter<check_content_type>::doFilter(const HttpRequestPtr &req,
|
||||||
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse(k406NotAcceptable, "Client must Accept JSON"));
|
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse(k406NotAcceptable, "Client must Accept JSON"));
|
||||||
fcb(resp);
|
fcb(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class JsonFilter<true>;
|
||||||
|
template class JsonFilter<false>;
|
||||||
|
|
@ -2,12 +2,6 @@
|
||||||
|
|
||||||
template <bool set_body_flag, bool require_admin>
|
template <bool set_body_flag, bool require_admin>
|
||||||
UserFilter<set_body_flag, require_admin>::UserFilter(Bank &b) : bank(b) {}
|
UserFilter<set_body_flag, require_admin>::UserFilter(Bank &b) : bank(b) {}
|
||||||
template <>
|
|
||||||
UserFilter<true, false>::UserFilter(Bank &b) : bank(b) {}
|
|
||||||
template <>
|
|
||||||
UserFilter<false, false>::UserFilter(Bank &b) : bank(b) {}
|
|
||||||
template <>
|
|
||||||
UserFilter<false, true>::UserFilter(Bank &b) : bank(b) {}
|
|
||||||
|
|
||||||
template <bool set_body_flag, bool require_admin>
|
template <bool set_body_flag, bool require_admin>
|
||||||
void UserFilter<set_body_flag, require_admin>::doFilter(const HttpRequestPtr &req,
|
void UserFilter<set_body_flag, require_admin>::doFilter(const HttpRequestPtr &req,
|
||||||
|
|
@ -61,3 +55,7 @@ void UserFilter<set_body_flag, require_admin>::doFilter(const HttpRequestPtr &re
|
||||||
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse(k401Unauthorized, "Invalid Credentials"));
|
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse(k401Unauthorized, "Invalid Credentials"));
|
||||||
fcb(resp);
|
fcb(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class UserFilter<true, false>; //user default
|
||||||
|
template class UserFilter<false, false>; //user sparse
|
||||||
|
template class UserFilter<false, true>; //admin
|
||||||
Loading…
Reference in a new issue