00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef KYRA_DATASOURCE_INCLUDED
00033 #define KYRA_DATASOURCE_INCLUDED
00034
00035 #ifdef _MSC_VER
00036
00037 #pragma warning( disable : 4530 )
00038 #pragma warning( disable : 4786 )
00039 #endif
00040
00041 #include "kyraresource.h"
00042
00043
00060 class KrTextDataResource : public KrResource
00061 {
00062 public:
00063
00064 KrTextDataResource( U32 size, SDL_RWops* data );
00065
00066 KrTextDataResource( const std::string& resourceName );
00067
00068 virtual ~KrTextDataResource() {}
00069
00070 virtual U32 Type() { return KYRATAG_TEXTDATA; }
00071 virtual const std::string& TypeName() { return textName; }
00072 virtual KrTextDataResource* ToTextDataResource() { return this; }
00073
00077 const char* Text() { return text.c_str(); }
00078 const std::string& TextString() { return text; }
00079
00082 void Text( std::vector< std::string >* strings );
00083
00084
00085 virtual void Save( KrEncoder* );
00086 bool LoadTextFile( const char* fname );
00087
00088 private:
00089 const static std::string textName;
00090 std::string text;
00091 };
00092
00093
00104 class KrBinaryDataResource : public KrResource
00105 {
00106 public:
00107
00108 KrBinaryDataResource( U32 size, SDL_RWops* data );
00109 KrBinaryDataResource( const std::string& resourceName );
00110 virtual ~KrBinaryDataResource() { delete [] data; }
00111
00112 virtual U32 Type() { return KYRATAG_BINARYDATA; }
00113 virtual const std::string& TypeName() { return binaryName; }
00114 virtual KrBinaryDataResource* ToBinaryDataResource() { return this; }
00115
00117 const U8* Data() { return data; }
00119 int Length() { return length; }
00120
00121
00122 virtual void Save( KrEncoder* );
00123 bool LoadFile( const char* fname );
00124
00125 private:
00126 const static std::string binaryName;
00127 U8* data;
00128 int length;
00129 };
00130
00131 #endif