VDPAU: improve error handling, Gotham
[vuplus_xbmc] / xbmc / CueDocument.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "music/Song.h"
24 #include "filesystem/File.h"
25
26 #define MAX_PATH_SIZE 1024
27
28 class CCueDocument
29 {
30   class CCueTrack
31   {
32   public:
33     CCueTrack()
34     {
35       iTrackNumber = 0;
36       iStartTime = 0;
37       iEndTime = 0;
38       replayGainTrackGain = 0.0f;
39       replayGainTrackPeak = 0.0f;
40     }
41     CStdString strArtist;
42     CStdString strTitle;
43     CStdString strFile;
44     int iTrackNumber;
45     int iStartTime;
46     int iEndTime;
47     float replayGainTrackGain;
48     float replayGainTrackPeak;
49   };
50
51 public:
52   CCueDocument(void);
53   ~CCueDocument(void);
54   // USED
55   bool Parse(const CStdString &strFile);
56   void GetSongs(VECSONGS &songs);
57   CStdString GetMediaPath();
58   CStdString GetMediaTitle();
59   void GetMediaFiles(std::vector<CStdString>& mediaFiles);
60
61 private:
62
63   // USED for file access
64   XFILE::CFile m_file;
65   char m_szBuffer[1024];
66
67   // Member variables
68   CStdString m_strArtist;  // album artist
69   CStdString m_strAlbum;  // album title
70   CStdString m_strGenre;  // album genre
71   int m_iYear;            //album year
72   int m_iTrack;   // current track
73   int m_iTotalTracks;  // total tracks
74   int m_iDiscNumber;  // Disc number
75   float m_replayGainAlbumGain;
76   float m_replayGainAlbumPeak;
77
78   // cuetrack array
79   std::vector<CCueTrack> m_Track;
80
81   bool ReadNextLine(CStdString &strLine);
82   CStdString ExtractInfo(const CStdString &line);
83   int ExtractTimeFromIndex(const CStdString &index);
84   int ExtractNumericInfo(const CStdString &info);
85   bool ResolvePath(CStdString &strPath, const CStdString &strBase);
86 };