Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/feature-applied_loc
into lp:zorba.
Commit message:
Added applied at location to XQueryException.
Requested reviews:
Paul J. Lucas (paul-lucas)
For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/feature-applied_loc/+merge/137357
Added applied at location to XQueryException.
--
https://code.launchpad.net/~paul-lucas/zorba/feature-applied_loc/+merge/137357
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/internal/diagnostic.h'
--- include/zorba/internal/diagnostic.h 2012-11-17 18:44:55 +
+++ include/zorba/internal/diagnostic.h 2012-12-01 00:08:21 +
@@ -45,6 +45,7 @@
* A %location holds the file location of an error.
*/
class ZORBA_DLL_PUBLIC location {
+ typedef ztd::explicit_bool explicit_bool;
public:
/**
* The line-number type.
@@ -159,8 +160,8 @@
*
* @return Returns \c true only if this %location has been set.
*/
- operator bool() const {
-return !!line_;
+ operator explicit_bool::type() const {
+return explicit_bool::value_of( line_ );
}
/**
=== modified file 'include/zorba/internal/unique_ptr.h'
--- include/zorba/internal/unique_ptr.h 2012-09-19 21:16:15 +
+++ include/zorba/internal/unique_ptr.h 2012-12-01 00:08:21 +
@@ -455,8 +455,7 @@
typedef typename ZORBA_TR1_NS::add_referenceD const::type
deleter_const_reference;
- struct pointer_conversion { int valid; };
- typedef int pointer_conversion::*explicit_bool;
+ typedef zorba::internal::ztd::explicit_bool explicit_bool;
public:
typedef T element_type;
@@ -512,8 +511,8 @@
std::swap( storage_, p.storage_ );
}
- operator explicit_bool() const throw() {
-return get() ? pointer_conversion::valid : 0;
+ operator explicit_bool::type() const throw() {
+return explicit_bool::value_of( get() );
}
private:
=== modified file 'include/zorba/xquery_exception.h'
--- include/zorba/xquery_exception.h 2012-09-19 21:16:15 +
+++ include/zorba/xquery_exception.h 2012-12-01 00:08:21 +
@@ -58,6 +58,17 @@
*/
XQueryException operator=( XQueryException const from );
+ // source file/line location
+
+ /**
+ * Checks whether the XQuery source-code location has been set.
+ *
+ * @return Returns \c true only if said has been set.
+ */
+ bool has_source() const throw() {
+return source_loc_;
+ }
+
/**
* Sets the XQuery source-code URI name, line, and column numbers.
*
@@ -67,24 +78,14 @@
* @param line_end The source-code URI end line number.
* @param column_end The source-code URI end column number.
*/
- void set_source(
- char const *uri,
- line_type line,
- column_type column = 0,
- line_type line_end = 0,
- column_type column_end = 0 );
-
- /**
- * Checks whether the XQuery source location has been set.
- *
- * @return Returns \c true only if the source location has been set.
- */
- bool has_source() const throw() {
-return source_loc_;
- }
-
- /**
- * Gets the XQuery source URI containing the error.
+ void set_source( char const *uri,
+ line_type line,
+ column_type column = 0,
+ line_type line_end = 0,
+ column_type column_end = 0 );
+
+ /**
+ * Gets the XQuery source-code URI containing the error.
*
* @return Returns said URI or the empty string if unset.
*/
@@ -128,6 +129,84 @@
return source_loc_.column_end();
}
+ // applied at file/line location //
+
+ /**
+ * Checks whether the XQuery applied at location has been set.
+ *
+ * @return Returns \c true only if the applied at location has been set.
+ */
+ bool has_applied() const throw() {
+return applied_loc_;
+ }
+
+ /**
+ * Sets the XQuery source-code applied at URI name, line, and column
+ * numbers.
+ *
+ * @param uri The source-code applied at URI name. If either the null
+ * pointer or the empty string, \c source_uri() is used.
+ * @param line The source-code applied at URI line number.
+ * @param column The source-code applied at URI column number.
+ * @param line_end The source-code applied at URI end line number.
+ * @param column_end The source-code applied at URI end column number.
+ */
+ void set_applied( char const *uri,
+line_type line,
+column_type column = 0,
+line_type line_end = 0,
+column_type column_end = 0 );
+
+ /**
+ * Gets the XQuery source-code applied at URI containing the error.
+ *
+ * @return Returns said URI or the empty string if unset.
+ */
+ char const* applied_uri() const throw() {
+return applied_loc_.file();
+ }
+
+ /**
+ * Gets the XQuery source-code applied at line number containing the error.
+ *
+ * @return Returns said line number or 0