VTB: release CVBuffer after it actually has been rendered
[xbmc.git] / xbmc / NfoFile.h
blobc985f9b8739f757c859f4e05b8aa6ea2964b8be2
1 /*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
20 // NfoFile.h: interface for the CNfoFile class.
22 //////////////////////////////////////////////////////////////////////
24 #if !defined(AFX_NfoFile_H__641CCF68_6D2A_426E_9204_C0E4BEF12D00__INCLUDED_)
25 #define AFX_NfoFile_H__641CCF68_6D2A_426E_9204_C0E4BEF12D00__INCLUDED_
27 #pragma once
28 #include <string>
30 #include "addons/Scraper.h"
32 class CNfoFile
34 public:
35 CNfoFile() : m_headPos(0), m_type(ADDON::ADDON_UNKNOWN) {}
36 virtual ~CNfoFile() { Close(); }
38 enum NFOResult
40 NO_NFO = 0,
41 FULL_NFO = 1,
42 URL_NFO = 2,
43 COMBINED_NFO = 3,
44 ERROR_NFO = 4,
45 PARTIAL_NFO = 5
48 NFOResult Create(const std::string&, const ADDON::ScraperPtr&, int episode=-1);
49 template<class T>
50 bool GetDetails(T& details, const char* document=NULL,
51 bool prioritise=false)
53 CXBMCTinyXML doc;
54 if (document)
55 doc.Parse(document, TIXML_ENCODING_UNKNOWN);
56 else if (m_headPos < m_doc.size())
57 doc.Parse(m_doc.substr(m_headPos), TIXML_ENCODING_UNKNOWN);
58 else
59 return false;
61 return details.Load(doc.RootElement(), true, prioritise);
64 void Close();
65 void SetScraperInfo(const ADDON::ScraperPtr& info) { m_info = info; }
66 const ADDON::ScraperPtr& GetScraperInfo() const { return m_info; }
67 const CScraperUrl &ScraperUrl() const { return m_scurl; }
69 private:
70 std::string m_doc;
71 size_t m_headPos;
72 ADDON::ScraperPtr m_info;
73 ADDON::TYPE m_type;
74 CScraperUrl m_scurl;
76 int Load(const std::string&);
77 int Scrape(ADDON::ScraperPtr& scraper);
80 #endif // !defined(AFX_NfoFile_H__641CCF68_6D2A_426E_9204_C0E4BEF12D00__INCLUDED_)