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
96265234
Commit
96265234
authored
Jun 04, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neighbor/udisks: move code to class UDisks2::ParseObjects(ReadMessageIter)
parent
01501319
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
UDisks2.cxx
src/lib/dbus/UDisks2.cxx
+15
-0
UDisks2.hxx
src/lib/dbus/UDisks2.hxx
+9
-0
UdisksNeighborPlugin.cxx
src/neighbor/plugins/UdisksNeighborPlugin.cxx
+3
-6
No files found.
src/lib/dbus/UDisks2.cxx
View file @
96265234
...
...
@@ -19,6 +19,7 @@
#include "UDisks2.hxx"
#include "ReadIter.hxx"
#include "ObjectManager.hxx"
#include "util/StringAPI.hxx"
#include "Compiler.h"
...
...
@@ -98,4 +99,18 @@ ParseObject(Object &o, ODBus::ReadMessageIter &&i) noexcept
});
}
void
ParseObjects
(
ODBus
::
ReadMessageIter
&&
i
,
std
::
function
<
void
(
Object
&&
o
)
>
callback
)
{
using
namespace
ODBus
;
ForEachInterface
(
std
::
move
(
i
),
[
&
callback
](
const
char
*
path
,
auto
&&
j
){
Object
o
(
path
);
ParseObject
(
o
,
std
::
move
(
j
));
if
(
o
.
IsValid
())
callback
(
std
::
move
(
o
));
});
}
}
// namespace UDisks2
src/lib/dbus/UDisks2.hxx
View file @
96265234
...
...
@@ -21,6 +21,7 @@
#define UDISKS2_HXX
#include <string>
#include <functional>
#define UDISKS2_PATH "/org/freedesktop/UDisks2"
#define UDISKS2_INTERFACE "org.freedesktop.UDisks2"
...
...
@@ -57,6 +58,14 @@ struct Object {
void
ParseObject
(
Object
&
o
,
ODBus
::
ReadMessageIter
&&
i
)
noexcept
;
/**
* Parse objects from an array/dictionary and invoke the callback for
* each.
*/
void
ParseObjects
(
ODBus
::
ReadMessageIter
&&
i
,
std
::
function
<
void
(
Object
&&
o
)
>
callback
);
}
// namespace UDisks2
#endif
src/neighbor/plugins/UdisksNeighborPlugin.cxx
View file @
96265234
...
...
@@ -231,12 +231,9 @@ UdisksNeighborExplorer::OnListNotify(ODBus::Message reply) noexcept
return
;
}
ForEachInterface
(
i
.
Recurse
(),
[
this
](
const
char
*
path
,
auto
&&
j
){
UDisks2
::
Object
o
(
path
);
UDisks2
::
ParseObject
(
o
,
std
::
move
(
j
));
if
(
o
.
IsValid
())
Insert
(
std
::
move
(
o
));
});
ParseObjects
(
i
.
Recurse
(),
std
::
bind
(
&
UdisksNeighborExplorer
::
Insert
,
this
,
std
::
placeholders
::
_1
));
}
inline
DBusHandlerResult
...
...
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