tag/Table: use std::string_view
This commit is contained in:
parent
1a2b505979
commit
455a412aaa
@ -19,7 +19,7 @@
|
||||
|
||||
#include "Table.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -39,10 +39,10 @@ tag_table_lookup(const struct tag_table *table, const char *name) noexcept
|
||||
}
|
||||
|
||||
TagType
|
||||
tag_table_lookup(const struct tag_table *table, StringView name) noexcept
|
||||
tag_table_lookup(const struct tag_table *table, std::string_view name) noexcept
|
||||
{
|
||||
for (; table->name != nullptr; ++table)
|
||||
if (name.Equals(table->name))
|
||||
if (name == table->name)
|
||||
return table->type;
|
||||
|
||||
return TAG_NUM_OF_ITEM_TYPES;
|
||||
@ -64,10 +64,11 @@ tag_table_lookup_i(const struct tag_table *table, const char *name) noexcept
|
||||
}
|
||||
|
||||
TagType
|
||||
tag_table_lookup_i(const struct tag_table *table, StringView name) noexcept
|
||||
tag_table_lookup_i(const struct tag_table *table,
|
||||
std::string_view name) noexcept
|
||||
{
|
||||
for (; table->name != nullptr; ++table)
|
||||
if (name.EqualsIgnoreCase(table->name))
|
||||
if (StringIsEqualIgnoreCase(name, table->name))
|
||||
return table->type;
|
||||
|
||||
return TAG_NUM_OF_ITEM_TYPES;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "Type.h"
|
||||
|
||||
struct StringView;
|
||||
#include <string_view>
|
||||
|
||||
struct tag_table {
|
||||
const char *name;
|
||||
@ -41,7 +41,7 @@ tag_table_lookup(const tag_table *table, const char *name) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
TagType
|
||||
tag_table_lookup(const tag_table *table, StringView name) noexcept;
|
||||
tag_table_lookup(const tag_table *table, std::string_view name) noexcept;
|
||||
|
||||
/**
|
||||
* Looks up a string in a tag translation table (case insensitive).
|
||||
@ -54,7 +54,7 @@ tag_table_lookup_i(const tag_table *table, const char *name) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
TagType
|
||||
tag_table_lookup_i(const tag_table *table, StringView name) noexcept;
|
||||
tag_table_lookup_i(const tag_table *table, std::string_view name) noexcept;
|
||||
|
||||
/**
|
||||
* Looks up a #TagType in a tag translation table and returns its
|
||||
|
Loading…
Reference in New Issue
Block a user