htmlfilt.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/html/htmlfilt.h
  3. // Purpose: filters
  4. // Author: Vaclav Slavik
  5. // Copyright: (c) 1999 Vaclav Slavik
  6. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_HTMLFILT_H_
  9. #define _WX_HTMLFILT_H_
  10. #include "wx/defs.h"
  11. #if wxUSE_HTML
  12. #include "wx/filesys.h"
  13. //--------------------------------------------------------------------------------
  14. // wxHtmlFilter
  15. // This class is input filter. It can "translate" files
  16. // in non-HTML format to HTML format
  17. // interface to access certain
  18. // kinds of files (HTPP, FTP, local, tar.gz etc..)
  19. //--------------------------------------------------------------------------------
  20. class WXDLLIMPEXP_HTML wxHtmlFilter : public wxObject
  21. {
  22. DECLARE_ABSTRACT_CLASS(wxHtmlFilter)
  23. public:
  24. wxHtmlFilter() : wxObject() {}
  25. virtual ~wxHtmlFilter() {}
  26. // returns true if this filter is able to open&read given file
  27. virtual bool CanRead(const wxFSFile& file) const = 0;
  28. // Reads given file and returns HTML document.
  29. // Returns empty string if opening failed
  30. virtual wxString ReadFile(const wxFSFile& file) const = 0;
  31. };
  32. //--------------------------------------------------------------------------------
  33. // wxHtmlFilterPlainText
  34. // This filter is used as default filter if no other can
  35. // be used (= uknown type of file). It is used by
  36. // wxHtmlWindow itself.
  37. //--------------------------------------------------------------------------------
  38. class WXDLLIMPEXP_HTML wxHtmlFilterPlainText : public wxHtmlFilter
  39. {
  40. DECLARE_DYNAMIC_CLASS(wxHtmlFilterPlainText)
  41. public:
  42. virtual bool CanRead(const wxFSFile& file) const;
  43. virtual wxString ReadFile(const wxFSFile& file) const;
  44. };
  45. //--------------------------------------------------------------------------------
  46. // wxHtmlFilterHTML
  47. // filter for text/html
  48. //--------------------------------------------------------------------------------
  49. class wxHtmlFilterHTML : public wxHtmlFilter
  50. {
  51. DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML)
  52. public:
  53. virtual bool CanRead(const wxFSFile& file) const;
  54. virtual wxString ReadFile(const wxFSFile& file) const;
  55. };
  56. #endif // wxUSE_HTML
  57. #endif // _WX_HTMLFILT_H_