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