tag/Builder: use std::string_view instead of StringView

This commit is contained in:
Max Kellermann 2022-06-29 16:48:49 +02:00
parent 2da847dd30
commit ca9dd74fbf
2 changed files with 9 additions and 10 deletions

View File

@ -23,7 +23,6 @@
#include "FixString.hxx" #include "FixString.hxx"
#include "Tag.hxx" #include "Tag.hxx"
#include "util/AllocatedArray.hxx" #include "util/AllocatedArray.hxx"
#include "util/StringView.hxx"
#include <algorithm> #include <algorithm>
#include <array> #include <array>
@ -198,7 +197,7 @@ TagBuilder::Complement(const Tag &other) noexcept
} }
void void
TagBuilder::AddItemUnchecked(TagType type, StringView value) noexcept TagBuilder::AddItemUnchecked(TagType type, std::string_view value) noexcept
{ {
TagItem *i; TagItem *i;
@ -211,7 +210,7 @@ TagBuilder::AddItemUnchecked(TagType type, StringView value) noexcept
} }
inline void inline void
TagBuilder::AddItemInternal(TagType type, StringView value) noexcept TagBuilder::AddItemInternal(TagType type, std::string_view value) noexcept
{ {
assert(!value.empty()); assert(!value.empty());
@ -223,7 +222,7 @@ TagBuilder::AddItemInternal(TagType type, StringView value) noexcept
} }
void void
TagBuilder::AddItem(TagType type, StringView value) noexcept TagBuilder::AddItem(TagType type, std::string_view value) noexcept
{ {
if (value.empty() || !IsTagEnabled(type)) if (value.empty() || !IsTagEnabled(type))
return; return;
@ -234,7 +233,7 @@ TagBuilder::AddItem(TagType type, StringView value) noexcept
void void
TagBuilder::AddItem(TagType type, const char *value) noexcept TagBuilder::AddItem(TagType type, const char *value) noexcept
{ {
AddItem(type, StringView(value)); AddItem(type, std::string_view(value));
} }
void void

View File

@ -23,10 +23,10 @@
#include "Type.h" #include "Type.h"
#include "Chrono.hxx" #include "Chrono.hxx"
#include <vector>
#include <memory> #include <memory>
#include <string_view>
#include <vector>
struct StringView;
struct TagItem; struct TagItem;
struct Tag; struct Tag;
@ -137,7 +137,7 @@ public:
* A variant of AddItem() which does not attempt to fix up the * A variant of AddItem() which does not attempt to fix up the
* value and does not check whether the tag type is disabled. * value and does not check whether the tag type is disabled.
*/ */
void AddItemUnchecked(TagType type, StringView value) noexcept; void AddItemUnchecked(TagType type, std::string_view value) noexcept;
/** /**
* Appends a new tag item. * Appends a new tag item.
@ -146,7 +146,7 @@ public:
* @param value the value of the tag item (not null-terminated) * @param value the value of the tag item (not null-terminated)
* @param length the length of #value * @param length the length of #value
*/ */
void AddItem(TagType type, StringView value) noexcept; void AddItem(TagType type, std::string_view value) noexcept;
/** /**
* Appends a new tag item. * Appends a new tag item.
@ -175,7 +175,7 @@ public:
void RemoveType(TagType type) noexcept; void RemoveType(TagType type) noexcept;
private: private:
void AddItemInternal(TagType type, StringView value) noexcept; void AddItemInternal(TagType type, std::string_view value) noexcept;
}; };
#endif #endif