- Main Page
- Classes
- Files
- Directories
- Related Pages

# parser.h

    00001 /*--License:
    00002         Kyra Sprite Engine
    00003         Copyright Lee Thomason (Grinning Lizard Software) 2001-2005
    00004         www.grinninglizard.com/kyra
    00005         www.sourceforge.net/projects/kyra
    00006
    00007         Kyra is provided under the LGPL.
    00008
    00009         I kindly request you display a splash screen (provided in the HTML documentation)
    00010         to promote Kyra and acknowledge the software and everyone who has contributed to it,
    00011         but it is not required by the license.
    00012
    00013 --- LGPL License --
    00014
    00015     This library is free software; you can redistribute it and/or
    00016     modify it under the terms of the GNU Lesser General Public
    00017     License as published by the Free Software Foundation; either
    00018     version 2.1 of the License, or (at your option) any later version.
    00019
    00020     This library is distributed in the hope that it will be useful,
    00021     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00023     Lesser General Public License for more details.
    00024
    00025     You should have received a copy of the GNU Lesser General Public
    00026     License along with this library; if not, write to the Free Software
    00027     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00028
    00029         The full text of the license can be found in lgpl.txt
    00030 */
    00031
    00032
    00033 #ifndef IO_PARSER
    00034 #define IO_PARSER
    00035
    00036 #include <stdio.h>
    00037 #include <string>
    00038
    00039 #include "../util/gllist.h"
    00040
    00041 class  TiXmlNode;
    00042
    00043
    00044 class KrDom
    00045 {
    00046   public:
    00047         struct Frame
    00048         {
    00049                 Frame() : x( 0 ), y( 0 ), width( 0 ), height( 0 ), hotspotX( 0 ),
    00050                                   hotspotY( 0 ), deltaX( 0 ), deltaY( 0 ),
    00051                                   isotile( 0 ), hasHotspot( false ), hasDelta( false )  {}
    00052
    00053                 int x;
    00054                 int y;
    00055                 int width;
    00056                 int height;
    00057                 int hotspotX;
    00058                 int hotspotY;
    00059                 int deltaX;
    00060                 int deltaY;
    00061                 int isotile;
    00062
    00063                 bool hasHotspot;
    00064                 bool hasDelta;
    00065         };
    00066
    00067         struct Tile
    00068         {
    00069                 Tile() : x( 0 ), y( 0 ), size( 0 )      {}
    00070
    00071                 int x;
    00072                 int y;
    00073                 int size;
    00074         };
    00075
    00076         static void ReadFrameAttributes( const TiXmlNode* node,
    00077                                                                          KrDom::Frame* frame );
    00078
    00079         static void ReadTileAttributes(  const TiXmlNode* node,
    00080                                                                          KrDom::Tile* tile );
    00081
    00082         static const TiXmlNode* ReadFrame( const TiXmlNode* action, int frameNumber );
    00083
    00084         static int                      CountChildren( const TiXmlNode* node, const std::string& value );
    00085 };
    00086
    00087
    00088 #endif