mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2024-11-27 00:43:47 +00:00
Rename PastieRetrieving to GeneralPastie as I think it clearer.
This commit is contained in:
parent
3a9a9611ac
commit
86a576985e
7 changed files with 21 additions and 21 deletions
|
@ -21,7 +21,7 @@ add_library(${PROJECT_NAME} STATIC
|
|||
storage.cpp
|
||||
string_conv.cpp
|
||||
edit_response.cpp
|
||||
pastie_retrieving_response.cpp
|
||||
general_pastie_response.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
|
|
|
@ -24,11 +24,11 @@ namespace kamokan {
|
|||
std::ostream* parStreamOut,
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "pastie_retrieving_response.hpp"
|
||||
#include "general_pastie_response.hpp"
|
||||
|
||||
namespace kamokan {
|
||||
class EditResponse : public PastieRetrievingResponse {
|
||||
class EditResponse : public GeneralPastieResponse {
|
||||
public:
|
||||
EditResponse (
|
||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||
|
@ -35,6 +35,6 @@ namespace kamokan {
|
|||
|
||||
private:
|
||||
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
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* 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 "settings_bag.hpp"
|
||||
#include "error_reasons.hpp"
|
||||
|
@ -57,7 +57,7 @@ namespace kamokan {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
PastieRetrievingResponse::PastieRetrievingResponse (
|
||||
GeneralPastieResponse::GeneralPastieResponse (
|
||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||
std::ostream* parStreamOut,
|
||||
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;
|
||||
|
||||
boost::string_view token = get_search_token(cgi_env());
|
||||
|
@ -84,10 +84,10 @@ namespace kamokan {
|
|||
assert(not token_invalid());
|
||||
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(not token_invalid());
|
||||
assert(not pastie_not_found());
|
||||
|
@ -102,12 +102,12 @@ namespace kamokan {
|
|||
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);
|
||||
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;
|
||||
}
|
||||
} //namespace kamokan
|
|
@ -21,9 +21,9 @@
|
|||
#include <string>
|
||||
|
||||
namespace kamokan {
|
||||
class PastieRetrievingResponse : public Response {
|
||||
class GeneralPastieResponse : public Response {
|
||||
public:
|
||||
PastieRetrievingResponse (
|
||||
GeneralPastieResponse (
|
||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||
std::ostream* parStreamOut,
|
||||
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
||||
|
@ -37,7 +37,7 @@ namespace kamokan {
|
|||
virtual tawashi::HttpHeader on_process() override final;
|
||||
virtual void on_mustache_prepare (mstch::map& parContext) override final;
|
||||
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;
|
||||
};
|
|
@ -43,14 +43,14 @@ namespace kamokan {
|
|||
std::ostream* parStreamOut,
|
||||
const Kakoune::SafePtr<cgi::Env>& parCgiEnv
|
||||
) :
|
||||
PastieRetrievingResponse(parSettings, parStreamOut, parCgiEnv),
|
||||
GeneralPastieResponse(parSettings, parStreamOut, parCgiEnv),
|
||||
m_langmap_dir(parSettings->as<std::string>("langmap_dir")),
|
||||
m_plain_text(false),
|
||||
m_syntax_highlight(true)
|
||||
{
|
||||
}
|
||||
|
||||
tawashi::HttpHeader PastieResponse::on_retrieving_process() {
|
||||
tawashi::HttpHeader PastieResponse::on_general_pastie_process() {
|
||||
auto get = cgi_env().query_string_split();
|
||||
const std::string& query_str(cgi_env().query_string());
|
||||
if (get["m"] == "plain" or query_str.empty()) {
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "pastie_retrieving_response.hpp"
|
||||
#include "general_pastie_response.hpp"
|
||||
#include <string>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
namespace kamokan {
|
||||
class PastieResponse final : public PastieRetrievingResponse {
|
||||
class PastieResponse final : public GeneralPastieResponse {
|
||||
public:
|
||||
PastieResponse (
|
||||
const Kakoune::SafePtr<SettingsBag>& parSettings,
|
||||
|
@ -36,7 +36,7 @@ namespace kamokan {
|
|||
private:
|
||||
virtual std::string on_mustache_retrieve() 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_langmap_dir;
|
||||
|
|
Loading…
Reference in a new issue