Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 11070
Merged at revision: 11235
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 178 lines (+83/-14)
4 files modified
src/diagnostics/xquery_exception.h (+76/-0)
src/runtime/json/common.cpp (+0/-8)
src/runtime/json/common.h (+5/-6)
src/util/omanip.h (+2/-0)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+148031@code.launchpad.net

Commit message

Added functions that take "location" as an argument.

Description of the change

Added functions that take "location" as an argument.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-02-12T19-49-41.097Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-02-12T21-12-48.122Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/diagnostics/xquery_exception.h'
2--- src/diagnostics/xquery_exception.h 2013-02-07 02:58:15 +0000
3+++ src/diagnostics/xquery_exception.h 2013-02-12 19:53:22 +0000
4@@ -187,6 +187,30 @@
5 * actually an XQueryException.
6 *
7 * @param ze The ZorbaException to set the location of.
8+ * @param loc The location.
9+ * @param overwrite If \c false, sets the location only if the exception
10+ * doesn't already have one; if \c true, always sets the location even if the
11+ * exception already has one.
12+ */
13+inline void set_source( ZorbaException &ze,
14+ internal::diagnostic::location const &loc,
15+ bool overwrite = true ) {
16+ set_source(
17+ ze,
18+ loc.file(),
19+ loc.line(),
20+ loc.column(),
21+ loc.line_end(),
22+ loc.column_end(),
23+ overwrite
24+ );
25+}
26+
27+/**
28+ * Sets the XQuery source location of the given ZorbaException but only if it's
29+ * actually an XQueryException.
30+ *
31+ * @param ze The ZorbaException to set the location of.
32 * @param loc The query location.
33 * @param overwrite If \c false, sets the location only if the exception
34 * doesn't already have one; if \c true, always sets the location even if the
35@@ -291,6 +315,32 @@
36 * it.
37 *
38 * @param ze The ZorbaException to set the location of.
39+ * @param loc The location.
40+ * @param overwrite If \c false, sets the location only if the exception
41+ * doesn't already have one; if \c true, always sets the location even if the
42+ * exception already has one.
43+ */
44+inline void set_data( ZorbaException &ze,
45+ internal::diagnostic::location const &loc,
46+ bool overwrite = true ) {
47+ set_data(
48+ ze,
49+ loc.file(),
50+ loc.line(),
51+ loc.column(),
52+ loc.line_end(),
53+ loc.column_end(),
54+ overwrite
55+ );
56+}
57+
58+/**
59+ * Sets the data location of the given ZorbaException but only if it's actually
60+ * an XQueryException. If it's actually a ZorbaException, constructs a new
61+ * XQueryException (copying the information from the ZorbaException) and throws
62+ * it.
63+ *
64+ * @param ze The ZorbaException to set the location of.
65 * @param loc The query location.
66 * @param overwrite If \c false, sets the location only if the exception
67 * doesn't already have one; if \c true, always sets the location even if the
68@@ -397,6 +447,32 @@
69 * ZorbaException) and throws it.
70 *
71 * @param ze The ZorbaException to set the location of.
72+ * @param loc The location.
73+ * @param overwrite If \c false, sets the location only if the exception
74+ * doesn't already have one; if \c true, always sets the location even if the
75+ * exception already has one.
76+ */
77+inline void set_applied( ZorbaException &ze,
78+ internal::diagnostic::location const &loc,
79+ bool overwrite = true ) {
80+ set_applied(
81+ ze,
82+ loc.file(),
83+ loc.line(),
84+ loc.column(),
85+ loc.line_end(),
86+ loc.column_end(),
87+ overwrite
88+ );
89+}
90+
91+/**
92+ * Sets the XQuery "applied at" location of the given ZorbaException but only
93+ * if it's actually an XQueryException. If it's actually a ZorbaException,
94+ * constructs a new XQueryException (copying the information from the
95+ * ZorbaException) and throws it.
96+ *
97+ * @param ze The ZorbaException to set the location of.
98 * @param loc The query location.
99 * @param overwrite If \c false, sets the location only if the exception
100 * doesn't already have one; if \c true, always sets the location even if the
101
102=== modified file 'src/runtime/json/common.cpp'
103--- src/runtime/json/common.cpp 2013-02-07 03:44:12 +0000
104+++ src/runtime/json/common.cpp 2013-02-12 19:53:22 +0000
105@@ -18,7 +18,6 @@
106 #include <zorba/xquery_exception.h>
107
108 #include "store/api/iterator.h"
109-#include "util/json_parser.h"
110
111 #include "common.h"
112
113@@ -45,13 +44,6 @@
114 return found;
115 }
116
117-void set_data( XQueryException *xe, json::exception const &je ) {
118- json::location const &loc( je.get_loc() );
119- xe->set_data(
120- loc.file(), loc.line(), loc.column(), loc.line_end(), loc.column_end()
121- );
122-}
123-
124 ///////////////////////////////////////////////////////////////////////////////
125
126 #if ZORBA_DEBUG_JSON
127
128=== modified file 'src/runtime/json/common.h'
129--- src/runtime/json/common.h 2013-02-07 03:44:12 +0000
130+++ src/runtime/json/common.h 2013-02-12 19:53:22 +0000
131@@ -20,9 +20,11 @@
132 #include <iostream>
133 #include <stack>
134
135+#include "diagnostics/xquery_exception.h"
136 #include "store/api/item.h"
137 #include "store/api/item_factory.h"
138 #include "util/indent.h"
139+#include "util/json_parser.h"
140 #include "util/omanip.h"
141 #include "zorbatypes/zstring.h"
142
143@@ -30,9 +32,6 @@
144
145 namespace zorba {
146
147-class XQueryException;
148-namespace json { class exception; }
149-
150 ///////////////////////////////////////////////////////////////////////////////
151
152 typedef std::stack<store::Item*> item_stack_type;
153@@ -59,9 +58,9 @@
154 bool get_attribute_value( store::Item_t const &element, char const *att_name,
155 zstring *att_value );
156
157-void set_data( XQueryException*, json::exception const& );
158-
159-typedef std::ostream& (*std_omanip_type)(std::ostream&);
160+inline void set_data( XQueryException *xe, json::exception const &je ) {
161+ set_data( *xe, je.get_loc() );
162+}
163
164 ///////////////////////////////////////////////////////////////////////////////
165
166
167=== modified file 'src/util/omanip.h'
168--- src/util/omanip.h 2013-02-01 06:03:17 +0000
169+++ src/util/omanip.h 2013-02-12 19:53:22 +0000
170@@ -22,6 +22,8 @@
171
172 namespace zorba {
173
174+typedef std::ostream& (*std_omanip_type)(std::ostream&);
175+
176 ///////////////////////////////////////////////////////////////////////////////
177
178 /**

Subscribers

People subscribed via source and target branches