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

Commit message:
1. Added operator<< for SchemaTypeCode to (a) print it better and (b) eliminate 
warning.
2. Eliminated a few other warnings as well.

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

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

1. Added operator<< for SchemaTypeCode to (a) print it better and (b) eliminate 
warning.
2. Eliminated a few other warnings as well.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/138054
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/internal/ztd.h'
--- include/zorba/internal/ztd.h	2012-09-19 21:16:15 +0000
+++ include/zorba/internal/ztd.h	2012-12-05 04:32:21 +0000
@@ -84,7 +84,7 @@
  * \internal
  * This namespace is used only to bundle the implementation details for
  * implementing \c has_insertion_operator<T>.
- * This implementation is based on http://stackoverflow.com/questions/4434569/
+ * This implementation is based on http://stackoverflow.com/q/4434569/
  */
 namespace has_insertion_operator_impl {
   typedef char no;

=== modified file 'include/zorba/store_consts.h'
--- include/zorba/store_consts.h	2012-09-19 21:16:15 +0000
+++ include/zorba/store_consts.h	2012-12-05 04:32:21 +0000
@@ -16,6 +16,7 @@
 #ifndef ZORBA_STORE_STORE_CONSTS_H
 #define ZORBA_STORE_STORE_CONSTS_H
 
+#include <iostream>
 #include <string>
 #include <zorba/config.h>
 
@@ -89,6 +90,8 @@
   XS_LAST
 };
 
+std::ostream& operator<<( std::ostream&, SchemaTypeCode );
+
 
 class ZORBA_DLL_PUBLIC StoreConsts
 {

=== modified file 'src/api/CMakeLists.txt'
--- src/api/CMakeLists.txt	2012-10-08 12:09:36 +0000
+++ src/api/CMakeLists.txt	2012-12-05 04:32:21 +0000
@@ -57,6 +57,7 @@
     zorba_functions.cpp
     annotationimpl.cpp
     auditimpl.cpp
+    store_consts.cpp
     streambuf.cpp
     transcode_streambuf.cpp
     uuid.cpp

=== added file 'src/api/store_consts.cpp'
--- src/api/store_consts.cpp	1970-01-01 00:00:00 +0000
+++ src/api/store_consts.cpp	2012-12-05 04:32:21 +0000
@@ -0,0 +1,87 @@
+/*
+ * 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 <zorba/store_consts.h>
+
+namespace zorba {
+namespace store {
+
+///////////////////////////////////////////////////////////////////////////////
+
+std::ostream& operator<<( std::ostream &o, SchemaTypeCode c ) {
+  static char const *const s[] = {
+    "xs:anyAtomicType",       // 0
+    "xs:string",              // 1
+    "xs:normalizedString",    // 2
+    "xs:token",               // 3
+    "xs:language",            // 4
+    "xs:NMTOKEN",             // 5
+    "xs:Name",                // 6
+    "xs:NCName",              // 7
+    "xs:ID",                  // 8
+    "xs:IDREF",               // 9
+    "xs:ENTITY",              // 10
+    "xs:untypedAtomic",       // 11
+    "xs:dateTime",            // 12
+    "xs:date",                // 13
+    "xs:time",                // 14
+    "xs:duration",            // 15
+    "xs:dayTimeDuration",     // 16
+    "xs:yearMonthDuration",   // 17
+    "xs:float",               // 18
+    "xs:double",              // 19
+    "xs:decimal",             // 20
+    "xs:integer",             // 21
+    "xs:nonPositiveInteger",  // 22
+    "xs:negativeInteger",     // 23
+    "xs:long",                // 24
+    "xs:int",                 // 25
+    "xs:short",               // 26
+    "xs:byte",                // 27
+    "xs:nonNegativeInteger",  // 28
+    "xs:unsignedLong",        // 29
+    "xs:unsignedInt",         // 30
+    "xs:unsignedShort",       // 31
+    "xs:unsignedByte",        // 32
+    "xs:positiveInteger",     // 33
+    "xs:gYearMonth",          // 34
+    "xs:gYear",               // 35
+    "xs:gMonthDay",           // 36
+    "xs:gDay",                // 37
+    "xs:gMonth",              // 38
+    "xs:boolean",             // 39
+    "xs:base64Binary",        // 40
+    "xs:hexBinary",           // 41
+    "xs:anyURI",              // 42
+    "xs:QNAME",               // 43
+    "xs:NOTATION",            // 44
+    "js:null",                // 45
+  };
+
+  if ( c >= 0 && c < XS_LAST )
+    o << s[ c ];
+  else
+    o << "<illegal type code: " << (int)c << '>';
+
+  return o;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace store
+} // namespace zorba
+
+/* vim:set et sw=2 ts=2: */

=== modified file 'src/diagnostics/CMakeLists.txt'
--- src/diagnostics/CMakeLists.txt	2012-10-09 17:37:56 +0000
+++ src/diagnostics/CMakeLists.txt	2012-12-05 04:32:21 +0000
@@ -25,7 +25,6 @@
    xquery_stack_trace.cpp
    user_error.cpp
    user_exception.cpp 
-   dict_zed_keys.h
    )
 
 ZORBA_DIAGNOSTIC_GENERATOR(
@@ -33,24 +32,21 @@
     "input=${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_en.xml"
     "diagnostic_en.xml"
     ""
-    "${CMAKE_BINARY_DIR}/include/zorba/diagnostic_list.h"
-)
+    "${CMAKE_BINARY_DIR}/include/zorba/diagnostic_list.h")
 
 ZORBA_DIAGNOSTIC_GENERATOR(
     "${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_list_cpp.xq"
     "input=${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_en.xml"
     "diagnostic_en.xml"
     "${CMAKE_BINARY_DIR}/include/zorba/diagnostic_list.h"
-    "${CMAKE_BINARY_DIR}/src/diagnostics/diagnostic_list.cpp"
-)
+    "${CMAKE_BINARY_DIR}/src/diagnostics/diagnostic_list.cpp")
 
 ZORBA_DIAGNOSTIC_GENERATOR(
     "${CMAKE_SOURCE_DIR}/src/diagnostics/dict_XX_cpp.xq"
     "input=${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_en.xml"
     "diagnostic_en.xml"
     ""
-    "${CMAKE_BINARY_DIR}/src/diagnostics/dict_en.cpp"
-)
+    "${CMAKE_BINARY_DIR}/src/diagnostics/dict_en.cpp")
 
 ZORBA_DIAGNOSTIC_GENERATOR(
     "${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_list_xq.xq"
@@ -60,14 +56,6 @@
     "${CMAKE_BINARY_DIR}/modules/w3c/xqt-errors.xq"
 )
 
-ZORBA_DIAGNOSTIC_GENERATOR(
-    "${CMAKE_SOURCE_DIR}/src/diagnostics/dict_zed_keys_h.xq"
-    "input=${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_en.xml"
-    "diagnostic_en.xml"
-    ""
-    "${CMAKE_BINARY_DIR}/src/diagnostics/dict_zed_keys.h"
-)
-
 IF(ZORBA_WITH_JSON)
 ZORBA_DIAGNOSTIC_GENERATOR(
     "${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_list_xq.xq"
@@ -91,7 +79,8 @@
     "input=${CMAKE_SOURCE_DIR}/src/diagnostics/diagnostic_en.xml;ns:=zwarn"
     "diagnostic_en.xml"
     ""
-    "${CMAKE_BINARY_DIR}/modules/com/zorba-xquery/www/modules/warnings.xq")
+    "${CMAKE_BINARY_DIR}/modules/com/zorba-xquery/www/modules/warnings.xq"
+)
 
 SET(DIAG_MODULES
   ${CMAKE_BINARY_DIR}/modules/com/zorba-xquery/www/modules/warnings.xq

=== modified file 'src/diagnostics/dict.h'
--- src/diagnostics/dict.h	2012-10-09 17:37:56 +0000
+++ src/diagnostics/dict.h	2012-12-05 04:32:21 +0000
@@ -17,8 +17,6 @@
 #ifndef ZORBA_DIAGNOSTIC_DICT_H
 #define ZORBA_DIAGNOSTIC_DICT_H
 
-#include "diagnostics/dict_zed_keys.h"
-
 namespace zorba {
 namespace diagnostic {
 namespace dict {
@@ -42,7 +40,7 @@
  * \endcode
  * \hideinitializer
  */
-#define ZED(DICT_KEY) ZED_##DICT_KEY
+#define ZED(DICT_KEY) ZED_PREFIX #DICT_KEY
 
 /**
  * Looks up the given key in the language dictionary.

=== removed file 'src/diagnostics/dict_zed_keys_h.xq'
--- src/diagnostics/dict_zed_keys_h.xq	2012-09-18 02:14:50 +0000
+++ src/diagnostics/dict_zed_keys_h.xq	1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-(:
- : Copyright 2006-2009 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.
-:)
-
-import module namespace util = "http://www.zorba-xquery.com/diagnostic/util"; at "diagnostic_util.xq";
-
-declare function local:make-zed-defines( $doc ) as xs:string*
-{
-  for $entry in ( $doc//entry )
-  let $key := $entry/@key
-  return
-    if ( contains( $key, ' ' ) )
-    then ()
-    else
-      let $full_key := 
-        if ( $entry/parent::diagnostic )
-        then concat( $entry/parent::diagnostic/@code, "_", $key )
-        else $key
-      return concat( "#define ZED_", $full_key, ' "~', $full_key, '"' )
-};
-
-declare variable $input external;
-
-string-join(
-  ( util:copyright(), 
-    '#ifndef ZORBA_DIAGNOSTICS_ZED_KEYS',
-    '#define ZORBA_DIAGNOSTICS_ZED_KEYS',
-    '',
-    local:make-zed-defines( $input ),
-    '',
-    '#endif /* ZORBA_DIAGNOSTICS_ZED_KEYS */',
-    '/*',
-    ' * Local variables:',
-    ' * mode: c++',
-    ' * End:',
-    ' */',
-    '/* vim:set et sw=2 ts=2: */'
-  ),
-  $util:newline
-),
-$util:newline
-
-(: vim:set syntax=xquery et sw=2 ts=2: :)

=== modified file 'src/runtime/numerics/numerics_impl.cpp'
--- src/runtime/numerics/numerics_impl.cpp	2012-10-09 17:37:56 +0000
+++ src/runtime/numerics/numerics_impl.cpp	2012-12-05 04:32:21 +0000
@@ -883,7 +883,7 @@
     if (!isAllowedType(result->getType()))
     {
       RAISE_ERROR(err::XPTY0004, info.loc,
-      ERROR_PARAMS(ZED(XPTY0004_FormatNumber_2), result->getType()->getStringValue()));
+      ERROR_PARAMS(ZED(FormatNumber_2), result->getType()->getStringValue()));
     }
 
     consumeNext(pictureItem, theChildren[1].getp(), planState);

=== modified file 'src/unit_tests/test_unordered_map.cpp'
--- src/unit_tests/test_unordered_map.cpp	2012-06-26 01:08:10 +0000
+++ src/unit_tests/test_unordered_map.cpp	2012-12-05 04:32:21 +0000
@@ -194,8 +194,9 @@
 }
 
 static void test_rehash() {
-  unordered_map<int,int> m;
-  unordered_map<int,int>::size_type const initial_buckets = m.bucket_count();
+  typedef unordered_map<int,int> map_type;
+  map_type m;
+  map_type::size_type const initial_buckets = m.bucket_count();
 
   // Add elements until bucket_count() changes which implies a rehash was done.
   for ( int i = 0; m.bucket_count() == initial_buckets; ++i )
@@ -204,8 +205,7 @@
   ASSERT_TRUE( m.bucket_count() > initial_buckets );
 
   // Ensure all the elements are still there.
-  unordered_map<int,int>::size_type const size = m.size();
-  for ( int i = 0; i < size; ++i )
+  for ( int i = 0; (unsigned)i < m.size(); ++i )
     ASSERT_TRUE_AND_NO_EXCEPTION( m.at( i ) == i );
 }
 

=== modified file 'src/unit_tests/test_unordered_set.cpp'
--- src/unit_tests/test_unordered_set.cpp	2012-06-26 01:08:10 +0000
+++ src/unit_tests/test_unordered_set.cpp	2012-12-05 04:32:21 +0000
@@ -38,12 +38,6 @@
   return result;
 }
 
-static void print_exception( char const *expr, int line,
-                             std::exception const &e ) {
-  assert_true( expr, line, false );
-  cout << "+ exception: " << e.what() << endl;
-}
-
 #define ASSERT_TRUE( EXPR ) assert_true( #EXPR, __LINE__, !!(EXPR) )
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -168,10 +162,11 @@
 }
 
 static void test_rehash() {
-  unordered_set<int> set;
-  unordered_set<int>::const_iterator i;
+  typedef unordered_set<int> set_type;
+  set_type set;
+  set_type::const_iterator i;
 
-  unordered_set<int>::size_type const initial_buckets = set.bucket_count();
+  set_type::size_type const initial_buckets = set.bucket_count();
 
   // Add elements until bucket_count() changes which implies a rehash was done.
   for ( int n = 0; set.bucket_count() == initial_buckets; ++n )
@@ -180,11 +175,9 @@
   ASSERT_TRUE( set.bucket_count() > initial_buckets );
 
   // Ensure all the elements are still there.
-  unordered_set<int>::size_type const size = set.size();
-  for ( int n = 0; n < size; ++n ) {
+  for ( int n = 0; (unsigned)n < set.size(); ++n )
     if ( ASSERT_TRUE( (i = set.find( n )) != set.end() ) )
       ASSERT_TRUE( *i == n );
-  }
 }
 
 static void test_swap() {

=== modified file 'src/util/stl_util.h'
--- src/util/stl_util.h	2012-09-19 21:16:15 +0000
+++ src/util/stl_util.h	2012-12-05 04:32:21 +0000
@@ -353,7 +353,7 @@
 // warning-free.
 //
 // Note: the use of "!!" is to work around a compiler problem on Windows;
-// see: http://stackoverflow.com/questions/9285657/sfinae-differentiation-between-signed-and-unsigned
+// see http://stackoverflow.com/q/9285657
 //
 
 template<typename N1,typename N2> inline

=== modified file 'src/util/string_util.h'
--- src/util/string_util.h	2012-09-19 21:16:15 +0000
+++ src/util/string_util.h	2012-12-05 04:32:21 +0000
@@ -46,8 +46,8 @@
  * the resultant string to some function.  See the BUILD_STRING macro for usage.
  * Note that you can use either "<<" or "," to taste.
  *
- * See http://stackoverflow.com/questions/5666678/ as to why a class like this
- * is needed rather than just using an ostringstream directly.
+ * See http://stackoverflow.com/q/5666678 as to why a class like this is
+ * needed rather than just using an ostringstream directly.
  */
 class string_builder {
 public:

-- 
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

Reply via email to