Merge pull request #4676 from jmarshallnz/dont_set_scraper_on_tvshow_on_nfo
[vuplus_xbmc] / xbmc / utils / XSLTUtils.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://www.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 <string>
24 #include <libxslt/xslt.h>
25 #include <libxslt/xsltutils.h>
26
27 class XSLTUtils
28 {
29 public:
30   XSLTUtils();
31   ~XSLTUtils();
32
33   /*! \brief Set the input XML for an XSLT transform from a string.
34    This sets up the XSLT transformer with some input XML from a string in memory.
35    The input XML should be well formed.
36    \param input    the XML document to be transformed.
37    */
38   bool  SetInput(const std::string& input);
39
40   /*! \brief Set the stylesheet (XSL) for an XSLT transform from a string.
41    This sets up the XSLT transformer with some stylesheet XML from a string in memory.
42    The input XSL should be well formed.
43    \param input    the XSL document to be transformed.
44    */
45   bool  SetStylesheet(const std::string& stylesheet);
46
47   /*! \brief Perform an XSLT transform on an inbound XML document.
48    This will apply an XSLT transformation on an input XML document,
49    giving an output XML document, using the specified XSLT document
50    as the transformer.
51    \param input    the parent containing the <tag>'s.
52    \param filename         the <tag> in question.
53    */
54   bool  XSLTTransform(std::string& output);
55
56
57 private:
58   xmlDocPtr m_xmlInput;
59   xmlDocPtr m_xmlOutput;
60   xmlDocPtr m_xmlStylesheet;
61   xsltStylesheetPtr m_xsltStylesheet;
62 };