Main Page   Class Hierarchy   Compound List   File List   Compound Members  

dataresource.h

00001 /*--License:
00002         Kyra Sprite Engine
00003         Copyright Lee Thomason (Grinning Lizard Software) 2001-2002
00004         www.grinninglizard.com/kyra
00005         www.sourceforge.net/projects/kyra
00006 
00007         Kyra is provided under 2 licenses:
00008 
00009         - The GPL, with no additional restrictions.
00010         - The LGPL, provided you display the Kyra splash screen, described below.
00011 
00012 
00013 --- GPL License --
00014         This program is free software; you can redistribute it and/or
00015         modify it under the terms of the GNU General Public License
00016         as published by the Free Software Foundation; either version 2
00017         of the License, or (at your option) any later version.
00018 
00019         This program is distributed in the hope that it will be useful,
00020         but WITHOUT ANY WARRANTY; without even the implied warranty of
00021         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022         GNU General Public License for more details.
00023 
00024         You should have received a copy of the GNU General Public License
00025         along with this program; if not, write to the Free Software
00026         Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 
00028         The full text of the license can be found in license.txt
00029 
00030 
00031 --- LGPL License --
00032   **Provided you kindly display the Kyra splash screen (details below), 
00033         you     may use the LGPL license:**
00034 
00035     This library is free software; you can redistribute it and/or
00036     modify it under the terms of the GNU Lesser General Public
00037     License as published by the Free Software Foundation; either
00038     version 2.1 of the License, or (at your option) any later version.
00039 
00040     This library is distributed in the hope that it will be useful,
00041     but WITHOUT ANY WARRANTY; without even the implied warranty of
00042     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00043     Lesser General Public License for more details.
00044 
00045     You should have received a copy of the GNU Lesser General Public
00046     License along with this library; if not, write to the Free Software
00047     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00048 
00049         The full text of the license can be found in lgpl.txt
00050 
00051 
00052 --- Kyra Splash Screen.
00053 
00054         It would be appreciate if you display the Kyra splash screen when using
00055         either license, however it is only required for the LGPL. All the
00056         resources for the splash are compiled into the library, and it can be
00057         accessed through the following API:
00058 
00059                 KrEngine::StartSplash
00060                 KrEngine::UpdateSplash
00061                 KrEngine::EndSplash
00062 
00063         Full documentation is provided with the KrEngine class. The splash screen
00064         should be displayed for 2 seconds.
00065 
00066         Thank you.
00067 */
00068 
00069 #ifndef KYRA_DATASOURCE_INCLUDED
00070 #define KYRA_DATASOURCE_INCLUDED
00071 
00072 #include "kyraresource.h"
00073 
00074 
00091 class KrTextDataResource : public KrResource
00092 {
00093   public:
00094         // Create by reading from a .dat file
00095         KrTextDataResource( U32 size, SDL_RWops* data );
00096         // Create from file
00097         KrTextDataResource( const std::string& resourceName );
00098 
00099         virtual ~KrTextDataResource()                                           {}
00100 
00101         virtual U32 Type()                                                                      { return KYRATAG_TEXTDATA; }
00102         virtual const std::string&      TypeName()                              { return textName; }
00103         virtual KrTextDataResource* ToTextDataResource()        { return this; }
00104 
00108         const char* Text()                                                                      { return text.c_str(); }
00109         const std::string& TextString()                                         { return text; }
00110 
00113         void Text( GlDynArray< std::string >* strings );
00114 
00115         // [internal]
00116         virtual void Save( KrEncoder* );
00117         bool LoadTextFile( const char* fname );
00118 
00119   private:
00120         const static std::string textName;
00121         std::string text;
00122 };
00123 
00124 
00135 class KrBinaryDataResource : public KrResource
00136 {
00137   public:
00138         // Create by reading from a .dat file
00139         KrBinaryDataResource( U32 size, SDL_RWops* data );
00140         KrBinaryDataResource( const std::string& resourceName );
00141         virtual ~KrBinaryDataResource()                                         { delete [] data; }
00142 
00143         virtual U32 Type()                                                                      { return KYRATAG_BINARYDATA; }
00144         virtual const std::string&      TypeName()                              { return binaryName; }
00145         virtual KrBinaryDataResource* ToBinaryDataResource()    { return this; }
00146 
00148         const U8* Data()                                                                        { return data; }
00150         int Length()                                                                    { return length; }
00151 
00152         // [internal]
00153         virtual void Save( KrEncoder* );
00154         bool LoadFile( const char* fname );
00155 
00156   private:
00157         const static std::string binaryName;
00158         U8* data;
00159         int length;
00160 };
00161 
00162 #endif

Generated on Mon Sep 15 12:01:10 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001