00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00024 #ifndef __LRT_RESOURCE__
00025 #define __LRT_RESOURCE__
00026
00027 struct lrt_resource_type {
00028 unsigned long length;
00029 char* name;
00030 unsigned char* data;
00031 };
00032
00033 #include "rtstreams.h"
00034
00035 namespace lrt {
00036
00037
00038 template<class T> class StringMap;
00039
00048 class Resource
00049 {
00050 public:
00060 static InputStream* getResource(const String& name);
00061 static void addResource(const lrt_resource_type& res);
00062
00063 private:
00064 static StringMap<lrt_resource_type> resources;
00065 Resource() {}
00066 virtual ~Resource() {}
00067 };
00068
00072 class ResourceInputStream : public InputStream {
00073 public:
00074 ResourceInputStream(const lrt_resource_type& res);
00075 virtual ~ResourceInputStream() {}
00077 virtual int read();
00081 virtual bool eos();
00083 virtual bool markSupported();
00085 virtual void mark();
00088 virtual void reset();
00089
00090 private:
00091 lrt_resource_type resource;
00092 unsigned long pos;
00093 unsigned long markPos;
00094 };
00095
00096 }
00097
00098 #endif