mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2025-02-09 09:23:56 +00:00
Remove parameters from Response's constructor.
They can safely be defaulted and derived classes can change their preferences later inside their constructor if they need to.
This commit is contained in:
parent
f286507edf
commit
10da75caf5
5 changed files with 8 additions and 9 deletions
|
@ -24,7 +24,7 @@ namespace tawashi {
|
||||||
std::ostream* parStreamOut,
|
std::ostream* parStreamOut,
|
||||||
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
||||||
) :
|
) :
|
||||||
Response(Response::ContentType, "text/html", parSettings, parStreamOut, parCgiEnv, false)
|
Response(parSettings, parStreamOut, parCgiEnv, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} //namespace tawashi
|
} //namespace tawashi
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace tawashi {
|
||||||
std::ostream* parStreamOut,
|
std::ostream* parStreamOut,
|
||||||
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
||||||
) :
|
) :
|
||||||
Response(Response::ContentType, "text/html", parSettings, parStreamOut, parCgiEnv, true),
|
Response(parSettings, parStreamOut, parCgiEnv, true),
|
||||||
m_langmap_dir(parSettings->as<std::string>("langmap_dir")),
|
m_langmap_dir(parSettings->as<std::string>("langmap_dir")),
|
||||||
m_plain_text(false),
|
m_plain_text(false),
|
||||||
m_syntax_highlight(true)
|
m_syntax_highlight(true)
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
namespace tawashi {
|
namespace tawashi {
|
||||||
namespace {
|
namespace {
|
||||||
|
const char g_def_response_type[] = "text/html";
|
||||||
|
|
||||||
//boost::string_ref fetch_page_basename (const cgi::Env& parEnv) {
|
//boost::string_ref fetch_page_basename (const cgi::Env& parEnv) {
|
||||||
// const boost::string_ref& path = parEnv.path_info();
|
// const boost::string_ref& path = parEnv.path_info();
|
||||||
|
|
||||||
|
@ -106,19 +108,17 @@ namespace tawashi {
|
||||||
} //unnamed namespace
|
} //unnamed namespace
|
||||||
|
|
||||||
Response::Response (
|
Response::Response (
|
||||||
Types parRespType,
|
|
||||||
std::string&& parValue,
|
|
||||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||||
std::ostream* parStreamOut,
|
std::ostream* parStreamOut,
|
||||||
const Kakoune::SafePtr<cgi::Env>& parCgiEnv,
|
const Kakoune::SafePtr<cgi::Env>& parCgiEnv,
|
||||||
bool parWantRedis
|
bool parWantRedis
|
||||||
) :
|
) :
|
||||||
m_resp_value(std::move(parValue)),
|
m_resp_value(g_def_response_type),
|
||||||
//m_page_basename(fetch_page_basename(m_cgi_env)),
|
//m_page_basename(fetch_page_basename(m_cgi_env)),
|
||||||
m_cgi_env(parCgiEnv),
|
m_cgi_env(parCgiEnv),
|
||||||
m_settings(parSettings),
|
m_settings(parSettings),
|
||||||
m_website_root(make_root_path(*parSettings)),
|
m_website_root(make_root_path(*parSettings)),
|
||||||
m_resp_type(parRespType),
|
m_resp_type(ContentType),
|
||||||
m_stream_out(parStreamOut),
|
m_stream_out(parStreamOut),
|
||||||
m_header_sent(false)
|
m_header_sent(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,8 +48,6 @@ namespace tawashi {
|
||||||
};
|
};
|
||||||
|
|
||||||
Response (
|
Response (
|
||||||
Types parRespType,
|
|
||||||
std::string&& parValue,
|
|
||||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||||
std::ostream* parStreamOut,
|
std::ostream* parStreamOut,
|
||||||
const Kakoune::SafePtr<cgi::Env>& parCgiEnv,
|
const Kakoune::SafePtr<cgi::Env>& parCgiEnv,
|
||||||
|
|
|
@ -94,8 +94,9 @@ namespace tawashi {
|
||||||
std::ostream* parStreamOut,
|
std::ostream* parStreamOut,
|
||||||
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
||||||
) :
|
) :
|
||||||
Response(Response::ContentType, "text/plain", parSettings, parStreamOut, parCgiEnv, true)
|
Response(parSettings, parStreamOut, parCgiEnv, true)
|
||||||
{
|
{
|
||||||
|
this->change_type(Response::ContentType, "text/plain");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitPasteResponse::on_process() {
|
void SubmitPasteResponse::on_process() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue