1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2018 The Regents of the University of California
4 //
5 // This file is part of Qbox
6 //
7 // Qbox is distributed under the terms of the GNU General Public License
8 // as published by the Free Software Foundation, either version 2 of
9 // the License, or (at your option) any later version.
10 // See the file COPYING in the root directory of this distribution
11 // or <http://www.gnu.org/licenses/>.
12 //
13 ////////////////////////////////////////////////////////////////////////////////
14 //
15 // Function3dHandler.h
16 //
17 ////////////////////////////////////////////////////////////////////////////////
18 
19 #ifndef FUNCTION3DHANDLER_H
20 #define FUNCTION3DHANDLER_H
21 
22 #include "Function3d.h"
23 #include <xercesc/sax2/DefaultHandler.hpp>
24 #include "StrX.h"
25 #include <string>
26 
27 class Function3dHandler: public DefaultHandler
28 {
29   private:
30 
31   std::string buf_;
32   Function3d& f_;
33   int fnx_, fny_, fnz_; // size of fragment read
34   int x0_, y0_, z0_;    // offset of fragment read
35 
36   public:
37 
38   Function3dHandler(Function3d& f);
39   virtual ~Function3dHandler(void);
40 
41   // -----------------------------------------------------------------------
42   //  Implementations of the SAX DocumentHandler interface
43   // -----------------------------------------------------------------------
44 
45   void startElement(const XMLCh* const uri,const XMLCh* const localname,
46     const XMLCh* const qname, const Attributes& attributes);
47 #ifndef XERCES_VERSION_MAJOR
48 #error "XERCES_VERSION_MAJOR not defined"
49 #endif
50 #if XERCES_VERSION_MAJOR > 2
51   void characters(const XMLCh* const chars, const XMLSize_t length);
52 #else
53   void characters(const XMLCh* const chars, const unsigned int length);
54 #endif
55   void endElement(const XMLCh* const uri, const XMLCh* const localname,
56                   const XMLCh* const qname);
57 };
58 #endif
59