[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug1207668 into lp:zorba

2013-08-02 Thread Federico Cavalieri
Federico Cavalieri has proposed merging lp:~zorba-coders/zorba/bug1207668 into 
lp:zorba.

Commit message:
Fixed bug 1207668

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug1207668/+merge/178223

Fixed bug 1207668
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1207668/+merge/178223
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/http-client/json/http-client.xq.src/http_response_parser.cpp'
--- modules/http-client/json/http-client.xq.src/http_response_parser.cpp	2013-07-30 18:35:31 +
+++ modules/http-client/json/http-client.xq.src/http_response_parser.cpp	2013-08-02 09:05:38 +
@@ -41,10 +41,12 @@
 
 namespace http_client {
 
-void parse_content_type( std::string const s, std::string *mime_type,
-std::string *charset ) {
-  std::string::size_type pos = s.find( ';' );
-  *mime_type = s.substr( 0, pos );
+void parse_content_type( std::string const media_type, std::string *mime_type,
+std::string *charset )
+{
+  std::string::size_type start = 0;
+  std::string::size_type end = media_type.find( ';' );
+  *mime_type = media_type.substr( start, end - start );
 
   if ( std::strncmp( mime_type-c_str(), text/, 5 ) == 0 ) {
 //
@@ -61,29 +63,44 @@
   } else
 charset-clear();
 
-  if ( pos != std::string::npos ) {
-//
-// Parse: charset=?X?[ (comment)]
-//
-if ( (pos = s.find( '=' )) != std::string::npos ) {
-  std::string t = s.substr( pos + 1 );
-  if ( !t.empty() ) {
-if ( t[0] == '' ) {
+  //media-type = type / subtype *( ; parameter )
+  //type = token
+  //subtype = token
+  //parameter = attribute = value
+  //attribute = token
+  //value = token | quoted-string
+  //quoted-string  = (  *(qdtext)  )
+  //qdtext = any TEXT except 
+  std::vectorstd::string fields;
+  while ((end = media_type.find(';',start)) != std::string::npos)
+  {
+fields.push_back(media_type.substr(start,end-start));
+start = end+1;
+  }
+  fields.push_back(media_type.substr(start));
+
+  std::vectorstd::string::iterator it = fields.begin();
+  for (;it!=fields.end();++it)
+  {
+std::string field =*it;
+std::transform(field.begin(), field.end(), field.begin(), ::tolower);
+field.erase(remove_if(field.begin(), field.end(), ::isspace), field.end());
+if ((start = field.find(charset=)) != std::string::npos)
+{
+  std::string t = field.substr(start + 8);
+  if (!t.empty())
+  {
+if (t[0] == ''  t[t.length()-1] == '')
+	{
   t.erase( 0, 1 );
-  if ( (pos = t.find( '' )) != std::string::npos )
-t.erase( pos );
-} else {
-  if ( (pos = t.find( ' ' )) != std::string::npos )
-t.erase( pos );
-}
+  t.erase(t.length() -1, 1);	  
+	}
 *charset = t;
-  } 
+  }
 }
   }
 }
 
-
-  
   HttpResponseParser::HttpResponseParser(HttpResponseHandler aHandler, CURL* aCurl,
  ErrorThrower aErrorThrower,
  std::string aOverridenContentType,

=== added file 'test/rbkt/ExpQueryResults/zorba/http-client/json/send-request/http3-charset.xml.res'
--- test/rbkt/ExpQueryResults/zorba/http-client/json/send-request/http3-charset.xml.res	1970-01-01 00:00:00 +
+++ test/rbkt/ExpQueryResults/zorba/http-client/json/send-request/http3-charset.xml.res	2013-08-02 09:05:38 +
@@ -0,0 +1,1 @@
+wrongone wrongone
\ No newline at end of file

=== added file 'test/rbkt/ExpQueryResults/zorba/http-client/json/send-request/http3-charset2.xml.res'
--- test/rbkt/ExpQueryResults/zorba/http-client/json/send-request/http3-charset2.xml.res	1970-01-01 00:00:00 +
+++ test/rbkt/ExpQueryResults/zorba/http-client/json/send-request/http3-charset2.xml.res	2013-08-02 09:05:38 +
@@ -0,0 +1,2 @@
+http:request xmlns:http=http://expath.org/ns/http-client; href=zorbatest.lambda.nu:8080/http-test-data/request.php method=POSThttp:header name=User-Agent value=libcurl-agent/1.0/http:headerhttp:header name=Host value=zorbatest.lambda.nu:8080/http:headerhttp:header name=Accept value=*/*/http:headerhttp:header name=foo value=bar/http:headerhttp:header name=Content-Type value=multipart/form-data; boundary=4ebf00fbcf09/http:headerhttp:header name=Content-Length value=37/http:headerhttp:multipart boundary=4ebf00fbcf09 content-type=multipart/form-data
+  /http:multipart/http:request
\ No newline at end of file

=== added file 'test/rbkt/Queries/zorba/http-client/json/send-request/http3-charset.xq'
--- test/rbkt/Queries/zorba/http-client/json/send-request/http3-charset.xq	1970-01-01 00:00:00 +
+++ test/rbkt/Queries/zorba/http-client/json/send-request/http3-charset.xq	2013-08-02 09:05:38 +
@@ -0,0 +1,44 @@
+jsoniq version 1.0;
+import module namespace http = 

Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-cloudant into lp:zorba

2013-08-02 Thread Federico Cavalieri
 - The indentation has several problems. Could you please make it consistent.
 Especially in the C++ code.

sure.

 - Why don't you use the same approach as we did for xbrl-cloud and keep the
 connection map in JSONiq (using the map module)? I think that would be more
 appropriate for this module than replicating 400 lines of c++ code. If this is
 a recurring pattern, we might think about providing core support for it but I
 feel that the JSONiq map is good enough for now. Also, I wouldn't worry about
 the disconnect at this point.

When the story was discussed I was suggested to manage connections as the JDBC 
module does. But I probably misunderstood.
I updated the code to manage connection from XQuery and removed all c++ code.
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-cloudant/+merge/177111
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-external-cloudant-module into lp:zorba

2013-08-02 Thread Federico Cavalieri
Module in lp:~zorba-coders/zorba/cloudant-module
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-external-cloudant-module/+merge/178255
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-cloudant into lp:zorba

2013-08-02 Thread Federico Cavalieri
Review: Resubmit

External module merge proposal in 
lp:~zorba-coders/zorba/feature-external-cloudant-module
and
lp:~zorba-coders/zorba/cloudant-module
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-cloudant/+merge/177111
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Paul J. Lucas
Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Might as well change the public HexBinary API to match the new Base64 public 
API.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319

Might as well change the public HexBinary API to match the new Base64 public 
API.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-08-01 00:59:53 +
+++ ChangeLog	2013-08-02 15:05:39 +
@@ -38,6 +38,7 @@
   * Fixed bug #1188280 (casting xs:id to xs:ncname)
   * Fixed bug in casting to xs:NCName
   * Replaced Base64 C++ API with a better one.
+  * Replaced HexBinary C++ API with a better one.
   * Check that the namespace URI used in default namespace declaration is valid
   * Fixed bug in error conditions for computed PI constructor
   * Fixed implementation of fn:deep-equal according to latest W3C spec.

=== modified file 'include/zorba/util/base64_util.h'
--- include/zorba/util/base64_util.h	2013-07-30 18:35:31 +
+++ include/zorba/util/base64_util.h	2013-08-02 15:05:39 +
@@ -337,7 +337,7 @@
 /**
  * Base64-encodes a buffer and writes the encoded bytes to the given stream.
  *
- * @param from A pointer to the Base64 buffer to be encoded.
+ * @param from A pointer to the buffer to be encoded.
  * @param from_len The number of bytes to encode.
  * @param to The ostream to write the encoded bytes to.
  * @return Returns the number of encoded bytes.
@@ -349,7 +349,7 @@
  * Base64-encodes a buffer and appends the encoded bytes onto a string.
  *
  * @tparam ToStringType The string type.
- * @param from A pointer to the Base64 buffer to be encoded.
+ * @param from A pointer to the buffer to be encoded.
  * @param from_len The number of bytes to encode.
  * @param to A pointer to the string to append the encoded bytes onto.
  * @return Returns the number of encoded bytes.

=== modified file 'include/zorba/util/fs_util.h'
--- include/zorba/util/fs_util.h	2013-06-17 19:24:39 +
+++ include/zorba/util/fs_util.h	2013-08-02 15:05:39 +
@@ -397,7 +397,9 @@
   templateclass PathStringType
   iterator( PathStringType const path,
 typename std::enable_ifZORBA_HAS_C_STR(PathStringType)
-   ::type* = 0 ) : dir_path_( path.c_str() ) {
+   ::type* = nullptr ) :
+dir_path_( path.c_str() )
+  {
 ctor_impl();
   }
 

=== modified file 'include/zorba/util/hexbinary_util.h'
--- include/zorba/util/hexbinary_util.h	2013-06-21 06:20:46 +
+++ include/zorba/util/hexbinary_util.h	2013-08-02 15:05:39 +
@@ -1,12 +1,12 @@
 /*
- * Copyright 2006-2009 The FLWOR Foundation.
- *
+ * 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.
@@ -14,32 +14,347 @@
  * limitations under the License.
  */
 
+#pragma once
 #ifndef ZORBA_HEXBINARY_API_H
 #define ZORBA_HEXBINARY_API_H
 
 // standard
 #include iostream
+#include stdexcept
+#include sys/types.h  /* for size_t */
+#include vector
 
-// zorba
-#include zorba/config.h
-#include zorba/zorba_string.h
+// Zorba
+#include zorba/internal/cxx_util.h
+#include zorba/internal/type_traits.h
+#include zorba/internal/ztd.h
+#include zorba/util/stream_util.h
 
 namespace zorba {
 namespace hexbinary {
 
-///
-
-ZORBA_DLL_PUBLIC
-String encode( String const aString );
-
-ZORBA_DLL_PUBLIC
-String encode( std::istream aStream );
-
-ZORBA_DLL_PUBLIC
-String decode( String const aString );
-
-ZORBA_DLL_PUBLIC
-String decode( std::istream aStream );
+// Types //
+
+typedef size_t size_type;
+
+/**
+ * Options to use for decoding.
+ */
+enum decode_options {
+  dopt_none   = 0x00, /// No options.
+  dopt_ignore_ws  = 0x01, /// Ignore all whitespace.
+};
+
+// Exception //
+
+/**
+ * A %hexbinary::exception is-an invalid_argument that contains additional
+ * details about the exception such as the invalid character and its offset.
+ */
+class exception : public std::invalid_argument {
+public:
+  exception( char c, size_type offset, std::string const msg ) :
+std::invalid_argument( msg ), char_( c ), offset_( offset ) { }
+
+  char invalid_char() const {
+return char_;
+  }
+
+  

Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Paul J. Lucas
Review: Approve


-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Paul J. Lucas
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Zorba Build Bot
Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319 :
Votes: {'Approve': 1}
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Zorba Build Bot
Validation queue result for 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319

Stage CommitZorba failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/81/console to 
view the results.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/use-dataguide into lp:zorba

2013-08-02 Thread Paul J. Lucas
Review: Needs Fixing

Please match the rest of the code style, e.g.:

s/NULL/nullptr/
s/dataguide/dataguide_/
-- 
https://code.launchpad.net/~zorba-coders/zorba/use-dataguide/+merge/176385
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Zorba Build Bot
Validation queue starting for the following merge proposals:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread Zorba Build Bot
Validation queue succeeded - proposal merged!
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

2013-08-02 Thread noreply
The proposal to merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba has been 
updated.

Status: Approved = Merged

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178319
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1188058 into lp:zorba

2013-08-02 Thread Luis Rodriguez Gonzalez
Luis Rodriguez Gonzalez has proposed merging lp:~zorba-coders/zorba/bug-1188058 
into lp:zorba.

Requested reviews:
  Luis Rodriguez Gonzalez (kuraru)
  Chris Hillery (ceejatec)
Related bugs:
  Bug #1188058 in Zorba: Update non-core module system
  https://bugs.launchpad.net/zorba/+bug/1188058

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1188058/+merge/178389
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1188058/+merge/178389
Your team Zorba Coders is subscribed to branch lp:zorba.
=== added file 'CMakeLists.txt'
--- CMakeLists.txt	1970-01-01 00:00:00 +
+++ CMakeLists.txt	2013-08-02 21:22:34 +
@@ -0,0 +1,29 @@
+# Copyright 2006-2010 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.
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+PROJECT (zorba_system_module)
+ENABLE_TESTING ()
+INCLUDE (CTest)
+
+LIST (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
+
+FIND_PACKAGE (Zorba REQUIRED HINTS ${ZORBA_BUILD_DIR})
+INCLUDE (${Zorba_USE_FILE})
+
+ADD_TEST_DIRECTORY(${PROJECT_SOURCE_DIR}/test)
+ADD_SUBDIRECTORY(src)
+
+DONE_DECLARING_ZORBA_URIS()

=== renamed file 'CMakeLists.txt' = 'CMakeLists.txt.moved'
=== added directory 'src'
=== renamed directory 'src' = 'src.moved'
=== added file 'src/CMakeLists.txt'
--- src/CMakeLists.txt	1970-01-01 00:00:00 +
+++ src/CMakeLists.txt	2013-08-02 21:22:34 +
@@ -0,0 +1,14 @@
+# 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.
+DECLARE_ZORBA_MODULE (URI http://zorba.io/modules/system; VERSION 1.0 FILE system.xq)

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp