mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2025-10-02 15:00:02 +00:00
Use stock std::string conversion.
This commit is contained in:
parent
eaf8c0778d
commit
056e7dcde4
9 changed files with 22 additions and 41 deletions
|
@ -48,7 +48,7 @@ namespace tawashi {
|
|||
parURL.size()
|
||||
);
|
||||
if (0 == escaped)
|
||||
return std::string(parURL.data(), parURL.size());
|
||||
return std::string(parURL);
|
||||
else
|
||||
return std::string(buf->ptr, buf->size);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace tawashi {
|
|||
parURL.size()
|
||||
);
|
||||
if (0 == escaped)
|
||||
return std::string(parURL.data(), parURL.size());
|
||||
return std::string(parURL);
|
||||
else
|
||||
return std::string(buf->ptr, buf->size);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ namespace tawashi {
|
|||
1
|
||||
);
|
||||
if (0 == escaped)
|
||||
return std::string(parHtml.data(), parHtml.size());
|
||||
return std::string(parHtml);
|
||||
else
|
||||
return std::string(buf->ptr, buf->size);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "settings_bag.hpp"
|
||||
#include "duckhandy/lexical_cast.hpp"
|
||||
#include "spdlog.hpp"
|
||||
#include <ciso646>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
@ -63,7 +64,7 @@ namespace tawashi {
|
|||
template <>
|
||||
std::string SettingsBag::as (boost::string_view parIndex) const {
|
||||
auto& setting = this->at(parIndex);
|
||||
return std::string(setting.data(), setting.size());
|
||||
return std::string(setting);
|
||||
}
|
||||
|
||||
template <>
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
#include "ini_file.hpp"
|
||||
#include "kakoune/safe_ptr.hh"
|
||||
#if defined(SPDLOG_DEBUG_ON)
|
||||
# include "spdlog.hpp"
|
||||
#endif
|
||||
#include <map>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#if defined(SPDLOG_DEBUG_ON)
|
||||
# include <spdlog/spdlog.h>
|
||||
#endif
|
||||
|
||||
namespace tawashi {
|
||||
class SettingsBag : public Kakoune::SafeCountable {
|
||||
|
@ -52,7 +52,7 @@ namespace tawashi {
|
|||
|
||||
inline const boost::string_view& SettingsBag::at (boost::string_view parIndex) const {
|
||||
#if defined(SPDLOG_DEBUG_ON)
|
||||
SPDLOG_DEBUG(spdlog::get("statuslog"), "Retrieving setting \"{}\"", std::string(parIndex.data(), parIndex.size()));
|
||||
SPDLOG_DEBUG(spdlog::get("statuslog"), "Retrieving setting \"{}\"", parIndex);
|
||||
#endif
|
||||
return (*this)[parIndex];
|
||||
}
|
||||
|
|
|
@ -18,11 +18,4 @@
|
|||
#pragma once
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
namespace spdlog {
|
||||
template <typename OStream>
|
||||
inline OStream& operator<< (OStream& parOS, const boost::string_view& parStr) {
|
||||
return parOS << parStr;
|
||||
}
|
||||
} //namespace spdlog
|
||||
#include <spdlog/fmt/ostr.h>
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#include "num_to_token.hpp"
|
||||
#include "tawashi_config.h"
|
||||
#include "duckhandy/stringize.h"
|
||||
#include "spdlog.hpp"
|
||||
#include <cassert>
|
||||
#include <ciso646>
|
||||
#include <string>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utility>
|
||||
|
||||
namespace tawashi {
|
||||
|
@ -131,17 +131,10 @@ namespace tawashi {
|
|||
#if defined(SPDLOG_DEBUG_ON)
|
||||
{
|
||||
auto statuslog = spdlog::get("statuslog");
|
||||
if (pastie) {
|
||||
statuslog->debug("Retrieving pastie with token \"{}\" gave a result of size {}",
|
||||
std::string(parToken.data(), parToken.size()),
|
||||
pastie->size()
|
||||
);
|
||||
}
|
||||
else {
|
||||
statuslog->debug("Retrieving pastie with token \"{}\" gave no results",
|
||||
std::string(parToken.data(), parToken.size())
|
||||
);
|
||||
}
|
||||
if (pastie)
|
||||
statuslog->debug("Retrieving pastie with token \"{}\" gave a result of size {}", parToken, pastie->size());
|
||||
else
|
||||
statuslog->debug("Retrieving pastie with token \"{}\" gave no results", parToken);
|
||||
}
|
||||
#endif
|
||||
return pastie;
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace tawashi {
|
|||
}
|
||||
|
||||
boost::string_view get_value_from_post (const cgi::PostMapType& parPost, boost::string_view parKey) {
|
||||
std::string key(parKey.data(), parKey.size());
|
||||
std::string key(parKey);
|
||||
auto post_data_it = parPost.find(key);
|
||||
if (parPost.end() == post_data_it)
|
||||
throw MissingPostVarError(parKey);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue