Music Hub
..
A session-wide music playback service
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
macros.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2013 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
17
*/
18
19
#ifndef MPRIS_MACROS_H_
20
#define MPRIS_MACROS_H_
21
22
#include <core/dbus/types/object_path.h>
23
24
#include <chrono>
25
#include <string>
26
27
#define SECONDS(seconds) std::chrono::seconds{seconds};
28
29
#define METHOD_WITH_TIMEOUT_MS(Name, Itf, Timeout) \
30
struct Name \
31
{ \
32
typedef Itf Interface; \
33
inline static const std::string& name() \
34
{ \
35
static const std::string s{#Name}; \
36
return s; \
37
} \
38
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::milliseconds{Timeout}; } \
39
};\
40
41
#define METHOD(Name, Itf, Timeout) \
42
struct Name \
43
{ \
44
typedef Itf Interface; \
45
inline static const std::string& name() \
46
{ \
47
static const std::string s{#Name}; \
48
return s; \
49
} \
50
inline static const std::chrono::milliseconds default_timeout() { return std::chrono::milliseconds{7000}; } \
51
};\
52
53
#define SIGNAL(Name, Itf, ArgType) \
54
struct Name \
55
{ \
56
inline static std::string name() \
57
{ \
58
return #Name; \
59
}; \
60
typedef Itf Interface; \
61
typedef ArgType ArgumentType; \
62
};\
63
64
#define READABLE_PROPERTY(Name, Itf, Type) \
65
struct Name \
66
{ \
67
inline static std::string name() \
68
{ \
69
return #Name; \
70
}; \
71
typedef Itf Interface; \
72
typedef Type ValueType; \
73
static const bool readable = true; \
74
static const bool writable = false; \
75
}; \
76
77
#define WRITABLE_PROPERTY(Name, Itf, Type) \
78
struct Name \
79
{ \
80
inline static std::string name() \
81
{ \
82
return #Name; \
83
}; \
84
typedef Itf Interface; \
85
typedef Type ValueType; \
86
static const bool readable = true; \
87
static const bool writable = true; \
88
}; \
89
90
#endif // MPRIS_MACROS_H_
91
src
core
media
mpris
macros.h
Generated on Fri Aug 29 2014 22:10:16 for Music Hub by
1.8.8