Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
iextension.hpp
1 //This program is free software: you can redistribute it and/or modify
2 //it under the terms of the GNU General Public License as published by
3 //the Free Software Foundation, either version 3 of the License, or
4 //(at your option) any later version.
5 
6 //This program is distributed in the hope that it will be useful,
7 //but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 //GNU General Public License for more details.
10 
11 #ifndef IEXTENSION_H
12 #define IEXTENSION_H
13 
14 #include <QtPlugin>
15 #include <QList>
16 #include <QString>
17 
18 #if _MSC_VER
19 #pragma warning ( push )
20 #pragma warning ( disable )
21 #else
22 #pragma GCC diagnostic push
23 #pragma GCC diagnostic ignored "-Wunused-parameter"
24 #endif
25 
26 namespace Huggle
27 {
28  //! Extension interface
29  class iExtension
30  {
31  public:
32  static QList<iExtension *> Extensions;
33  iExtension();
34  /*!
35  * \brief IsWorking
36  * \return if extension work
37  */
38  bool IsWorking();
39  virtual ~iExtension();
40  virtual bool Register() { return false; }
41  /*!
42  * \brief This is called when the extension is removed from system
43  */
44  virtual void Quit() { Working = false; }
45  /*!
46  * \brief Hook_EditPreProcess is called when edit is being pre processed
47  * \param edit is a pointer to edit in question
48  */
49  virtual void Hook_EditPreProcess(void *edit) {}
50  /*!
51  * \brief Hook_EditScore is called after edit score is calculated
52  * \param edit
53  */
54  virtual void Hook_EditScore(void *edit) {}
55  virtual void Hook_EditPostProcess(void *edit) {}
56  virtual bool Hook_EditBeforeScore(QString text, QString page, int* editscore, int userscore) { return true; }
57  private:
58  QString ExtensionName;
59  QString ExtensionAuthor;
60  QString ExtensionVersion;
61  QString ExtensionDescription;
62  bool Working;
63  };
64 }
65 
66 #if _MSC_VER
67 #pragma warning ( pop )
68 #else
69 #pragma GCC diagnostic pop
70 #endif
71 
72 Q_DECLARE_INTERFACE(Huggle::iExtension, "org.huggle.extension.qt")
73 
74 #endif // IEXTENSION_H
bool IsWorking()
IsWorking.
Definition: iextension.cpp:26
Extension interface.
Definition: iextension.hpp:29
virtual void Quit()
This is called when the extension is removed from system.
Definition: iextension.hpp:44
virtual void Hook_EditPreProcess(void *edit)
Hook_EditPreProcess is called when edit is being pre processed.
Definition: iextension.hpp:49
virtual void Hook_EditScore(void *edit)
Hook_EditScore is called after edit score is calculated.
Definition: iextension.hpp:54