XQuilla/docs/simple-api/EventHandler_8hpp_source.html
2020-02-17 22:22:42 +01:00

178 lines
19 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XQilla Simple API Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<a style="float:right;" href="http://sourceforge.net/projects/xqilla"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=152021&amp;type=2" border="0" alt="SourceForge.net Logo" /></a>
<!-- Generated by Doxygen 1.7.3 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<h1>EventHandler.hpp</h1> </div>
</div>
<div class="contents">
<a href="EventHandler_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (c) 2001, 2008,</span>
<a name="l00003"></a>00003 <span class="comment"> * DecisionSoft Limited. All rights reserved.</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (c) 2004, 2011,</span>
<a name="l00005"></a>00005 <span class="comment"> * Oracle and/or its affiliates. All rights reserved.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
<a name="l00008"></a>00008 <span class="comment"> * you may not use this file except in compliance with the License.</span>
<a name="l00009"></a>00009 <span class="comment"> * You may obtain a copy of the License at</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
<a name="l00014"></a>00014 <span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<a name="l00015"></a>00015 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00016"></a>00016 <span class="comment"> * See the License for the specific language governing permissions and</span>
<a name="l00017"></a>00017 <span class="comment"> * limitations under the License.</span>
<a name="l00018"></a>00018 <span class="comment"> */</span>
<a name="l00019"></a>00019
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef _EVENTHANDLER_HPP</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define _EVENTHANDLER_HPP</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;xqilla/framework/XQillaExport.hpp&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;xqilla/items/AnyAtomicType.hpp&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;xqilla/ast/LocationInfo.hpp&gt;</span>
<a name="l00026"></a>00026
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;xercesc/util/XercesDefs.hpp&gt;</span>
<a name="l00028"></a>00028
<a name="l00029"></a><a class="code" href="classEventHandler.html">00029</a> <span class="keyword">class </span>XQILLA_API <a class="code" href="classEventHandler.html">EventHandler</a>
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031 <span class="keyword">public</span>:
<a name="l00032"></a><a class="code" href="classEventHandler.html#a9578358998a3221402df5404ca2776d6">00032</a> <span class="keyword">virtual</span> <a class="code" href="classEventHandler.html#a9578358998a3221402df5404ca2776d6">~EventHandler</a>() {};
<a name="l00033"></a>00033
<a name="l00036"></a><a class="code" href="classEventHandler.html#a56e778038e88d6c671e4f0f73e717878">00036</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a56e778038e88d6c671e4f0f73e717878" title="Recieves a LocationInfo object that is owned by the caller, and will be updated with the current loca...">setLocationInfo</a>(<span class="keyword">const</span> <a class="code" href="classLocationInfo.html" title="A class that gives records a location in the query.">LocationInfo</a> *location) {}
<a name="l00037"></a>00037
<a name="l00039"></a>00039 <span class="keyword">virtual</span> <span class="keywordtype">void</span> startDocumentEvent(<span class="keyword">const</span> XMLCh *documentURI, <span class="keyword">const</span> XMLCh *encoding) = 0;
<a name="l00041"></a>00041 <span class="keyword">virtual</span> <span class="keywordtype">void</span> endDocumentEvent() = 0;
<a name="l00043"></a>00043 <span class="keyword">virtual</span> <span class="keywordtype">void</span> startElementEvent(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri, <span class="keyword">const</span> XMLCh *localname) = 0;
<a name="l00045"></a>00045 <span class="keyword">virtual</span> <span class="keywordtype">void</span> endElementEvent(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri, <span class="keyword">const</span> XMLCh *localname,
<a name="l00046"></a>00046 <span class="keyword">const</span> XMLCh *typeURI, <span class="keyword">const</span> XMLCh *typeName) = 0;
<a name="l00048"></a>00048 <span class="keyword">virtual</span> <span class="keywordtype">void</span> piEvent(<span class="keyword">const</span> XMLCh *target, <span class="keyword">const</span> XMLCh *value) = 0;
<a name="l00050"></a>00050 <span class="keyword">virtual</span> <span class="keywordtype">void</span> textEvent(<span class="keyword">const</span> XMLCh *value) = 0;
<a name="l00052"></a>00052 <span class="keyword">virtual</span> <span class="keywordtype">void</span> textEvent(<span class="keyword">const</span> XMLCh *chars, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) = 0;
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <span class="keywordtype">void</span> commentEvent(<span class="keyword">const</span> XMLCh *value) = 0;
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> attributeEvent(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri, <span class="keyword">const</span> XMLCh *localname, <span class="keyword">const</span> XMLCh *value,
<a name="l00057"></a>00057 <span class="keyword">const</span> XMLCh *typeURI, <span class="keyword">const</span> XMLCh *typeName) = 0;
<a name="l00059"></a>00059 <span class="keyword">virtual</span> <span class="keywordtype">void</span> namespaceEvent(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri) = 0;
<a name="l00061"></a><a class="code" href="classEventHandler.html#a990d0c9ab92dd7ed3a3fde63d9e647aa">00061</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> atomicItemEvent(<a class="code" href="classAnyAtomicType.html#a289c5db5e82b40c2f3e53af7d472f14c">AnyAtomicType::AtomicObjectType</a> type, <span class="keyword">const</span> XMLCh *value,
<a name="l00062"></a>00062 <span class="keyword">const</span> XMLCh *typeURI, <span class="keyword">const</span> XMLCh *typeName) {}
<a name="l00064"></a>00064 <span class="keyword">virtual</span> <span class="keywordtype">void</span> endEvent() = 0;
<a name="l00065"></a>00065 };
<a name="l00066"></a>00066
<a name="l00067"></a><a class="code" href="classEventFilter.html">00067</a> <span class="keyword">class </span>XQILLA_API <a class="code" href="classEventFilter.html">EventFilter</a> : <span class="keyword">public</span> <a class="code" href="classEventHandler.html">EventHandler</a>
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069 <span class="keyword">public</span>:
<a name="l00070"></a><a class="code" href="classEventFilter.html#aaf2bc8a1705498ee3f13cdccf8f4b7ea">00070</a> <a class="code" href="classEventFilter.html">EventFilter</a>(<a class="code" href="classEventHandler.html">EventHandler</a> *next)
<a name="l00071"></a>00071 : next_(next)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074
<a name="l00075"></a><a class="code" href="classEventFilter.html#ae95827ebefc1179be14993f380d1a917">00075</a> <span class="keywordtype">void</span> setNextEventHandler(<a class="code" href="classEventHandler.html">EventHandler</a> *next)
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077 next_ = next;
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079
<a name="l00080"></a><a class="code" href="classEventFilter.html#a3161cc68419450c485d7ed487040ae67">00080</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a56e778038e88d6c671e4f0f73e717878" title="Recieves a LocationInfo object that is owned by the caller, and will be updated with the current loca...">setLocationInfo</a>(<span class="keyword">const</span> <a class="code" href="classLocationInfo.html" title="A class that gives records a location in the query.">LocationInfo</a> *location)
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082 next_-&gt;setLocationInfo(location);
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084
<a name="l00085"></a><a class="code" href="classEventFilter.html#ac6c48bf05f8c78225b7d3d8e5fefd478">00085</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#aec3e374a8a1aa966eb9fb480271415f2" title="Handles a document node as an event.">startDocumentEvent</a>(<span class="keyword">const</span> XMLCh *documentURI, <span class="keyword">const</span> XMLCh *encoding)
<a name="l00086"></a>00086 {
<a name="l00087"></a>00087 next_-&gt;startDocumentEvent(documentURI, encoding);
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089
<a name="l00090"></a><a class="code" href="classEventFilter.html#a85b1a402bde6e2cebc504c88cc48f70f">00090</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a10240b417fb26f78d008da114a4f472a" title="Handles a document node as an event.">endDocumentEvent</a>()
<a name="l00091"></a>00091 {
<a name="l00092"></a>00092 next_-&gt;endDocumentEvent();
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094
<a name="l00095"></a><a class="code" href="classEventFilter.html#ac893445bfe22063f2fc3ca5cd9b9925c">00095</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a664a9e60254f14aba283406ac20a428f" title="Handles the start of an element node as an event.">startElementEvent</a>(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri, <span class="keyword">const</span> XMLCh *localname)
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097 next_-&gt;startElementEvent(prefix, uri, localname);
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099
<a name="l00100"></a><a class="code" href="classEventFilter.html#ae9797751bfd4587decafacc32ce345d0">00100</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a2d10b48fa9170958a36fee3f18936335" title="Handles the end of an element node as an event.">endElementEvent</a>(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri, <span class="keyword">const</span> XMLCh *localname,
<a name="l00101"></a>00101 <span class="keyword">const</span> XMLCh *typeURI, <span class="keyword">const</span> XMLCh *typeName)
<a name="l00102"></a>00102 {
<a name="l00103"></a>00103 next_-&gt;endElementEvent(prefix, uri, localname, typeURI, typeName);
<a name="l00104"></a>00104 }
<a name="l00105"></a>00105
<a name="l00106"></a><a class="code" href="classEventFilter.html#ab5ba6162b69d1800d9cf2bf94eef6132">00106</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#ae38f73ad14599de7f9c07fab31d9efa2" title="Handles a processing instruction node as an event.">piEvent</a>(<span class="keyword">const</span> XMLCh *target, <span class="keyword">const</span> XMLCh *value)
<a name="l00107"></a>00107 {
<a name="l00108"></a>00108 next_-&gt;piEvent(target, value);
<a name="l00109"></a>00109 }
<a name="l00110"></a>00110
<a name="l00111"></a><a class="code" href="classEventFilter.html#a63edc38c8a7a42bee18081680b648b9b">00111</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a103e9faa172d398373c58548bea39744" title="Handles a text node as an event.">textEvent</a>(<span class="keyword">const</span> XMLCh *value)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113 next_-&gt;textEvent(value);
<a name="l00114"></a>00114 }
<a name="l00115"></a>00115
<a name="l00116"></a><a class="code" href="classEventFilter.html#a82d4f002673995fdc5da2f7237fe3d5a">00116</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a103e9faa172d398373c58548bea39744" title="Handles a text node as an event.">textEvent</a>(<span class="keyword">const</span> XMLCh *chars, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length)
<a name="l00117"></a>00117 {
<a name="l00118"></a>00118 next_-&gt;textEvent(chars, length);
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120
<a name="l00121"></a><a class="code" href="classEventFilter.html#adb88be94442fc15da6fec403b4b5acb6">00121</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a013b0f881802980a3e8c3dd9c8981616" title="Handles a comment node as an event.">commentEvent</a>(<span class="keyword">const</span> XMLCh *value)
<a name="l00122"></a>00122 {
<a name="l00123"></a>00123 next_-&gt;commentEvent(value);
<a name="l00124"></a>00124 }
<a name="l00125"></a>00125
<a name="l00126"></a><a class="code" href="classEventFilter.html#ab3d3d998f1b01a6a1c69c0d32a75c9ec">00126</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a622f3bfae965b26fe8371db1dd9c72f9" title="Handles an attribute node as an event.">attributeEvent</a>(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri, <span class="keyword">const</span> XMLCh *localname, <span class="keyword">const</span> XMLCh *value,
<a name="l00127"></a>00127 <span class="keyword">const</span> XMLCh *typeURI, <span class="keyword">const</span> XMLCh *typeName)
<a name="l00128"></a>00128 {
<a name="l00129"></a>00129 next_-&gt;attributeEvent(prefix, uri, localname, value, typeURI, typeName);
<a name="l00130"></a>00130 }
<a name="l00131"></a>00131
<a name="l00132"></a><a class="code" href="classEventFilter.html#acecb6654cbfabaa33a342810f0ad3774">00132</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a15dcb7774662ee54bd121c3317862367" title="Handles a namespace binding as an event.">namespaceEvent</a>(<span class="keyword">const</span> XMLCh *prefix, <span class="keyword">const</span> XMLCh *uri)
<a name="l00133"></a>00133 {
<a name="l00134"></a>00134 next_-&gt;namespaceEvent(prefix, uri);
<a name="l00135"></a>00135 }
<a name="l00136"></a>00136
<a name="l00137"></a><a class="code" href="classEventFilter.html#abad51702c694838147c32e075e09d783">00137</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#a990d0c9ab92dd7ed3a3fde63d9e647aa" title="Handles an atomic item as an event.">atomicItemEvent</a>(<a class="code" href="classAnyAtomicType.html#a289c5db5e82b40c2f3e53af7d472f14c">AnyAtomicType::AtomicObjectType</a> type, <span class="keyword">const</span> XMLCh *value, <span class="keyword">const</span> XMLCh *typeURI,
<a name="l00138"></a>00138 <span class="keyword">const</span> XMLCh *typeName)
<a name="l00139"></a>00139 {
<a name="l00140"></a>00140 next_-&gt;atomicItemEvent(type, value, typeURI, typeName);
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142
<a name="l00143"></a><a class="code" href="classEventFilter.html#ae2e68d37a7b44eb43c15bebfa00d98f4">00143</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classEventHandler.html#abb55f1ead2e9a36ca161c6943ed6e8af" title="Called when all events have been reported.">endEvent</a>()
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145 next_-&gt;endEvent();
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147
<a name="l00148"></a>00148 <span class="keyword">protected</span>:
<a name="l00149"></a><a class="code" href="classEventFilter.html#a54109f890c168bdf1e437a25b74563ef">00149</a> <a class="code" href="classEventHandler.html">EventHandler</a> *<a class="code" href="classEventFilter.html#a54109f890c168bdf1e437a25b74563ef">next_</a>;
<a name="l00150"></a>00150 };
<a name="l00151"></a>00151
<a name="l00152"></a><a class="code" href="EventHandler_8hpp.html#ad281bc239cb522f34ec83e6e8272160c">00152</a> <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keyword">const</span> XMLCh *<a class="code" href="EventHandler_8hpp.html#ad281bc239cb522f34ec83e6e8272160c">emptyToNull</a>(<span class="keyword">const</span> XMLCh * <span class="keyword">const</span> in)
<a name="l00153"></a>00153 {
<a name="l00154"></a>00154 <span class="keywordflow">return</span> (in == 0 || *in == 0) ? 0 : in;
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Mon Oct 31 2011 19:08:35 for XQilla Simple API by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>