Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread Matthias Brantner
The proposal to merge lp:~paul-lucas/zorba/feature-utf8_streambuf into lp:zorba 
has been updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread Zorba Build Bot
There are additional revisions which have not been approved in review. Please 
seek review and approval of these new revisions.
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread Zorba Build Bot
The proposal to merge lp:~paul-lucas/zorba/feature-utf8_streambuf into lp:zorba 
has been updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread Paul J. Lucas
The proposal to merge lp:~paul-lucas/zorba/feature-utf8_streambuf into lp:zorba 
has been updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/feature-utf8_streambuf-2013-01-26T01-04-43.101Z/log.html
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread Zorba Build Bot
Validation queue job feature-utf8_streambuf-2013-01-26T01-04-43.101Z is 
finished. The final status was:

All tests succeeded!
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-25 Thread noreply
The proposal to merge lp:~paul-lucas/zorba/feature-utf8_streambuf into lp:zorba 
has been updated.

Status: Approved = Merged

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-24 Thread Juan Zacarias
Review: Approve


-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-24 Thread Sorin Marian Nasoi
Review: Approve


-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-08 Thread Paul J. Lucas
Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/feature-utf8_streambuf 
into lp:zorba.

Commit message:
Streambuf for validating UTF-8 on-the-fly.

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

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440

Streambuf for validating UTF-8 on-the-fly.
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/unit_tests/CMakeLists.txt'
--- src/unit_tests/CMakeLists.txt	2013-01-05 00:57:49 +
+++ src/unit_tests/CMakeLists.txt	2013-01-09 05:11:31 +
@@ -23,6 +23,8 @@
   test_uri.cpp
   test_uuid.cpp
   unit_tests.cpp
+  test_uri.cpp
+  test_utf8_streambuf.cpp
 )
 
 IF (NOT ZORBA_NO_FULL_TEXT)

=== added file 'src/unit_tests/test_utf8_streambuf.cpp'
--- src/unit_tests/test_utf8_streambuf.cpp	1970-01-01 00:00:00 +
+++ src/unit_tests/test_utf8_streambuf.cpp	2013-01-09 05:11:31 +
@@ -0,0 +1,166 @@
+/*
+ * 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.
+ */
+
+#include stdafx.h
+
+#include fstream
+#include iostream
+#include sstream
+#include string
+
+#include zorba/zorba_exception.h
+
+#include util/utf8_streambuf.h
+
+using namespace std;
+using namespace zorba;
+
+#define SMILEY_FACE   \xF0\x9F\x98\x8A
+#define COPYRIGHT_UTF8\xC2\xA9
+#define ONE_THIRD_UTF8\xE2\x85\x93
+
+#define BAD_COPYRIGHT_1_UTF8  \x42\xA9
+#define BAD_COPYRIGHT_2_UTF8  \xC2\x79
+
+static char const *const tests_good[] = {
+  Hello, world!,
+  Copyright  COPYRIGHT_UTF8  2012,
+  ONE_THIRD_UTF8  cup sugar,
+  Smiley  SMILEY_FACE,
+  Smiley 2  SMILEY_FACE SMILEY_FACE,
+  SMILEY_FACE  Smiley,
+  SMILEY_FACE SMILEY_FACE  2 Smiley,
+  0
+};
+
+static char const *const tests_bad[] = {
+  Copyright  BAD_COPYRIGHT_1_UTF8  2012,
+  Copyright  BAD_COPYRIGHT_2_UTF8  2012,
+  0
+};
+
+///
+
+static int failures;
+
+static bool assert_true( int no, char const *expr, int line, bool result ) {
+  if ( !result ) {
+cout  '#'  no   FAILED, line   line  :   expr  endl;
+++failures;
+  }
+  return result;
+}
+
+static void print_exception( int no, char const *expr, int line,
+ std::exception const e ) {
+  assert_true( no, expr, line, false );
+  cout  + exception:   e.what()  endl;
+}
+
+#define ASSERT_TRUE( NO, EXPR ) assert_true( NO, #EXPR, __LINE__, !!(EXPR) )
+
+#define ASSERT_TRUE_AND_NO_EXCEPTION( NO, EXPR ) \
+  try { ASSERT_TRUE( NO, EXPR ); } \
+  catch ( exception const e ) { print_exception( NO, #EXPR, __LINE__, e ); } \
+  catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
+
+#define ASSERT_EXCEPTION( NO, EXPR ) \
+  try { EXPR; assert_true( NO, #EXPR, __LINE__, false ); } \
+  catch ( ZorbaException const e ) { } \
+  catch ( ... ) { assert_true( NO, #EXPR, __LINE__, false ); }
+
+///
+
+static bool test_getline( char const *test ) {
+  istringstream iss( test );
+  utf8::streambuf utf_buf( iss.rdbuf() );
+  iss.ios::rdbuf( utf_buf );
+  iss.exceptions( ios::badbit );
+
+  char buf[ 1024 ];
+  iss.getline( buf, sizeof buf );
+  if ( iss.gcount() ) {
+string const s( buf, iss.gcount() );
+return s == test;
+  }
+  return false;
+}
+
+static bool test_read( char const *test ) {
+  istringstream iss( test );
+  utf8::streambuf utf_buf( iss.rdbuf() );
+  iss.ios::rdbuf( utf_buf );
+  iss.exceptions( ios::badbit );
+
+  char buf[ 1024 ];
+  iss.read( buf, sizeof buf );
+  if ( iss.gcount() ) {
+string const s( buf, iss.gcount() );
+return s == test;
+  }
+  return false;
+}
+
+static bool test_insertion( char const *test ) {
+  ostringstream oss;
+  utf8::streambuf utf_buf( oss.rdbuf(), true );
+  oss.ios::rdbuf( utf_buf );
+  oss.exceptions( ios::badbit );
+
+  oss  test  flush;
+  string const s( oss.str() );
+  return s == test;
+}
+
+static bool test_put( char const *test ) {
+  ostringstream oss;
+  utf8::streambuf utf_buf( oss.rdbuf(), true );
+  oss.ios::rdbuf( utf_buf );
+  oss.exceptions( ios::badbit );
+
+  for ( char const *c = test; *c; ++c )
+oss.put( *c );
+
+  string const s( oss.str() );
+  return s == test;
+}
+
+///
+
+namespace zorba {
+namespace 

Re: [Zorba-coders] [Merge] lp:~paul-lucas/zorba/feature-utf8_streambuf into lp:zorba

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


-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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/feature-utf8_streambuf into lp:zorba

2013-01-08 Thread Paul J. Lucas
Do you guys want this??

Please not that it does require some discipline to use due to the way 
exceptions are handled in streams.
-- 
https://code.launchpad.net/~paul-lucas/zorba/feature-utf8_streambuf/+merge/142440
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