Use std::string_view instead of backported one

This commit is contained in:
Alexey Sokolov
2023-11-18 11:19:41 +00:00
parent 53f0751fd5
commit ba0351e426
4 changed files with 9 additions and 1434 deletions

1
NOTICE
View File

@@ -16,7 +16,6 @@ ZNC includes code from jQuery UI (http://jqueryui.com/), licensed under the MIT
ZNC includes code from Selectize (http://brianreavis.github.io/selectize.js/), licensed under the Apache License 2.0.
ZNC includes modified code from CMakeFindFrameworks.cmake by Kitware, Inc., licensed under BSD License.
ZNC includes modified code from TestLargeFiles.cmake, licensed under Boost Software License, Version 1.0.
ZNC includes code from BackportCpp (https://github.com/bitwizeshift/string_view-standalone), licensed under the MIT license.
ZNC includes code from cctz (https://github.com/google/cctz), licensed under the Apache License 2.0.
ZNC is developed by these people:

View File

@@ -56,7 +56,6 @@ add_custom_target(version
add_dependencies(znclib copy_csocket_h copy_csocket_cc version)
set(znc_include_dirs
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/bpstd>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>")

View File

@@ -14,9 +14,10 @@
* limitations under the License.
*/
#include <string_view>
#include <znc/Message.h>
#include <znc/Utils.h>
#include "bpstd/string_view.hpp"
CMessage::CMessage(const CString& sMessage) {
Parse(sMessage);
@@ -165,7 +166,7 @@ void CMessage::Parse(const CString& sMessage) {
// Find the end of the first word
const char* p = begin;
while (p < end && *p != ' ') ++p;
bpstd::string_view result(begin, p - begin);
std::string_view result(begin, p - begin);
begin = p;
// Prepare for the following word
while (begin < end && *begin == ' ') ++begin;
@@ -175,12 +176,12 @@ void CMessage::Parse(const CString& sMessage) {
// <tags>
m_mssTags.clear();
if (begin < end && *begin == '@') {
bpstd::string_view svTags = next_word().substr(1);
std::vector<bpstd::string_view> vsTags;
std::string_view svTags = next_word().substr(1);
std::vector<std::string_view> vsTags;
// Split by ';'
while (true) {
auto delim = svTags.find_first_of(';');
if (delim == bpstd::string_view::npos) {
if (delim == std::string_view::npos) {
vsTags.push_back(svTags);
break;
}
@@ -188,10 +189,10 @@ void CMessage::Parse(const CString& sMessage) {
svTags = svTags.substr(delim + 1);
}
// Save key and value
for (bpstd::string_view svTag : vsTags) {
for (std::string_view svTag : vsTags) {
auto delim = svTag.find_first_of('=');
CString sKey = std::string(delim == bpstd::string_view::npos ? svTag : svTag.substr(0, delim));
CString sValue = delim == bpstd::string_view::npos ? std::string() : std::string(svTag.substr(delim + 1));
CString sKey = std::string(delim == std::string_view::npos ? svTag : svTag.substr(0, delim));
CString sValue = delim == std::string_view::npos ? std::string() : std::string(svTag.substr(delim + 1));
m_mssTags[sKey] =
sValue.Escape(CString::EMSGTAG, CString::CString::EASCII);
}

File diff suppressed because it is too large Load Diff