18 #ifndef CORE_UBUNTU_MEDIA_TRACK_H_ 19 #define CORE_UBUNTU_MEDIA_TRACK_H_ 41 typedef std::string
Id;
49 static constexpr
const char*
TrackIdKey =
"mpris:trackid";
53 return map == rhs.map;
58 return map != rhs.map;
61 template<
typename Tag>
64 return count(Tag::name());
67 template<
typename Tag>
68 void set(
const typename Tag::ValueType& value)
70 std::stringstream ss; ss << value;
71 set(Tag::name(), ss.str());
74 template<
typename Tag>
75 typename Tag::ValueType
get()
const 77 std::stringstream ss(
get(Tag::name()));
78 typename Tag::ValueType value; ss >> value;
80 return std::move(value);
83 std::size_t
count(
const std::string& key)
const 85 return map.count(key);
88 void set(
const std::string& key,
const std::string& value)
93 const std::string&
get(
const std::string& key)
const 98 bool is_set(
const std::string& key)
const 101 return !map.at(key).empty();
102 }
catch (
const std::out_of_range& e) {
107 const std::map<std::string, std::string>&
operator*()
const 112 std::string
encode(
const std::string& key)
const;
114 const std::string&
album()
const;
115 const std::string&
artist()
const;
116 const std::string&
title()
const;
117 const std::string&
track_id()
const;
119 const std::string&
art_url()
const;
122 void set_album(
const std::string& album);
124 void set_title(
const std::string& title);
141 virtual const Id&
id()
const;
142 virtual const UriType&
uri()
const;
146 std::unique_ptr<Private> d;
152 #endif // CORE_UBUNTU_MEDIA_TRACK_H_