1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-08-03 12:50:02 +00:00

Rename PastieRetrieving to GeneralPastie as I think it clearer.

This commit is contained in:
King_DuckZ 2017-06-16 19:17:28 +01:00
parent 3a9a9611ac
commit 86a576985e
7 changed files with 21 additions and 21 deletions

View file

@ -21,7 +21,7 @@ add_library(${PROJECT_NAME} STATIC
storage.cpp storage.cpp
string_conv.cpp string_conv.cpp
edit_response.cpp edit_response.cpp
pastie_retrieving_response.cpp general_pastie_response.cpp
) )
target_include_directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME}

View file

@ -24,11 +24,11 @@ namespace kamokan {
std::ostream* parStreamOut, std::ostream* parStreamOut,
const Kakoune::SafePtr<cgi::Env>& parCgiEnv const Kakoune::SafePtr<cgi::Env>& parCgiEnv
) : ) :
PastieRetrievingResponse(parSettings, parStreamOut, parCgiEnv) GeneralPastieResponse(parSettings, parStreamOut, parCgiEnv)
{ {
} }
tawashi::HttpHeader EditResponse::on_retrieving_process() { tawashi::HttpHeader EditResponse::on_general_pastie_process() {
return tawashi::make_header_type_html(); return tawashi::make_header_type_html();
} }

View file

@ -17,10 +17,10 @@
#pragma once #pragma once
#include "pastie_retrieving_response.hpp" #include "general_pastie_response.hpp"
namespace kamokan { namespace kamokan {
class EditResponse : public PastieRetrievingResponse { class EditResponse : public GeneralPastieResponse {
public: public:
EditResponse ( EditResponse (
const Kakoune::SafePtr<SettingsBag>& parSettings, const Kakoune::SafePtr<SettingsBag>& parSettings,
@ -35,6 +35,6 @@ namespace kamokan {
private: private:
virtual std::string on_pastie_prepare (std::string&& parPastie) override; virtual std::string on_pastie_prepare (std::string&& parPastie) override;
virtual tawashi::HttpHeader on_retrieving_process() override; virtual tawashi::HttpHeader on_general_pastie_process() override;
}; };
} //namespace kamokan } //namespace kamokan

View file

@ -15,7 +15,7 @@
* along with "kamokan". If not, see <http://www.gnu.org/licenses/>. * along with "kamokan". If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "pastie_retrieving_response.hpp" #include "general_pastie_response.hpp"
#include "cgi_env.hpp" #include "cgi_env.hpp"
#include "settings_bag.hpp" #include "settings_bag.hpp"
#include "error_reasons.hpp" #include "error_reasons.hpp"
@ -57,7 +57,7 @@ namespace kamokan {
} }
} //unnamed namespace } //unnamed namespace
PastieRetrievingResponse::PastieRetrievingResponse ( GeneralPastieResponse::GeneralPastieResponse (
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
@ -66,7 +66,7 @@ namespace kamokan {
{ {
} }
tawashi::HttpHeader PastieRetrievingResponse::on_process() { tawashi::HttpHeader GeneralPastieResponse::on_process() {
using tawashi::ErrorReasons; using tawashi::ErrorReasons;
boost::string_view token = get_search_token(cgi_env()); boost::string_view token = get_search_token(cgi_env());
@ -84,10 +84,10 @@ namespace kamokan {
assert(not token_invalid()); assert(not token_invalid());
assert(not pastie_not_found()); assert(not pastie_not_found());
return this->on_retrieving_process(); return this->on_general_pastie_process();
} }
void PastieRetrievingResponse::on_mustache_prepare (mstch::map& parContext) { void GeneralPastieResponse::on_mustache_prepare (mstch::map& parContext) {
assert(m_pastie_info.pastie); assert(m_pastie_info.pastie);
assert(not token_invalid()); assert(not token_invalid());
assert(not pastie_not_found()); assert(not pastie_not_found());
@ -102,12 +102,12 @@ namespace kamokan {
parContext["pastie_page"] = true; parContext["pastie_page"] = true;
} }
bool PastieRetrievingResponse::token_invalid() const { bool GeneralPastieResponse::token_invalid() const {
assert(m_pastie_info.valid_token or not m_pastie_info.pastie); assert(m_pastie_info.valid_token or not m_pastie_info.pastie);
return not m_pastie_info.valid_token; return not m_pastie_info.valid_token;
} }
bool PastieRetrievingResponse::pastie_not_found() const { bool GeneralPastieResponse::pastie_not_found() const {
return not m_pastie_info.pastie; return not m_pastie_info.pastie;
} }
} //namespace kamokan } //namespace kamokan

View file

@ -21,9 +21,9 @@
#include <string> #include <string>
namespace kamokan { namespace kamokan {
class PastieRetrievingResponse : public Response { class GeneralPastieResponse : public Response {
public: public:
PastieRetrievingResponse ( GeneralPastieResponse (
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
@ -37,7 +37,7 @@ namespace kamokan {
virtual tawashi::HttpHeader on_process() override final; virtual tawashi::HttpHeader on_process() override final;
virtual void on_mustache_prepare (mstch::map& parContext) override final; virtual void on_mustache_prepare (mstch::map& parContext) override final;
virtual std::string on_pastie_prepare (std::string&& parPastie) = 0; virtual std::string on_pastie_prepare (std::string&& parPastie) = 0;
virtual tawashi::HttpHeader on_retrieving_process() = 0; virtual tawashi::HttpHeader on_general_pastie_process() = 0;
Storage::RetrievedPastie m_pastie_info; Storage::RetrievedPastie m_pastie_info;
}; };

View file

@ -43,14 +43,14 @@ namespace kamokan {
std::ostream* parStreamOut, std::ostream* parStreamOut,
const Kakoune::SafePtr<cgi::Env>& parCgiEnv const Kakoune::SafePtr<cgi::Env>& parCgiEnv
) : ) :
PastieRetrievingResponse(parSettings, parStreamOut, parCgiEnv), GeneralPastieResponse(parSettings, parStreamOut, parCgiEnv),
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)
{ {
} }
tawashi::HttpHeader PastieResponse::on_retrieving_process() { tawashi::HttpHeader PastieResponse::on_general_pastie_process() {
auto get = cgi_env().query_string_split(); auto get = cgi_env().query_string_split();
const std::string& query_str(cgi_env().query_string()); const std::string& query_str(cgi_env().query_string());
if (get["m"] == "plain" or query_str.empty()) { if (get["m"] == "plain" or query_str.empty()) {

View file

@ -17,12 +17,12 @@
#pragma once #pragma once
#include "pastie_retrieving_response.hpp" #include "general_pastie_response.hpp"
#include <string> #include <string>
#include <boost/utility/string_view.hpp> #include <boost/utility/string_view.hpp>
namespace kamokan { namespace kamokan {
class PastieResponse final : public PastieRetrievingResponse { class PastieResponse final : public GeneralPastieResponse {
public: public:
PastieResponse ( PastieResponse (
const Kakoune::SafePtr<SettingsBag>& parSettings, const Kakoune::SafePtr<SettingsBag>& parSettings,
@ -36,7 +36,7 @@ namespace kamokan {
private: private:
virtual std::string on_mustache_retrieve() override; virtual std::string on_mustache_retrieve() override;
virtual std::string on_pastie_prepare (std::string&& parPastie) override; virtual std::string on_pastie_prepare (std::string&& parPastie) override;
virtual tawashi::HttpHeader on_retrieving_process() override; virtual tawashi::HttpHeader on_general_pastie_process() override;
std::string m_lang_file; std::string m_lang_file;
std::string m_langmap_dir; std::string m_langmap_dir;