zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #05302
[Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/feature-uri_module into lp:zorba.
Requested reviews:
Matthias Brantner (matthias-brantner)
Chris Hillery (ceejatec)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492
A new module that provides URL-related functions. Currently, it provides functions to do URL-decoding but other URL-related functions (e.g. to retrieve the scheme or path) will be added later.
--
https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2012-02-23 16:41:10 +0000
+++ ChangeLog 2012-02-24 03:29:18 +0000
@@ -12,6 +12,7 @@
* Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types.
* Fixed bug 917923 (bug in copying outer var values into the eval dynamic context)
* Fixed bug 924063 (sentence is incorrectly incremented when token characters end without sentence terminator)
+ * New URI module providing percent-decoding functions.
* Optimization: change the implementation of the free-vars annotation and got rid
of the annotations map in expressions.
* Fixed bug 909126 (bug in cloning of var_expr)
=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-02-16 14:11:02 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-02-24 03:29:18 +0000
@@ -63,6 +63,8 @@
URI "http://www.zorba-xquery.com/modules/schema")
DECLARE_ZORBA_MODULE(FILE string.xq VERSION 2.1
URI "http://www.zorba-xquery.com/modules/string")
+DECLARE_ZORBA_MODULE(FILE uri.xq VERSION 1.0
+ URI "http://www.zorba-xquery.com/modules/uri")
DECLARE_ZORBA_MODULE(FILE xml.xq VERSION 2.0
URI "http://www.zorba-xquery.com/modules/xml")
DECLARE_ZORBA_MODULE(FILE xqdoc.xq VERSION 2.0
=== added file 'modules/com/zorba-xquery/www/modules/uri.xq'
--- modules/com/zorba-xquery/www/modules/uri.xq 1970-01-01 00:00:00 +0000
+++ modules/com/zorba-xquery/www/modules/uri.xq 2012-02-24 03:29:18 +0000
@@ -0,0 +1,96 @@
+xquery version "1.0";
+
+(:
+ : Copyright 2006-2012 The FLWOR Foundation.
+ :
+ : Licensed under the Apache License, Version 2.0 (the "License");
+ : you may not use this file except in compliance with the License.
+ : You may obtain a copy of the License at
+ :
+ : http://www.apache.org/licenses/LICENSE-2.0
+ :
+ : Unless required by applicable law or agreed to in writing, software
+ : distributed under the License is distributed on an "AS IS" BASIS,
+ : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ : See the License for the specific language governing permissions and
+ : limitations under the License.
+:)
+
+(:~
+ : This module provides string related functions.
+ :
+ : @author Matthias Brantner
+ : @project XDM/atomic
+ :
+ :)
+module namespace uri = "http://www.zorba-xquery.com/modules/uri";
+
+declare namespace zerr = "http://www.zorba-xquery.com/errors";
+
+declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
+declare option ver:module-version "1.0";
+
+(:~
+ : Percent-decodes (aka URL decoding) the given string.
+ :
+ : All percent encoded octets will be translated into their
+ : decoded UTF-8 representation.
+ :
+ : @param $s the string to decode
+ :
+ : @return the percent decoded string
+ :)
+declare function uri:decode($u as xs:string) as xs:string
+{
+ uri:decode($u, fn:false())
+};
+
+(:~
+ : Percent-decodes (aka URL decoding) the given string.
+ :
+ : All percent encoded octets will be translated into their
+ : decoded UTF-8 representation.
+ :
+ : If $decode-plus is specified all occurrences of the char '+'
+ : will be replaced with a space ' ' before the percent decoding
+ : happens.
+ :
+ : @param $s the string to decode
+ : @param $decode-plus whether '+' chars will be replaced with spaces
+ :
+ : @return the percent decoded string
+ :)
+declare function uri:decode(
+ $u as xs:string,
+ $decode-plus as xs:boolean) as xs:string
+{
+ uri:decode($u, $decode-plus, "UTF-8")
+};
+
+(:~
+ : Percent-decodes (aka URL decoding) the given string.
+ :
+ : All percent encoded octets will be translated into their
+ : decoded UTF-8 representation.
+ :
+ : If $decode-plus is specified all occurrences of the char '+'
+ : will be replaced with a space ' ' before the percent decoding
+ : happens.
+ :
+ : The $charset parameter specifies the source charset after precent
+ : decoding. It is used to convert the decoded string into UTF-8.
+ :
+ : @param $s the string to decode
+ : @param $decode-plus whether '+' chars will be replaced with spaces
+ : @param $charset the source charset of the string after percent decoding
+ :
+ : @return the percent decoded string
+ :
+ : @error zerr:ZXQP0006 if the given charset is unknown or not supported
+ :
+ : @error zerr:ZOSE0006 if there is an error transcoding the string
+ :)
+declare function uri:decode(
+ $s as xs:string,
+ $decode-plus as xs:boolean,
+ $charset as xs:string) as xs:string external;
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2012-02-16 14:11:02 +0000
+++ src/context/static_context.cpp 2012-02-24 03:29:18 +0000
@@ -366,6 +366,10 @@
"http://www.zorba-xquery.com/modules/string";
const char*
+static_context::ZORBA_URI_FN_NS =
+"http://www.zorba-xquery.com/modules/uri";
+
+const char*
static_context::ZORBA_FETCH_FN_NS =
"http://www.zorba-xquery.com/modules/fetch";
@@ -441,6 +445,7 @@
ns == ZORBA_REFLECTION_FN_NS ||
ns == ZORBA_SCRIPTING_FN_NS ||
ns == ZORBA_STRING_FN_NS ||
+ ns == ZORBA_URI_FN_NS ||
ns == ZORBA_JSON_FN_NS ||
ns == ZORBA_FETCH_FN_NS ||
ns == ZORBA_NODE_FN_NS ||
@@ -488,6 +493,7 @@
{
return (ns == ZORBA_MATH_FN_NS ||
ns == ZORBA_INTROSP_SCTX_FN_NS ||
+ ns == ZORBA_STRING_FN_NS ||
ns == ZORBA_JSON_FN_NS ||
ns == ZORBA_RANDOM_FN_NS);
}
=== modified file 'src/context/static_context.h'
--- src/context/static_context.h 2012-02-16 14:11:02 +0000
+++ src/context/static_context.h 2012-02-24 03:29:18 +0000
@@ -465,6 +465,7 @@
static const char* ZORBA_INTROSP_SCTX_FN_NS;
static const char* ZORBA_REFLECTION_FN_NS;
static const char* ZORBA_STRING_FN_NS;
+ static const char* ZORBA_URI_FN_NS;
static const char* ZORBA_FETCH_FN_NS;
static const char* ZORBA_NODE_FN_NS;
static const char* ZORBA_XML_FN_NS;
=== modified file 'src/functions/library.cpp'
--- src/functions/library.cpp 2012-02-16 14:11:02 +0000
+++ src/functions/library.cpp 2012-02-24 03:29:18 +0000
@@ -57,6 +57,7 @@
#include "functions/func_sequences.h"
#include "functions/func_sequences_impl.h"
#include "functions/func_strings.h"
+#include "functions/func_uris.h"
#include "functions/func_json.h"
#include "functions/func_var_decl.h"
#include "functions/func_xqdoc.h"
@@ -121,6 +122,7 @@
populate_context_schema(sctx);
populate_context_sctx(sctx);
populate_context_strings(sctx);
+ populate_context_uris(sctx);
populate_context_sequences(sctx);
populate_context_sequences_impl(sctx);
populate_context_xqdoc(sctx);
=== added file 'src/functions/pregenerated/func_uris.cpp'
--- src/functions/pregenerated/func_uris.cpp 1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_uris.cpp 2012-02-24 03:29:18 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+
+
+#include "stdafx.h"
+#include "runtime/uris/uris.h"
+#include "functions/func_uris.h"
+
+
+namespace zorba{
+
+
+
+PlanIter_t fn_zorba_uri_decode::codegen(
+ CompilerCB*,
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& argv,
+ expr& ann) const
+{
+ return new DecodeURIIterator(sctx, loc, argv);
+}
+
+void populate_context_uris(static_context* sctx)
+{
+ {
+
+
+ DECL_WITH_KIND(sctx, fn_zorba_uri_decode,
+ (createQName("http://www.zorba-xquery.com/modules/uri","","decode"),
+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
+ GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE,
+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
+ GENV_TYPESYSTEM.STRING_TYPE_ONE),
+ FunctionConsts::FN_ZORBA_URI_DECODE_3);
+
+ }
+
+}
+
+
+}
+
+
+
=== added file 'src/functions/pregenerated/func_uris.h'
--- src/functions/pregenerated/func_uris.h 1970-01-01 00:00:00 +0000
+++ src/functions/pregenerated/func_uris.h 2012-02-24 03:29:18 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+
+
+#ifndef ZORBA_FUNCTIONS_URIS_H
+#define ZORBA_FUNCTIONS_URIS_H
+
+
+#include "common/shared_types.h"
+#include "functions/function_impl.h"
+
+
+namespace zorba {
+
+
+void populate_context_uris(static_context* sctx);
+
+
+
+
+//fn-zorba-uri:decode
+class fn_zorba_uri_decode : public function
+{
+public:
+ fn_zorba_uri_decode(const signature& sig, FunctionConsts::FunctionKind kind)
+ :
+ function(sig, kind)
+ {
+
+ }
+
+ CODEGEN_DECL();
+};
+
+
+} //namespace zorba
+
+
+#endif
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h 2012-02-16 14:11:02 +0000
+++ src/functions/pregenerated/function_enum.h 2012-02-24 03:29:18 +0000
@@ -374,6 +374,7 @@
FN_ZORBA_STRING_MATERIALIZE_1,
FN_ZORBA_STRING_IS_STREAMABLE_1,
FN_ZORBA_STRING_SPLIT_2,
+ FN_ZORBA_URI_DECODE_3,
FN_ZORBA_XQDOC_XQDOC_1,
FN_ZORBA_XQDOC_XQDOC_CONTENT_1,
=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml 2012-02-16 14:11:02 +0000
+++ src/runtime/spec/mappings.xml 2012-02-24 03:29:18 +0000
@@ -106,6 +106,10 @@
define="ZORBA_STRING_FN_NS"
prefix="fn-zorba-string"/>
+ <zorba:namespace uri="http://www.zorba-xquery.com/modules/uri"
+ define="ZORBA_URI_FN_NS"
+ prefix="fn-zorba-uri"/>
+
<zorba:namespace uri="http://www.zorba-xquery.com/modules/converters/json"
define="ZORBA_JSON_FN_NS"
prefix="fn-zorba-json"/>
=== added directory 'src/runtime/spec/uris'
=== added file 'src/runtime/spec/uris/uris.xml'
--- src/runtime/spec/uris/uris.xml 1970-01-01 00:00:00 +0000
+++ src/runtime/spec/uris/uris.xml 2012-02-24 03:29:18 +0000
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/////////////////////////////////////////////////////////////////////////////////
+// //
+// 7.2 Functions to Assemble and Disassemble Strings
+// //
+/////////////////////////////////////////////////////////////////////////////////
+-->
+<zorba:iterators
+ xmlns:zorba="http://www.zorba-xquery.com"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
+
+<zorba:header>
+ <zorba:include form="Quoted">zorbautils/checked_vector.h</zorba:include>
+ <zorba:include form="Quoted">zorbatypes/schema_types.h</zorba:include>
+</zorba:header>
+
+<!--
+/*******************************************************************************
+********************************************************************************/
+-->
+<zorba:iterator name="DecodeURIIterator">
+
+ <zorba:description author="Zorba Team">
+ uri:decode
+ </zorba:description>
+
+ <zorba:function>
+ <zorba:signature localname="decode" prefix="fn-zorba-uri">
+ <zorba:param>xs:string</zorba:param>
+ <zorba:param>xs:boolean</zorba:param>
+ <zorba:param>xs:string</zorba:param>
+ <zorba:output>xs:string</zorba:output>
+ </zorba:signature>
+ </zorba:function>
+</zorba:iterator>
+
+</zorba:iterators>
=== added directory 'src/runtime/uris'
=== added directory 'src/runtime/uris/pregenerated'
=== added file 'src/runtime/uris/pregenerated/uris.cpp'
--- src/runtime/uris/pregenerated/uris.cpp 1970-01-01 00:00:00 +0000
+++ src/runtime/uris/pregenerated/uris.cpp 2012-02-24 03:29:18 +0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+
+#include "stdafx.h"
+#include "zorbatypes/rchandle.h"
+#include "zorbatypes/zstring.h"
+#include "runtime/visitors/planiter_visitor.h"
+#include "runtime/uris/uris.h"
+#include "system/globalenv.h"
+
+
+
+namespace zorba {
+
+// <DecodeURIIterator>
+const char* DecodeURIIterator::class_name_str = "DecodeURIIterator";
+DecodeURIIterator::class_factory<DecodeURIIterator>
+DecodeURIIterator::g_class_factory;
+
+const serialization::ClassVersion
+DecodeURIIterator::class_versions[] ={{ 1, 0x000905, false}};
+
+const int DecodeURIIterator::class_versions_count =
+sizeof(DecodeURIIterator::class_versions)/sizeof(struct serialization::ClassVersion);
+
+void DecodeURIIterator::accept(PlanIterVisitor& v) const {
+ v.beginVisit(*this);
+
+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
+ for ( ; lIter != lEnd; ++lIter ){
+ (*lIter)->accept(v);
+ }
+
+ v.endVisit(*this);
+}
+
+DecodeURIIterator::~DecodeURIIterator() {}
+
+// </DecodeURIIterator>
+
+
+
+}
+
+
=== added file 'src/runtime/uris/pregenerated/uris.h'
--- src/runtime/uris/pregenerated/uris.h 1970-01-01 00:00:00 +0000
+++ src/runtime/uris/pregenerated/uris.h 2012-02-24 03:29:18 +0000
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ******************************************
+// * *
+// * THIS IS A GENERATED FILE. DO NOT EDIT! *
+// * SEE .xml FILE WITH SAME NAME *
+// * *
+// ******************************************
+#ifndef ZORBA_RUNTIME_URIS_URIS_H
+#define ZORBA_RUNTIME_URIS_URIS_H
+
+
+#include "common/shared_types.h"
+
+
+
+#include "runtime/base/narybase.h"
+#include "zorbautils/checked_vector.h"
+#include "zorbatypes/schema_types.h"
+
+
+namespace zorba {
+
+/**
+ *
+ * uri:decode
+ *
+ * Author: Zorba Team
+ */
+class DecodeURIIterator : public NaryBaseIterator<DecodeURIIterator, PlanIteratorState>
+{
+public:
+ SERIALIZABLE_CLASS(DecodeURIIterator);
+
+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(DecodeURIIterator,
+ NaryBaseIterator<DecodeURIIterator, PlanIteratorState>);
+
+ void serialize( ::zorba::serialization::Archiver& ar)
+ {
+ serialize_baseclass(ar,
+ (NaryBaseIterator<DecodeURIIterator, PlanIteratorState>*)this);
+ }
+
+ DecodeURIIterator(
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& children)
+ :
+ NaryBaseIterator<DecodeURIIterator, PlanIteratorState>(sctx, loc, children)
+ {}
+
+ virtual ~DecodeURIIterator();
+
+ void accept(PlanIterVisitor& v) const;
+
+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+}
+#endif
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
=== added file 'src/runtime/uris/uris_impl.cpp'
--- src/runtime/uris/uris_impl.cpp 1970-01-01 00:00:00 +0000
+++ src/runtime/uris/uris_impl.cpp 2012-02-24 03:29:18 +0000
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2006-2012 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#include <algorithm>
+
+#include "common/common.h"
+
+#include "diagnostics/assert.h"
+#include "diagnostics/xquery_diagnostics.h"
+#include "diagnostics/util_macros.h"
+
+#include "runtime/uris/uris.h"
+
+#include "system/globalenv.h"
+#include "store/api/item_factory.h"
+
+#include "zorba/transcode_stream.h"
+
+#include "util/uri_util.h"
+
+using namespace std;
+
+namespace zorba {
+
+/******************************************************************************
+*******************************************************************************/
+bool
+DecodeURIIterator::nextImpl(store::Item_t& result, PlanState& planState) const
+{
+ store::Item_t lString, lDecodePlus, lEncoding;
+ zstring lDecodedString, lCharset;
+
+ PlanIteratorState* state;
+ DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+
+ consumeNext(lString, theChildren[0].getp(), planState);
+ consumeNext(lDecodePlus, theChildren[1].getp(), planState);
+ consumeNext(lEncoding, theChildren[2].getp(), planState);
+
+ lString->getStringValue2(lDecodedString);
+ lEncoding->getStringValue2(lCharset);
+
+ uri::decode(lDecodedString);
+
+ if (lDecodePlus->getBooleanValue())
+ {
+ std::replace( lDecodedString.begin(), lDecodedString.end(), '+', ' ' );
+ }
+
+ if (transcode::is_necessary(lCharset.c_str()))
+ {
+ if (!transcode::is_supported(lCharset.c_str()))
+ {
+ throw XQUERY_EXCEPTION(
+ zerr::ZXQP0006_UNKNOWN_ENCODING,
+ ERROR_PARAMS( lCharset ),
+ ERROR_LOC( loc )
+ );
+ }
+
+ try
+ {
+ transcode::stream<istringstream> lTranscoder( "ISO-8859-1", lDecodedString.c_str() );
+
+ lDecodedString.clear();
+ char buf[1024];
+ while (lTranscoder.good())
+ {
+ lTranscoder.read(buf, 1024);
+ lDecodedString.append(buf, lTranscoder.gcount());
+ }
+ }
+ catch (ZorbaException& e)
+ {
+ throw XQUERY_EXCEPTION(
+ zerr::ZOSE0006_TRANSCODING_ERROR,
+ ERROR_PARAMS( e.what() ),
+ ERROR_LOC( loc )
+ );
+ }
+ }
+
+ STACK_PUSH(GENV_ITEMFACTORY->createString(result, lDecodedString), state );
+
+ STACK_END (state);
+}
+} // namespace zorba
+/* vim:set et sw=2 ts=2: */
=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
--- src/runtime/visitors/pregenerated/planiter_visitor.h 2012-02-16 14:11:02 +0000
+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2012-02-24 03:29:18 +0000
@@ -588,6 +588,8 @@
class StringSplitIterator;
+ class DecodeURIIterator;
+
class XQDocIterator;
class XQDocContentIterator;
@@ -1438,6 +1440,9 @@
virtual void beginVisit ( const StringSplitIterator& ) = 0;
virtual void endVisit ( const StringSplitIterator& ) = 0;
+ virtual void beginVisit ( const DecodeURIIterator& ) = 0;
+ virtual void endVisit ( const DecodeURIIterator& ) = 0;
+
virtual void beginVisit ( const XQDocIterator& ) = 0;
virtual void endVisit ( const XQDocIterator& ) = 0;
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-02-16 14:11:02 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-02-24 03:29:18 +0000
@@ -64,6 +64,7 @@
#include "runtime/store/documents.h"
#include "runtime/store/maps.h"
#include "runtime/strings/strings.h"
+#include "runtime/uris/uris.h"
#include "runtime/xqdoc/xqdoc.h"
namespace zorba{
@@ -4004,6 +4005,20 @@
// </StringSplitIterator>
+// <DecodeURIIterator>
+void PrinterVisitor::beginVisit ( const DecodeURIIterator& a) {
+ thePrinter.startBeginVisit("DecodeURIIterator", ++theId);
+ printCommons( &a, theId );
+ thePrinter.endBeginVisit( theId );
+}
+
+void PrinterVisitor::endVisit ( const DecodeURIIterator& ) {
+ thePrinter.startEndVisit();
+ thePrinter.endEndVisit();
+}
+// </DecodeURIIterator>
+
+
// <XQDocIterator>
void PrinterVisitor::beginVisit ( const XQDocIterator& a) {
thePrinter.startBeginVisit("XQDocIterator", ++theId);
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
--- src/runtime/visitors/pregenerated/printer_visitor.h 2012-02-16 14:11:02 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.h 2012-02-24 03:29:18 +0000
@@ -885,6 +885,9 @@
void beginVisit( const StringSplitIterator& );
void endVisit ( const StringSplitIterator& );
+ void beginVisit( const DecodeURIIterator& );
+ void endVisit ( const DecodeURIIterator& );
+
void beginVisit( const XQDocIterator& );
void endVisit ( const XQDocIterator& );
=== added directory 'test/rbkt/ExpQueryResults/zorba/uris'
=== added file 'test/rbkt/ExpQueryResults/zorba/uris/decode_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/uris/decode_01.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/uris/decode_01.xml.res 2012-02-24 03:29:18 +0000
@@ -0,0 +1,1 @@
+foo=ä¥FÅõ
=== added file 'test/rbkt/ExpQueryResults/zorba/uris/decode_03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/uris/decode_03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/uris/decode_03.xml.res 2012-02-24 03:29:18 +0000
@@ -0,0 +1,1 @@
+ä¨bcö
=== added file 'test/rbkt/ExpQueryResults/zorba/uris/decode_04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/uris/decode_04.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/uris/decode_04.xml.res 2012-02-24 03:29:18 +0000
@@ -0,0 +1,1 @@
+äö ü
=== added directory 'test/rbkt/Queries/zorba/uris'
=== added file 'test/rbkt/Queries/zorba/uris/decode_01.xq'
--- test/rbkt/Queries/zorba/uris/decode_01.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/uris/decode_01.xq 2012-02-24 03:29:18 +0000
@@ -0,0 +1,3 @@
+import module namespace u = "http://www.zorba-xquery.com/modules/uri";
+
+u:decode("foo=%E4%A5F%C5%F5", fn:false(), "ISO-8859-1")
=== added file 'test/rbkt/Queries/zorba/uris/decode_02.spec'
--- test/rbkt/Queries/zorba/uris/decode_02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/uris/decode_02.spec 2012-02-24 03:29:18 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/errors:ZXQP0006
=== added file 'test/rbkt/Queries/zorba/uris/decode_02.xq'
--- test/rbkt/Queries/zorba/uris/decode_02.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/uris/decode_02.xq 2012-02-24 03:29:18 +0000
@@ -0,0 +1,3 @@
+import module namespace u = "http://www.zorba-xquery.com/modules/uri";
+
+u:decode("foo=%E4%A5F%C5%F5", fn:false(), "foo")
=== added file 'test/rbkt/Queries/zorba/uris/decode_03.xq'
--- test/rbkt/Queries/zorba/uris/decode_03.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/uris/decode_03.xq 2012-02-24 03:29:18 +0000
@@ -0,0 +1,4 @@
+import module namespace u = "http://www.zorba-xquery.com/modules/uri";
+
+u:decode("%C3%A4%C2%A8bc%C3%B6", fn:false())
+
=== added file 'test/rbkt/Queries/zorba/uris/decode_04.xq'
--- test/rbkt/Queries/zorba/uris/decode_04.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/uris/decode_04.xq 2012-02-24 03:29:18 +0000
@@ -0,0 +1,3 @@
+import module namespace u = "http://www.zorba-xquery.com/modules/uri";
+
+u:decode("%C3%A4%C3%B6+%C3%BC", fn:true())
Follow ups