home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / dreamscape / source / Dreamscape / Headers / abstract / h / loader < prev    next >
Encoding:
Text File  |  1996-09-01  |  1.0 KB  |  40 lines

  1.  
  2. // abstract.h.loader
  3.  
  4. // Dreamscape - C++ class library for RISC OS
  5. // Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
  6. //
  7. // This library is free software; you can redistribute it and/or
  8. // modify it under the terms of the GNU Library General Public
  9. // License as published by the Free Software Foundation; either
  10. // version 2 of the License, or (at your option) any later version.
  11. // See the Dreamscape documentation for more information.
  12.  
  13. #ifndef dreamscape_loader_H
  14. #define dreamscape_loader_H
  15.  
  16. #include "filetype.h"
  17.  
  18. class istream;
  19.  
  20. template <class Data, class Info>
  21. class Loader {
  22. public:
  23.   virtual bool accept(const Info &info) const = 0;
  24.   virtual void load(const Info &info, Data data) = 0;
  25. };
  26.  
  27. template <class Data, class Info>
  28. class LoaderOneType: public Loader<Data, Info> {
  29.   Filetype t;
  30. public:
  31.   LoaderOneType(Filetype type): t(type) {}
  32.  
  33.   bool accept(const Info &info) const { return info.type == t; }
  34.  
  35.   void set_filetype(Filetype type) { t = type; }
  36.   Filetype get_filetype() const { return t; }
  37. };
  38.  
  39. #endif
  40.