kodi
ScraperParser.h
1 /*
2  * Copyright (C) 2012-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include <string>
12 #include <vector>
13 
14 #define MAX_SCRAPER_BUFFERS 20
15 
16 namespace ADDON
17 {
18  class CScraper;
19 }
20 
21 class TiXmlElement;
22 class CXBMCTinyXML;
23 
24 class CScraperSettings;
25 
27 {
28 public:
30  CScraperParser(const CScraperParser& parser);
31  ~CScraperParser();
32  CScraperParser& operator= (const CScraperParser& parser);
33  bool Load(const std::string& strXMLFile);
34  bool IsNoop() const { return m_isNoop; }
35 
36  void Clear();
37  const std::string& GetFilename() const { return m_strFile; }
38  std::string GetSearchStringEncoding() const
39  { return m_SearchStringEncoding; }
40  const std::string Parse(const std::string& strTag,
42 
43  void AddDocument(const CXBMCTinyXML* doc);
44 
45  std::string m_param[MAX_SCRAPER_BUFFERS];
46 
47 private:
48  bool LoadFromXML();
49  void ReplaceBuffers(std::string& strDest);
50  void ParseExpression(const std::string& input, std::string& dest, TiXmlElement* element, bool bAppend);
51 
61  void ParseXSLT(const std::string& input, std::string& dest, TiXmlElement* element, bool bAppend);
62  void ParseNext(TiXmlElement* element);
63  void Clean(std::string& strDirty);
64  void ConvertJSON(std::string &string);
65  void ClearBuffers();
66  void GetBufferParams(bool* result, const char* attribute, bool defvalue);
67  void InsertToken(std::string& strOutput, int buf, const char* token);
68 
69  CXBMCTinyXML* m_document;
70  TiXmlElement* m_pRootElement;
71 
72  const char* m_SearchStringEncoding;
73  bool m_isNoop;
74 
75  std::string m_strFile;
76  ADDON::CScraper* m_scraper;
77 };
78 
Definition: XBMCTinyXML.h:33
Definition: scraper.py:1
Definition: Scraper.h:75
Definition: ScraperParser.h:26
Definition: Addon.cpp:39