> The XQuery Processor
00001 /* 00002 * Copyright 2006-2008 The FLWOR Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef ZORBA_DEBUGGER_EVENT_HANDLER_H 00017 #define ZORBA_DEBUGGER_EVENT_HANDLER_H 00018 00019 #include <zorba/zorbastring.h> 00020 #include <map> 00021 00022 namespace zorba{ 00023 00024 /* Cause of the suspension of the engine */ 00025 enum SuspendedBy { A_USER, A_BREAKPOINT, A_STEP }; 00026 00027 /** 00028 * Representation of the current location location 00029 * in the remote query. 00030 * This location goes from the starting line and column 00031 * to the ending line and column. 00032 */ 00033 class ZORBA_EXTERN_DECL QueryLocation 00034 { 00035 public: 00036 00037 virtual 00038 ~QueryLocation(){} 00039 00040 virtual String 00041 getFileName() const = 0; 00042 00043 virtual unsigned int 00044 getLineBegin() const = 0; 00045 00046 virtual unsigned int 00047 getLineEnd() const = 0; 00048 00049 virtual unsigned int 00050 getColumnBegin() const = 0; 00051 00052 virtual unsigned int 00053 getColumnEnd() const = 0; 00054 00055 virtual String 00056 toString() const = 0; 00057 }; 00058 00059 //string serialization of the query 00060 ZORBA_EXTERN_DECL 00061 std::ostream& operator<< (std::ostream& os, const QueryLocation& aQuery); 00062 ZORBA_EXTERN_DECL 00063 std::ostream& operator<< (std::ostream& os, QueryLocation* aQuery); 00064 00065 /** 00066 * DebuggerEventHandler is the base handler for all debugging events. 00067 * During debugging, events are sent from the remote query to the client. 00068 * Once a client received an event, a callback is made to the debugger event 00069 * handler. 00070 */ 00071 class ZORBA_EXTERN_DECL DebuggerEventHandler 00072 { 00073 public: 00074 00075 virtual 00076 ~DebuggerEventHandler(){} 00077 00078 /** \brief Signal the query status as being started. 00079 * 00080 */ 00081 virtual void 00082 started() = 0; 00083 00084 /** \brief Signal the query status as being idle. 00085 * 00086 */ 00087 virtual void 00088 idle() = 0; 00089 00090 /** \brief Signal the query status as being suspended. 00091 * 00092 * When a suspended event is triggered, this method received the 00093 * cause of the suspension (user, breakpoint, step) and the location 00094 * in the query where the debugger suspended. 00095 */ 00096 virtual void 00097 suspended( QueryLocation &aLocation, SuspendedBy aCause ) = 0; 00098 00099 00100 /** \brief Signal the query status as being resumed. 00101 * 00102 */ 00103 virtual void 00104 resumed() = 0; 00105 00106 00107 /** \brief Signal the query status as being terminated. 00108 * 00109 */ 00110 virtual void 00111 terminated() = 0; 00112 00113 /** \brief Fire the result of an XQuery expression. 00114 * 00115 */ 00116 virtual void 00117 evaluated(String &anExpr, std::map<String, String> &aValuesAndTypes) = 0; 00118 00119 /** \brief Fire an Error from an XQuery expression. 00120 * 00121 * @param String the XQuery expression 00122 * @param String the Error description 00123 */ 00124 virtual void 00125 evaluated(String &anExpr, String &anError) = 0; 00126 }; 00127 }//end of namespace 00128 #endif