1
0
Fork 0
flightgear/src/FDM/JSBSim/input_output/FGXMLParse.h

96 lines
3.3 KiB
C
Raw Normal View History

2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
2006-01-12 15:04:22 +00:00
Header: FGXMLParse.h
2000-10-02 23:07:30 +00:00
Author: Jon S. Berndt
2006-01-12 15:04:22 +00:00
Date started: 8/20/04
2000-10-02 23:07:30 +00:00
2009-08-30 08:22:03 +00:00
------------- Copyright (C) 2004 Jon S. Berndt (jon@jsbsim.org) -------------
2000-10-02 23:07:30 +00:00
This program is free software; you can redistribute it and/or modify it under
2007-01-15 12:48:54 +00:00
the terms of the GNU Lesser General Public License as published by the Free Software
2000-10-02 23:07:30 +00:00
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2007-01-15 12:48:54 +00:00
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
2000-10-02 23:07:30 +00:00
details.
2007-01-15 12:48:54 +00:00
You should have received a copy of the GNU Lesser General Public License along with
2000-10-02 23:07:30 +00:00
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
2007-01-15 12:48:54 +00:00
Further information about the GNU Lesser General Public License can also be found on
2000-10-02 23:07:30 +00:00
the world wide web at http://www.gnu.org.
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
SENTRY
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2000-10-02 23:07:30 +00:00
2006-01-12 15:04:22 +00:00
#ifndef FGXMLPARSE_H
#define FGXMLPARSE_H
2000-10-02 23:07:30 +00:00
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
INCLUDES
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2000-10-02 23:07:30 +00:00
2006-01-12 15:04:22 +00:00
#include "simgear/xml/easyxml.hxx"
2000-10-02 23:07:30 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2010-07-16 09:05:59 +00:00
#define ID_XMLPARSE "$Id: FGXMLParse.h,v 1.7 2009/10/24 22:59:30 jberndt Exp $"
2006-01-12 15:04:22 +00:00
#define VALID_CHARS """`!@#$%^&*()_+`1234567890-={}[];':,.<>/?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2003-06-03 08:46:15 +00:00
namespace JSBSim {
2009-10-26 13:29:58 +00:00
class Element;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2006-01-12 15:04:22 +00:00
/** Encapsulates an XML parser based on the EasyXML parser from the SimGear library.
@author Jon S. Berndt
2010-07-16 09:05:59 +00:00
@version $Id: FGXMLParse.h,v 1.7 2009/10/24 22:59:30 jberndt Exp $
*/
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
CLASS DECLARATION
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2000-10-02 23:07:30 +00:00
2006-01-12 15:04:22 +00:00
class FGXMLParse : public XMLVisitor
{
2000-10-02 23:07:30 +00:00
public:
2006-01-12 15:04:22 +00:00
FGXMLParse(void);
virtual ~FGXMLParse(void);
2001-03-30 01:04:50 +00:00
2006-01-12 15:04:22 +00:00
Element* GetDocument(void) {return document;}
2004-06-14 11:40:45 +00:00
2006-01-12 15:04:22 +00:00
void startXML();
void endXML();
void startElement (const char * name, const XMLAttributes &atts);
void endElement (const char * name);
void data (const char * s, int length);
void pi (const char * target, const char * data);
void warning (const char * message, int line, int column);
void reset(void);
2004-12-16 12:47:20 +00:00
2006-01-12 15:04:22 +00:00
private:
bool first_element_read;
mutable std::string working_string;
2006-01-12 15:04:22 +00:00
Element *document;
Element *current_element;
2000-10-02 23:07:30 +00:00
};
2006-01-12 15:04:22 +00:00
} // namespace JSBSim
2000-11-03 23:02:47 +00:00
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2001-03-30 01:04:50 +00:00
2006-01-12 15:04:22 +00:00
#endif