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
f686e838
Commit
f686e838
authored
7 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Builder: add "noexcept"
parent
ea8642de
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
32 deletions
+32
-32
Builder.cxx
src/tag/Builder.cxx
+14
-14
Builder.hxx
src/tag/Builder.hxx
+18
-18
No files found.
src/tag/Builder.cxx
View file @
f686e838
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include <assert.h>
#include <assert.h>
#include <stdlib.h>
#include <stdlib.h>
TagBuilder
::
TagBuilder
(
const
Tag
&
other
)
TagBuilder
::
TagBuilder
(
const
Tag
&
other
)
noexcept
:
duration
(
other
.
duration
),
has_playlist
(
other
.
has_playlist
)
:
duration
(
other
.
duration
),
has_playlist
(
other
.
has_playlist
)
{
{
items
.
reserve
(
other
.
num_items
);
items
.
reserve
(
other
.
num_items
);
...
@@ -42,7 +42,7 @@ TagBuilder::TagBuilder(const Tag &other)
...
@@ -42,7 +42,7 @@ TagBuilder::TagBuilder(const Tag &other)
tag_pool_lock
.
unlock
();
tag_pool_lock
.
unlock
();
}
}
TagBuilder
::
TagBuilder
(
Tag
&&
other
)
TagBuilder
::
TagBuilder
(
Tag
&&
other
)
noexcept
:
duration
(
other
.
duration
),
has_playlist
(
other
.
has_playlist
)
:
duration
(
other
.
duration
),
has_playlist
(
other
.
has_playlist
)
{
{
/* move all TagItem pointers from the Tag object; we don't
/* move all TagItem pointers from the Tag object; we don't
...
@@ -58,7 +58,7 @@ TagBuilder::TagBuilder(Tag &&other)
...
@@ -58,7 +58,7 @@ TagBuilder::TagBuilder(Tag &&other)
}
}
TagBuilder
&
TagBuilder
&
TagBuilder
::
operator
=
(
const
TagBuilder
&
other
)
TagBuilder
::
operator
=
(
const
TagBuilder
&
other
)
noexcept
{
{
/* copy all attributes */
/* copy all attributes */
duration
=
other
.
duration
;
duration
=
other
.
duration
;
...
@@ -75,7 +75,7 @@ TagBuilder::operator=(const TagBuilder &other)
...
@@ -75,7 +75,7 @@ TagBuilder::operator=(const TagBuilder &other)
}
}
TagBuilder
&
TagBuilder
&
TagBuilder
::
operator
=
(
TagBuilder
&&
other
)
TagBuilder
::
operator
=
(
TagBuilder
&&
other
)
noexcept
{
{
duration
=
other
.
duration
;
duration
=
other
.
duration
;
has_playlist
=
other
.
has_playlist
;
has_playlist
=
other
.
has_playlist
;
...
@@ -85,7 +85,7 @@ TagBuilder::operator=(TagBuilder &&other)
...
@@ -85,7 +85,7 @@ TagBuilder::operator=(TagBuilder &&other)
}
}
TagBuilder
&
TagBuilder
&
TagBuilder
::
operator
=
(
Tag
&&
other
)
TagBuilder
::
operator
=
(
Tag
&&
other
)
noexcept
{
{
duration
=
other
.
duration
;
duration
=
other
.
duration
;
has_playlist
=
other
.
has_playlist
;
has_playlist
=
other
.
has_playlist
;
...
@@ -106,7 +106,7 @@ TagBuilder::operator=(Tag &&other)
...
@@ -106,7 +106,7 @@ TagBuilder::operator=(Tag &&other)
}
}
void
void
TagBuilder
::
Clear
()
TagBuilder
::
Clear
()
noexcept
{
{
duration
=
SignedSongTime
::
Negative
();
duration
=
SignedSongTime
::
Negative
();
has_playlist
=
false
;
has_playlist
=
false
;
...
@@ -114,7 +114,7 @@ TagBuilder::Clear()
...
@@ -114,7 +114,7 @@ TagBuilder::Clear()
}
}
void
void
TagBuilder
::
Commit
(
Tag
&
tag
)
TagBuilder
::
Commit
(
Tag
&
tag
)
noexcept
{
{
tag
.
Clear
();
tag
.
Clear
();
...
@@ -137,7 +137,7 @@ TagBuilder::Commit(Tag &tag)
...
@@ -137,7 +137,7 @@ TagBuilder::Commit(Tag &tag)
}
}
Tag
Tag
TagBuilder
::
Commit
()
TagBuilder
::
Commit
()
noexcept
{
{
Tag
tag
;
Tag
tag
;
Commit
(
tag
);
Commit
(
tag
);
...
@@ -145,7 +145,7 @@ TagBuilder::Commit()
...
@@ -145,7 +145,7 @@ TagBuilder::Commit()
}
}
std
::
unique_ptr
<
Tag
>
std
::
unique_ptr
<
Tag
>
TagBuilder
::
CommitNew
()
TagBuilder
::
CommitNew
()
noexcept
{
{
std
::
unique_ptr
<
Tag
>
tag
(
new
Tag
());
std
::
unique_ptr
<
Tag
>
tag
(
new
Tag
());
Commit
(
*
tag
);
Commit
(
*
tag
);
...
@@ -163,7 +163,7 @@ TagBuilder::HasType(TagType type) const noexcept
...
@@ -163,7 +163,7 @@ TagBuilder::HasType(TagType type) const noexcept
}
}
void
void
TagBuilder
::
Complement
(
const
Tag
&
other
)
TagBuilder
::
Complement
(
const
Tag
&
other
)
noexcept
{
{
if
(
duration
.
IsNegative
())
if
(
duration
.
IsNegative
())
duration
=
other
.
duration
;
duration
=
other
.
duration
;
...
@@ -189,7 +189,7 @@ TagBuilder::Complement(const Tag &other)
...
@@ -189,7 +189,7 @@ TagBuilder::Complement(const Tag &other)
}
}
inline
void
inline
void
TagBuilder
::
AddItemInternal
(
TagType
type
,
StringView
value
)
TagBuilder
::
AddItemInternal
(
TagType
type
,
StringView
value
)
noexcept
{
{
assert
(
!
value
.
empty
());
assert
(
!
value
.
empty
());
...
@@ -207,7 +207,7 @@ TagBuilder::AddItemInternal(TagType type, StringView value)
...
@@ -207,7 +207,7 @@ TagBuilder::AddItemInternal(TagType type, StringView value)
}
}
void
void
TagBuilder
::
AddItem
(
TagType
type
,
StringView
value
)
TagBuilder
::
AddItem
(
TagType
type
,
StringView
value
)
noexcept
{
{
if
(
value
.
empty
()
||
!
IsTagEnabled
(
type
))
if
(
value
.
empty
()
||
!
IsTagEnabled
(
type
))
return
;
return
;
...
@@ -216,7 +216,7 @@ TagBuilder::AddItem(TagType type, StringView value)
...
@@ -216,7 +216,7 @@ TagBuilder::AddItem(TagType type, StringView value)
}
}
void
void
TagBuilder
::
AddItem
(
TagType
type
,
const
char
*
value
)
TagBuilder
::
AddItem
(
TagType
type
,
const
char
*
value
)
noexcept
{
{
#if !CLANG_CHECK_VERSION(3,6)
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
/* disabled on clang due to -Wtautological-pointer-compare */
...
@@ -227,7 +227,7 @@ TagBuilder::AddItem(TagType type, const char *value)
...
@@ -227,7 +227,7 @@ TagBuilder::AddItem(TagType type, const char *value)
}
}
void
void
TagBuilder
::
AddEmptyItem
(
TagType
type
)
TagBuilder
::
AddEmptyItem
(
TagType
type
)
noexcept
{
{
tag_pool_lock
.
lock
();
tag_pool_lock
.
lock
();
auto
i
=
tag_pool_get_item
(
type
,
""
);
auto
i
=
tag_pool_get_item
(
type
,
""
);
...
...
This diff is collapsed.
Click to expand it.
src/tag/Builder.hxx
View file @
f686e838
...
@@ -56,19 +56,19 @@ public:
...
@@ -56,19 +56,19 @@ public:
*/
*/
TagBuilder
()
=
default
;
TagBuilder
()
=
default
;
~
TagBuilder
()
{
~
TagBuilder
()
noexcept
{
Clear
();
Clear
();
}
}
TagBuilder
(
const
TagBuilder
&
other
)
=
delete
;
TagBuilder
(
const
TagBuilder
&
other
)
=
delete
;
explicit
TagBuilder
(
const
Tag
&
other
);
explicit
TagBuilder
(
const
Tag
&
other
)
noexcept
;
explicit
TagBuilder
(
Tag
&&
other
);
explicit
TagBuilder
(
Tag
&&
other
)
noexcept
;
TagBuilder
&
operator
=
(
const
TagBuilder
&
other
);
TagBuilder
&
operator
=
(
const
TagBuilder
&
other
)
noexcept
;
TagBuilder
&
operator
=
(
TagBuilder
&&
other
);
TagBuilder
&
operator
=
(
TagBuilder
&&
other
)
noexcept
;
TagBuilder
&
operator
=
(
Tag
&&
other
);
TagBuilder
&
operator
=
(
Tag
&&
other
)
noexcept
;
/**
/**
* Returns true if the tag contains no items. This ignores
* Returns true if the tag contains no items. This ignores
...
@@ -86,36 +86,36 @@ public:
...
@@ -86,36 +86,36 @@ public:
return
!
duration
.
IsNegative
()
||
has_playlist
||
!
empty
();
return
!
duration
.
IsNegative
()
||
has_playlist
||
!
empty
();
}
}
void
Clear
();
void
Clear
()
noexcept
;
/**
/**
* Move this object to the given #Tag instance. This object
* Move this object to the given #Tag instance. This object
* is empty afterwards.
* is empty afterwards.
*/
*/
void
Commit
(
Tag
&
tag
);
void
Commit
(
Tag
&
tag
)
noexcept
;
/**
/**
* Create a new #Tag instance from data in this object. This
* Create a new #Tag instance from data in this object. This
* object is empty afterwards.
* object is empty afterwards.
*/
*/
Tag
Commit
();
Tag
Commit
()
noexcept
;
/**
/**
* Create a new #Tag instance from data in this object. The
* Create a new #Tag instance from data in this object. The
* returned object is owned by the caller. This object is
* returned object is owned by the caller. This object is
* empty afterwards.
* empty afterwards.
*/
*/
std
::
unique_ptr
<
Tag
>
CommitNew
();
std
::
unique_ptr
<
Tag
>
CommitNew
()
noexcept
;
void
SetDuration
(
SignedSongTime
_duration
)
{
void
SetDuration
(
SignedSongTime
_duration
)
noexcept
{
duration
=
_duration
;
duration
=
_duration
;
}
}
void
SetHasPlaylist
(
bool
_has_playlist
)
{
void
SetHasPlaylist
(
bool
_has_playlist
)
noexcept
{
has_playlist
=
_has_playlist
;
has_playlist
=
_has_playlist
;
}
}
void
Reserve
(
unsigned
n
)
{
void
Reserve
(
unsigned
n
)
noexcept
{
items
.
reserve
(
n
);
items
.
reserve
(
n
);
}
}
...
@@ -130,7 +130,7 @@ public:
...
@@ -130,7 +130,7 @@ public:
* Copy attributes and items from the other object that do not
* Copy attributes and items from the other object that do not
* exist in this object.
* exist in this object.
*/
*/
void
Complement
(
const
Tag
&
other
);
void
Complement
(
const
Tag
&
other
)
noexcept
;
/**
/**
* Appends a new tag item.
* Appends a new tag item.
...
@@ -140,7 +140,7 @@ public:
...
@@ -140,7 +140,7 @@ public:
* @param length the length of #value
* @param length the length of #value
*/
*/
gcc_nonnull_all
gcc_nonnull_all
void
AddItem
(
TagType
type
,
StringView
value
);
void
AddItem
(
TagType
type
,
StringView
value
)
noexcept
;
/**
/**
* Appends a new tag item.
* Appends a new tag item.
...
@@ -149,14 +149,14 @@ public:
...
@@ -149,14 +149,14 @@ public:
* @param value the value of the tag item (null-terminated)
* @param value the value of the tag item (null-terminated)
*/
*/
gcc_nonnull_all
gcc_nonnull_all
void
AddItem
(
TagType
type
,
const
char
*
value
);
void
AddItem
(
TagType
type
,
const
char
*
value
)
noexcept
;
/**
/**
* Appends a new tag item with an empty value. Do not use
* Appends a new tag item with an empty value. Do not use
* this unless you know what you're doing - because usually,
* this unless you know what you're doing - because usually,
* empty values are discarded.
* empty values are discarded.
*/
*/
void
AddEmptyItem
(
TagType
type
);
void
AddEmptyItem
(
TagType
type
)
noexcept
;
/**
/**
* Removes all tag items.
* Removes all tag items.
...
@@ -170,7 +170,7 @@ public:
...
@@ -170,7 +170,7 @@ public:
private
:
private
:
gcc_nonnull_all
gcc_nonnull_all
void
AddItemInternal
(
TagType
type
,
StringView
value
);
void
AddItemInternal
(
TagType
type
,
StringView
value
)
noexcept
;
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
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