SourceForge.net Logo

EventHandler.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2006
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2006
00005  *     Progress Software Corporation. All rights reserved.
00006  * Copyright (c) 2004-2006
00007  *     Oracle. All rights reserved.
00008  *
00009  * See the file LICENSE for redistribution information.
00010  *
00011  * $Id: EventHandler.hpp,v 1.2 2007/02/08 13:17:10 jpcs Exp $
00012  */
00013 
00014 #ifndef _EVENTHANDLER_HPP
00015 #define _EVENTHANDLER_HPP
00016 
00017 #include <xqilla/framework/XQillaExport.hpp>
00018 #include <xqilla/items/AnyAtomicType.hpp>
00019 
00020 #include <xercesc/util/XercesDefs.hpp>
00021 
00022 class XQILLA_API EventHandler
00023 {
00024 public:
00025   virtual ~EventHandler() {};
00026 
00028   virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding) = 0;
00030   virtual void endDocumentEvent() = 0;
00032   virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname) = 0;
00034   virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
00035                                const XMLCh *typeURI, const XMLCh *typeName) = 0;
00037   virtual void piEvent(const XMLCh *target, const XMLCh *value) = 0;
00039   virtual void textEvent(const XMLCh *value) = 0;
00041   virtual void textEvent(const XMLCh *chars, unsigned int length) = 0;
00043   virtual void commentEvent(const XMLCh *value) = 0;
00045   virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
00046                               const XMLCh *typeURI, const XMLCh *typeName) = 0;
00048   virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri) = 0;
00050   virtual void atomicItemEvent(AnyAtomicType::AtomicObjectType type, const XMLCh *value,
00051                                const XMLCh *typeURI, const XMLCh *typeName) {}
00053   virtual void endEvent() = 0;
00054 };
00055 
00056 class XQILLA_API EventFilter : public EventHandler
00057 {
00058 public:
00059   EventFilter(EventHandler *next)
00060     : next_(next)
00061   {
00062   }
00063 
00064   virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding)
00065   {
00066     next_->startDocumentEvent(documentURI, encoding);
00067   }
00068 
00069   virtual void endDocumentEvent()
00070   {
00071     next_->endDocumentEvent();
00072   }
00073 
00074   virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname)
00075   {
00076     next_->startElementEvent(prefix, uri, localname);
00077   }
00078 
00079   virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
00080                                const XMLCh *typeURI, const XMLCh *typeName)
00081   {
00082     next_->endElementEvent(prefix, uri, localname, typeURI, typeName);
00083   }
00084 
00085   virtual void piEvent(const XMLCh *target, const XMLCh *value)
00086   {
00087     next_->piEvent(target, value);
00088   }
00089 
00090   virtual void textEvent(const XMLCh *value)
00091   {
00092     next_->textEvent(value);
00093   }
00094 
00095   virtual void textEvent(const XMLCh *chars, unsigned int length)
00096   {
00097     next_->textEvent(chars, length);
00098   }
00099 
00100   virtual void commentEvent(const XMLCh *value)
00101   {
00102     next_->commentEvent(value);
00103   }
00104 
00105   virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
00106                               const XMLCh *typeURI, const XMLCh *typeName)
00107   {
00108     next_->attributeEvent(prefix, uri, localname, value, typeURI, typeName);
00109   }
00110 
00111   virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri)
00112   {
00113     next_->namespaceEvent(prefix, uri);
00114   }
00115 
00116   virtual void atomicItemEvent(AnyAtomicType::AtomicObjectType type, const XMLCh *value, const XMLCh *typeURI,
00117                                const XMLCh *typeName)
00118   {
00119     next_->atomicItemEvent(type, value, typeURI, typeName);
00120   }
00121 
00122   virtual void endEvent()
00123   {
00124     next_->endEvent();
00125   }
00126 
00127 protected:
00128   EventHandler *next_;
00129 };
00130 
00131 static inline const XMLCh *emptyToNull(const XMLCh * const in)
00132 {
00133   return (in == 0 || *in == 0) ? 0 : in;
00134 }
00135 
00136 #endif

Generated on Fri Aug 31 14:37:35 2007 for XQilla Simple API by  doxygen 1.5.1