Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

rtresource.h

Go to the documentation of this file.
00001 /*
00002  * rtresource.h
00003  * 
00004  * Copyright (c) 2000-2004 by Florian Fischer (florianfischer@gmx.de)
00005  * and Martin Trautmann (martintrautmann@gmx.de) 
00006  * 
00007  * This file may be distributed and/or modified under the terms of the 
00008  * GNU General Public License version 2 as published by the Free Software 
00009  * Foundation. 
00010  * 
00011  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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 // fwd declare
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 } // namespace
00097 
00098 #endif

This is the RoboTour API documentation version 0.1 • Copyright (C) by Florian Fischer