Music Hub  ..
A session-wide music playback service
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
engine.cpp
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 #include "engine.h"
20 
21 #include <exception>
22 #include <stdexcept>
23 
24 namespace media = core::ubuntu::media;
25 
26 const std::string& media::Engine::Xesam::album()
27 {
28  static const std::string s{"xesam:album"};
29  return s;
30 }
31 
32 const std::string& media::Engine::Xesam::album_artist()
33 {
34  static const std::string s{"xesam:album_artist"};
35  return s;
36 }
37 
38 const std::string& media::Engine::Xesam::artist()
39 {
40  static const std::string s{"xesam:artist"};
41  return s;
42 }
43 
44 const std::string& media::Engine::Xesam::as_text()
45 {
46  static const std::string s{"xesam:as_text"};
47  return s;
48 }
49 
50 const std::string& media::Engine::Xesam::audio_bpm()
51 {
52  static const std::string s{"xesam:audio_bmp"};
53  return s;
54 }
55 
56 const std::string& media::Engine::Xesam::auto_rating()
57 {
58  static const std::string s{"xesam:autoRating"};
59  return s;
60 }
61 
62 const std::string& media::Engine::Xesam::comment()
63 {
64  static const std::string s{"xesam:comment"};
65  return s;
66 }
67 
68 const std::string& media::Engine::Xesam::composer()
69 {
70  static const std::string s{"xesam:composer"};
71  return s;
72 }
73 
74 const std::string& media::Engine::Xesam::content_created()
75 {
76  static const std::string s{"xesam:contentCreated"};
77  return s;
78 }
79 
80 const std::string& media::Engine::Xesam::disc_number()
81 {
82  static const std::string s{"xesam:discNumber"};
83  return s;
84 }
85 
86 const std::string& media::Engine::Xesam::first_used()
87 {
88  static const std::string s{"xesam:firstUsed"};
89  return s;
90 }
91 
92 const std::string& media::Engine::Xesam::genre()
93 {
94  static const std::string s{"xesam:genre"};
95  return s;
96 }
97 
98 const std::string& media::Engine::Xesam::last_used()
99 {
100  static const std::string s{"xesam:lastUsed"};
101  return s;
102 }
103 
104 const std::string& media::Engine::Xesam::lyricist()
105 {
106  static const std::string s{"xesam:lyricist"};
107  return s;
108 }
109 
110 const std::string& media::Engine::Xesam::title()
111 {
112  static const std::string s{"xesam:title"};
113  return s;
114 }
115 
116 const std::string& media::Engine::Xesam::track_number()
117 {
118  static const std::string s{"xesam:trackNumber"};
119  return s;
120 }
121 
122 const std::string& media::Engine::Xesam::url()
123 {
124  static const std::string s{"xesam:url"};
125  return s;
126 }
127 
128 const std::string& media::Engine::Xesam::use_count()
129 {
130  static const std::string s{"xesam:useCount"};
131  return s;
132 }
133 
134 const std::string& media::Engine::Xesam::user_rating()
135 {
136  static const std::string s{"xesam:userRating"};
137  return s;
138 }
139 
140 double media::Engine::Volume::min()
141 {
142  return 0.;
143 }
144 
145 double media::Engine::Volume::max()
146 {
147  return 1.;
148 }
149 
150 media::Engine::Volume::Volume(double v) : value(v)
151 {
152  if (value < min() || value > max())
153  throw std::runtime_error("Value exceeds limits");
154 }
155 
157 {
158  return value != rhs.value;
159 }
160 
162 {
163  return value == rhs.value;
164 }
bool operator!=(const Volume &rhs) const
Definition: engine.cpp:156
bool operator==(const Volume &rhs) const
Definition: engine.cpp:161