OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_LIBRARY_PARSER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_LIBRARY_PARSER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <set> |
| 10 |
| 11 #include "base/files/file_path.h" |
| 12 |
| 13 namespace itunes { |
| 14 |
| 15 class ITunesLibraryParser { |
| 16 public: |
| 17 struct Track { |
| 18 Track(uint64 id, const base::FilePath& location); |
| 19 bool operator<(const Track& other) const; |
| 20 |
| 21 uint64 id; |
| 22 base::FilePath location; |
| 23 }; |
| 24 |
| 25 typedef std::set<Track> Album; |
| 26 typedef std::map<std::string /*album name*/, Album> Albums; |
| 27 typedef std::map<std::string /*artist name*/, Albums> Library; |
| 28 |
| 29 ITunesLibraryParser(); |
| 30 ~ITunesLibraryParser(); |
| 31 |
| 32 // Returns true if at least one track was found. Malformed track entries |
| 33 // are silently ignored. |
| 34 bool Parse(const std::string& xml); |
| 35 |
| 36 const Library& library() { return library_; } |
| 37 |
| 38 private: |
| 39 Library library_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(ITunesLibraryParser); |
| 42 }; |
| 43 |
| 44 } // namespace itunes |
| 45 |
| 46 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_LIBRARY_PARSER_H_ |
OLD | NEW |