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
3af35aee
Commit
3af35aee
authored
4 years ago
by
Max Kellermann
Committed by
Max Kellermann
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/TemplateString: add cast operators
parent
02314ac7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
AppendIter.hxx
src/lib/dbus/AppendIter.hxx
+4
-4
UdisksNeighborPlugin.cxx
src/neighbor/plugins/UdisksNeighborPlugin.cxx
+2
-2
TemplateString.hxx
src/util/TemplateString.hxx
+9
-0
No files found.
src/lib/dbus/AppendIter.hxx
View file @
3af35aee
...
...
@@ -103,7 +103,7 @@ public:
template
<
typename
T
>
AppendMessageIter
&
AppendEmptyArray
()
{
return
AppendMessageIter
(
*
this
,
DBUS_TYPE_ARRAY
,
T
::
as_string
.
value
)
T
::
as_string
)
.
CloseContainer
(
*
this
);
}
...
...
@@ -120,7 +120,7 @@ public:
AppendMessageIter
&
AppendVariant
(
const
T
&
value
)
{
typedef
VariantTypeTraits
Traits
;
return
AppendMessageIter
(
*
this
,
Traits
::
TYPE
,
Traits
::
as_string
.
value
)
Traits
::
as_string
)
.
Append
(
value
)
.
CloseContainer
(
*
this
);
}
...
...
@@ -146,7 +146,7 @@ public:
typedef
typename
W
::
ContainedTraits
ContainedTraits
;
return
AppendMessageIter
(
*
this
,
Traits
::
TYPE
,
ContainedTraits
::
as_string
.
value
)
ContainedTraits
::
as_string
)
.
Append
(
value
.
value
)
.
CloseContainer
(
*
this
);
}
...
...
@@ -158,7 +158,7 @@ public:
typedef
typename
W
::
ContainedTraits
ContainedTraits
;
return
AppendMessageIter
(
*
this
,
Traits
::
TYPE
,
ContainedTraits
::
as_string
.
value
)
ContainedTraits
::
as_string
)
.
AppendFixedArray
(
value
.
value
)
.
CloseContainer
(
*
this
);
}
...
...
This diff is collapsed.
Click to expand it.
src/neighbor/plugins/UdisksNeighborPlugin.cxx
View file @
3af35aee
...
...
@@ -245,7 +245,7 @@ UdisksNeighborExplorer::HandleMessage(DBusConnection *, DBusMessage *message) no
if
(
dbus_message_is_signal
(
message
,
DBUS_OM_INTERFACE
,
"InterfacesAdded"
)
&&
dbus_message_has_signature
(
message
,
InterfacesAddedType
::
as_string
.
value
))
{
dbus_message_has_signature
(
message
,
InterfacesAddedType
::
as_string
))
{
RecurseInterfaceDictEntry
(
ReadMessageIter
(
*
message
),
[
this
](
const
char
*
path
,
auto
&&
i
){
UDisks2
::
Object
o
(
path
);
UDisks2
::
ParseObject
(
o
,
std
::
forward
<
decltype
(
i
)
>
(
i
));
...
...
@@ -256,7 +256,7 @@ UdisksNeighborExplorer::HandleMessage(DBusConnection *, DBusMessage *message) no
return
DBUS_HANDLER_RESULT_HANDLED
;
}
else
if
(
dbus_message_is_signal
(
message
,
DBUS_OM_INTERFACE
,
"InterfacesRemoved"
)
&&
dbus_message_has_signature
(
message
,
InterfacesRemovedType
::
as_string
.
value
))
{
dbus_message_has_signature
(
message
,
InterfacesRemovedType
::
as_string
))
{
Remove
(
ReadMessageIter
(
*
message
).
GetString
());
return
DBUS_HANDLER_RESULT_HANDLED
;
}
else
...
...
This diff is collapsed.
Click to expand it.
src/util/TemplateString.hxx
View file @
3af35aee
...
...
@@ -32,6 +32,7 @@
#include <array> // for std::size()
#include <cstddef>
#include <string_view>
namespace
TemplateString
{
...
...
@@ -39,6 +40,14 @@ template<std::size_t _size>
struct
Buffer
{
static
constexpr
std
::
size_t
size
=
_size
;
char
value
[
size
+
1
];
constexpr
operator
const
char
*
()
const
noexcept
{
return
value
;
}
constexpr
operator
std
::
string_view
()
const
noexcept
{
return
{
value
,
size
};
}
};
/**
...
...
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