Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
80ec6f97
Commit
80ec6f97
authored
Jun 06, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Table: add StringView overloads
parent
589639f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
Table.cxx
src/tag/Table.cxx
+21
-1
Table.hxx
src/tag/Table.hxx
+11
-1
No files found.
src/tag/Table.cxx
View file @
80ec6f97
/*
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
* http://www.musicpd.org
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
...
@@ -37,6 +37,16 @@ tag_table_lookup(const struct tag_table *table, const char *name) noexcept
...
@@ -37,6 +37,16 @@ tag_table_lookup(const struct tag_table *table, const char *name) noexcept
return
TAG_NUM_OF_ITEM_TYPES
;
return
TAG_NUM_OF_ITEM_TYPES
;
}
}
TagType
tag_table_lookup
(
const
struct
tag_table
*
table
,
StringView
name
)
noexcept
{
for
(;
table
->
name
!=
nullptr
;
++
table
)
if
(
name
.
Equals
(
table
->
name
))
return
table
->
type
;
return
TAG_NUM_OF_ITEM_TYPES
;
}
/**
/**
* Looks up a string in a tag translation table (case insensitive).
* Looks up a string in a tag translation table (case insensitive).
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
...
@@ -52,6 +62,16 @@ tag_table_lookup_i(const struct tag_table *table, const char *name) noexcept
...
@@ -52,6 +62,16 @@ tag_table_lookup_i(const struct tag_table *table, const char *name) noexcept
return
TAG_NUM_OF_ITEM_TYPES
;
return
TAG_NUM_OF_ITEM_TYPES
;
}
}
TagType
tag_table_lookup_i
(
const
struct
tag_table
*
table
,
StringView
name
)
noexcept
{
for
(;
table
->
name
!=
nullptr
;
++
table
)
if
(
name
.
EqualsIgnoreCase
(
table
->
name
))
return
table
->
type
;
return
TAG_NUM_OF_ITEM_TYPES
;
}
const
char
*
const
char
*
tag_table_lookup
(
const
tag_table
*
table
,
TagType
type
)
noexcept
tag_table_lookup
(
const
tag_table
*
table
,
TagType
type
)
noexcept
{
{
...
...
src/tag/Table.hxx
View file @
80ec6f97
/*
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
* http://www.musicpd.org
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
#include "Type.h"
#include "Type.h"
#include "util/Compiler.h"
#include "util/Compiler.h"
struct
StringView
;
struct
tag_table
{
struct
tag_table
{
const
char
*
name
;
const
char
*
name
;
...
@@ -38,6 +40,10 @@ gcc_pure
...
@@ -38,6 +40,10 @@ gcc_pure
TagType
TagType
tag_table_lookup
(
const
tag_table
*
table
,
const
char
*
name
)
noexcept
;
tag_table_lookup
(
const
tag_table
*
table
,
const
char
*
name
)
noexcept
;
gcc_pure
TagType
tag_table_lookup
(
const
tag_table
*
table
,
StringView
name
)
noexcept
;
/**
/**
* Looks up a string in a tag translation table (case insensitive).
* Looks up a string in a tag translation table (case insensitive).
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
...
@@ -47,6 +53,10 @@ gcc_pure
...
@@ -47,6 +53,10 @@ gcc_pure
TagType
TagType
tag_table_lookup_i
(
const
tag_table
*
table
,
const
char
*
name
)
noexcept
;
tag_table_lookup_i
(
const
tag_table
*
table
,
const
char
*
name
)
noexcept
;
gcc_pure
TagType
tag_table_lookup_i
(
const
tag_table
*
table
,
StringView
name
)
noexcept
;
/**
/**
* Looks up a #TagType in a tag translation table and returns its
* Looks up a #TagType in a tag translation table and returns its
* string representation. Returns nullptr if the specified type was
* string representation. Returns nullptr if the specified type was
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment