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
20ebacf4
Commit
20ebacf4
authored
Dec 02, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tag: add methods RemoveAll(), RemoveType()
parent
c6ef0e88
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
Tag.cxx
src/tag/Tag.cxx
+20
-0
Tag.hxx
src/tag/Tag.hxx
+12
-0
No files found.
src/tag/Tag.cxx
View file @
20ebacf4
...
...
@@ -223,3 +223,23 @@ Tag::AddItem(TagType type, const char *value)
{
AddItem
(
type
,
value
,
strlen
(
value
));
}
void
Tag
::
RemoveType
(
TagType
type
)
{
auto
dest
=
items
,
src
=
items
,
end
=
items
+
num_items
;
tag_pool_lock
.
lock
();
while
(
src
!=
end
)
{
TagItem
*
item
=
*
src
++
;
if
(
item
->
type
==
type
)
/* remove it */
tag_pool_put_item
(
item
);
else
/* keep it */
*
dest
++
=
item
;
}
tag_pool_lock
.
unlock
();
num_items
=
dest
-
items
;
}
src/tag/Tag.hxx
View file @
20ebacf4
...
...
@@ -122,6 +122,18 @@ struct Tag {
void
AddItem
(
TagType
type
,
const
char
*
value
);
/**
* Removes all tag items.
*/
void
RemoveAll
()
{
num_items
=
0
;
}
/**
* Removes all tag items of the specified type.
*/
void
RemoveType
(
TagType
type
);
/**
* Merges the data from two tags. If both tags share data for the
* same TagType, only data from "add" is used.
*
...
...
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