[Groonga-commit] groonga/grnxx at 8d32cfc [master] Remove old modules.

Back to archive index

susumu.yata null+****@clear*****
Fri Jun 28 17:46:15 JST 2013


susumu.yata	2013-06-28 17:46:15 +0900 (Fri, 28 Jun 2013)

  New Revision: 8d32cfc86c1535703b0b9945eeda2677b3060890
  https://github.com/groonga/grnxx/commit/8d32cfc86c1535703b0b9945eeda2677b3060890

  Message:
    Remove old modules.

  Removed files:
    lib/grnxx/bytes.cpp
  Modified files:
    .gitignore
    configure.ac
    lib/grnxx/Makefile.am
    lib/grnxx/backtrace.cpp
    lib/grnxx/bytes.hpp
    lib/grnxx/charset.hpp
    lib/grnxx/charset/euc-jp.cpp
    lib/grnxx/charset/euc-jp.hpp
    lib/grnxx/charset/shift_jis.cpp
    lib/grnxx/charset/shift_jis.hpp
    lib/grnxx/charset/utf-8.cpp
    lib/grnxx/charset/utf-8.hpp
    lib/grnxx/exception.hpp
    lib/grnxx/lock.hpp
    lib/grnxx/logger.cpp
    lib/grnxx/logger.hpp
    lib/grnxx/map_cursor.cpp
    lib/grnxx/storage/chunk_index.hpp
    lib/grnxx/storage/file-posix.cpp
    lib/grnxx/storage/file-windows.cpp
    lib/grnxx/storage/storage_impl.cpp
    lib/grnxx/string_builder.cpp
    lib/grnxx/string_builder.hpp
    test/Makefile.am
    test/test_charset.cpp
    test/test_string_builder.cpp
    test/test_string_format.cpp
  Renamed files:
    obsolete/lib/grnxx/alpha/Makefile.am
      (from lib/grnxx/alpha/Makefile.am)
    obsolete/lib/grnxx/alpha/double_array.cpp
      (from lib/grnxx/alpha/double_array.cpp)
    obsolete/lib/grnxx/alpha/double_array.hpp
      (from lib/grnxx/alpha/double_array.hpp)
    obsolete/lib/grnxx/alpha/dummy.cpp
      (from lib/grnxx/alpha/dummy.cpp)
    obsolete/lib/grnxx/alpha/dummy.hpp
      (from lib/grnxx/alpha/dummy.hpp)
    obsolete/lib/grnxx/alpha/map.cpp
      (from lib/grnxx/alpha/map.cpp)
    obsolete/lib/grnxx/alpha/map.hpp
      (from lib/grnxx/alpha/map.hpp)
    obsolete/lib/grnxx/alpha/map/Makefile.am
      (from lib/grnxx/alpha/map/Makefile.am)
    obsolete/lib/grnxx/alpha/map/array.cpp
      (from lib/grnxx/alpha/map/array.cpp)
    obsolete/lib/grnxx/alpha/map/array.hpp
      (from lib/grnxx/alpha/map/array.hpp)
    obsolete/lib/grnxx/alpha/map/cursor.cpp
      (from lib/grnxx/alpha/map/cursor.cpp)
    obsolete/lib/grnxx/alpha/map/cursor.hpp
      (from lib/grnxx/alpha/map/cursor.hpp)
    obsolete/lib/grnxx/alpha/map/double_array-slice.cpp
      (from lib/grnxx/alpha/map/double_array-slice.cpp)
    obsolete/lib/grnxx/alpha/map/double_array.cpp
      (from lib/grnxx/alpha/map/double_array.cpp)
    obsolete/lib/grnxx/alpha/map/double_array.hpp
      (from lib/grnxx/alpha/map/double_array.hpp)
    obsolete/lib/grnxx/alpha/map/header.hpp
      (from lib/grnxx/alpha/map/header.hpp)
    obsolete/lib/grnxx/alpha/map/scan.cpp
      (from lib/grnxx/alpha/map/scan.cpp)
    obsolete/lib/grnxx/alpha/map/scan.hpp
      (from lib/grnxx/alpha/map/scan.hpp)
    obsolete/lib/grnxx/alpha/map_range.hpp
      (from lib/grnxx/alpha/map_range.hpp)
    obsolete/lib/grnxx/basic.hpp
      (from lib/grnxx/basic.hpp)
    obsolete/lib/grnxx/db/Makefile.am
      (from lib/grnxx/db/Makefile.am)
    obsolete/lib/grnxx/db/blob_vector.cpp
      (from lib/grnxx/db/blob_vector.cpp)
    obsolete/lib/grnxx/db/blob_vector.hpp
      (from lib/grnxx/db/blob_vector.hpp)
    obsolete/lib/grnxx/db/vector.cpp
      (from lib/grnxx/db/vector.cpp)
    obsolete/lib/grnxx/db/vector.hpp
      (from lib/grnxx/db/vector.hpp)
    obsolete/lib/grnxx/io/Makefile.am
      (from lib/grnxx/io/Makefile.am)
    obsolete/lib/grnxx/io/block.cpp
      (from lib/grnxx/io/block.cpp)
    obsolete/lib/grnxx/io/block.hpp
      (from lib/grnxx/io/block.hpp)
    obsolete/lib/grnxx/io/chunk.cpp
      (from lib/grnxx/io/chunk.cpp)
    obsolete/lib/grnxx/io/chunk.hpp
      (from lib/grnxx/io/chunk.hpp)
    obsolete/lib/grnxx/io/file-posix.cpp
      (from lib/grnxx/io/file-posix.cpp)
    obsolete/lib/grnxx/io/file-posix.hpp
      (from lib/grnxx/io/file-posix.hpp)
    obsolete/lib/grnxx/io/file-windows.cpp
      (from lib/grnxx/io/file-windows.cpp)
    obsolete/lib/grnxx/io/file-windows.hpp
      (from lib/grnxx/io/file-windows.hpp)
    obsolete/lib/grnxx/io/file.cpp
      (from lib/grnxx/io/file.cpp)
    obsolete/lib/grnxx/io/file.hpp
      (from lib/grnxx/io/file.hpp)
    obsolete/lib/grnxx/io/file_info.cpp
      (from lib/grnxx/io/file_info.cpp)
    obsolete/lib/grnxx/io/file_info.hpp
      (from lib/grnxx/io/file_info.hpp)
    obsolete/lib/grnxx/io/path.cpp
      (from lib/grnxx/io/path.cpp)
    obsolete/lib/grnxx/io/path.hpp
      (from lib/grnxx/io/path.hpp)
    obsolete/lib/grnxx/io/pool-impl.cpp
      (from lib/grnxx/io/pool-impl.cpp)
    obsolete/lib/grnxx/io/pool-impl.hpp
      (from lib/grnxx/io/pool-impl.hpp)
    obsolete/lib/grnxx/io/pool.cpp
      (from lib/grnxx/io/pool.cpp)
    obsolete/lib/grnxx/io/pool.hpp
      (from lib/grnxx/io/pool.hpp)
    obsolete/lib/grnxx/io/view-posix.cpp
      (from lib/grnxx/io/view-posix.cpp)
    obsolete/lib/grnxx/io/view-posix.hpp
      (from lib/grnxx/io/view-posix.hpp)
    obsolete/lib/grnxx/io/view-windows.cpp
      (from lib/grnxx/io/view-windows.cpp)
    obsolete/lib/grnxx/io/view-windows.hpp
      (from lib/grnxx/io/view-windows.hpp)
    obsolete/lib/grnxx/io/view.cpp
      (from lib/grnxx/io/view.cpp)
    obsolete/lib/grnxx/io/view.hpp
      (from lib/grnxx/io/view.hpp)
    obsolete/lib/grnxx/recycler.cpp
      (from lib/grnxx/recycler.cpp)
    obsolete/lib/grnxx/recycler.hpp
      (from lib/grnxx/recycler.hpp)
    obsolete/lib/grnxx/slice.cpp
      (from lib/grnxx/slice.cpp)
    obsolete/lib/grnxx/slice.hpp
      (from lib/grnxx/slice.hpp)
    obsolete/lib/grnxx/string.cpp
      (from lib/grnxx/string.cpp)
    obsolete/lib/grnxx/string.hpp
      (from lib/grnxx/string.hpp)
    obsolete/test/test_alpha_double_array.cpp
      (from test/test_alpha_double_array.cpp)
    obsolete/test/test_alpha_map.cpp
      (from test/test_alpha_map.cpp)
    obsolete/test/test_io.cpp
      (from test/test_io.cpp)
    obsolete/test/test_recycler.cpp
      (from test/test_recycler.cpp)
    obsolete/test/test_slice.cpp
      (from test/test_slice.cpp)
    obsolete/test/test_string.cpp
      (from test/test_string.cpp)

  Modified: .gitignore (+0 -8)
===================================================================
--- .gitignore    2013-06-27 16:28:19 +0900 (2b0f2f4)
+++ .gitignore    2013-06-28 17:46:15 +0900 (71336bc)
@@ -27,14 +27,10 @@ missing
 src/grnxx
 stamp-h1
 temp/
-test/test_alpha_double_array
-test/test_alpha_map
 test/test_array
 test/test_backtrace
 test/test_bytes
 test/test_charset
-test/test_db_blob_vector
-test/test_db_vector
 test/test_duration
 test/test_error
 test/test_exception
@@ -42,15 +38,11 @@ test/test_features
 test/test_geo_point
 test/test_grnxx
 test/test_intrinsic
-test/test_io
 test/test_logger
 test/test_map
 test/test_mutex
 test/test_os
-test/test_recycler
-test/test_slice
 test/test_storage
-test/test_string
 test/test_string_builder
 test/test_string_format
 test/test_thread

  Modified: configure.ac (+0 -4)
===================================================================
--- configure.ac    2013-06-27 16:28:19 +0900 (58cfc35)
+++ configure.ac    2013-06-28 17:46:15 +0900 (f9b1433)
@@ -60,11 +60,7 @@ AC_CHECK_LIB([pthread], [pthread_create],
 AC_CONFIG_FILES([Makefile
                  lib/Makefile
                  lib/grnxx/Makefile
-                 lib/grnxx/alpha/Makefile
-                 lib/grnxx/alpha/map/Makefile
                  lib/grnxx/charset/Makefile
-                 lib/grnxx/db/Makefile
-                 lib/grnxx/io/Makefile
                  lib/grnxx/map/Makefile
                  lib/grnxx/map/array_map/Makefile
                  lib/grnxx/map/double_array/Makefile

  Modified: lib/grnxx/Makefile.am (+0 -14)
===================================================================
--- lib/grnxx/Makefile.am    2013-06-27 16:28:19 +0900 (724b88e)
+++ lib/grnxx/Makefile.am    2013-06-28 17:46:15 +0900 (ca8cf7c)
@@ -1,18 +1,12 @@
 SUBDIRS =				\
-	alpha				\
 	charset				\
-	db				\
-	io				\
 	map				\
 	storage
 
 lib_LTLIBRARIES = libgrnxx.la
 
 libgrnxx_la_LIBADD =			\
-	alpha/libgrnxx_alpha.la		\
 	charset/libgrnxx_charset.la	\
-	db/libgrnxx_db.la		\
-	io/libgrnxx_io.la		\
 	map/libgrnxx_map.la		\
 	storage/libgrnxx_storage.la
 
@@ -23,7 +17,6 @@ libgrnxx_la_SOURCES =			\
 	array_impl.cpp			\
 	backtrace.cpp			\
 	broken_down_time.cpp		\
-	bytes.cpp			\
 	charset.cpp			\
 	duration.cpp			\
 	error.cpp			\
@@ -36,11 +29,8 @@ libgrnxx_la_SOURCES =			\
 	mutex.cpp			\
 	os.cpp				\
 	periodic_clock.cpp		\
-	recycler.cpp			\
-	slice.cpp			\
 	stopwatch.cpp			\
 	storage.cpp			\
-	string.cpp			\
 	string_builder.cpp		\
 	system_clock.cpp		\
 	thread.cpp			\
@@ -51,7 +41,6 @@ libgrnxx_include_HEADERS =		\
 	array.hpp			\
 	array_impl.hpp			\
 	backtrace.hpp			\
-	basic.hpp			\
 	broken_down_time.hpp		\
 	bytes.hpp			\
 	charset.hpp			\
@@ -72,11 +61,8 @@ libgrnxx_include_HEADERS =		\
 	mutex.hpp			\
 	os.hpp				\
 	periodic_clock.hpp		\
-	recycler.hpp			\
-	slice.hpp			\
 	stopwatch.hpp			\
 	storage.hpp			\
-	string.hpp			\
 	string_builder.hpp		\
 	string_format.hpp		\
 	system_clock.hpp		\

  Modified: lib/grnxx/backtrace.cpp (+1 -0)
===================================================================
--- lib/grnxx/backtrace.cpp    2013-06-27 16:28:19 +0900 (00d040a)
+++ lib/grnxx/backtrace.cpp    2013-06-28 17:46:15 +0900 (07fbaca)
@@ -35,6 +35,7 @@
 #endif  // HAVE_LIBBFD
 
 #include <cstdlib>
+#include <cstring>
 #include <sstream>
 
 #include "grnxx/lock.hpp"

  Deleted: lib/grnxx/bytes.cpp (+0 -30) 100644
===================================================================
--- lib/grnxx/bytes.cpp    2013-06-27 16:28:19 +0900 (69570a2)
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-  Copyright (C) 2013  Brazil, Inc.
-
-  This library is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Lesser General Public
-  License as published by the Free Software Foundation; either
-  version 2.1 of the License, or (at your option) any later version.
-
-  This library is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public
-  License along with this library; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-#include "grnxx/bytes.hpp"
-
-#include "grnxx/string_builder.hpp"
-
-namespace grnxx {
-
-StringBuilder &operator<<(StringBuilder &builder, const Bytes &bytes) {
-  // TODO: StringBuilder should support const uint_8 *.
-  return builder.append(reinterpret_cast<const char *>(bytes.ptr()),
-                        bytes.size());
-}
-
-}  // namespace

  Modified: lib/grnxx/bytes.hpp (+0 -4)
===================================================================
--- lib/grnxx/bytes.hpp    2013-06-27 16:28:19 +0900 (0704f9f)
+++ lib/grnxx/bytes.hpp    2013-06-28 17:46:15 +0900 (42b1999)
@@ -26,8 +26,6 @@
 
 namespace grnxx {
 
-class StringBuilder;
-
 // A reference to a sequence of bytes.
 class Bytes {
  public:
@@ -165,8 +163,6 @@ inline bool operator>=(const char *lhs, const Bytes &rhs) {
   return Bytes(lhs) >= rhs;
 }
 
-StringBuilder &operator<<(StringBuilder &builder, const Bytes &bytes);
-
 }  // namespace
 
 #endif  // GRNXX_BYTES_HPP

  Modified: lib/grnxx/charset.hpp (+0 -11)
===================================================================
--- lib/grnxx/charset.hpp    2013-06-27 16:28:19 +0900 (d16e4f2)
+++ lib/grnxx/charset.hpp    2013-06-28 17:46:15 +0900 (aa67228)
@@ -23,9 +23,6 @@
 #include "grnxx/bytes.hpp"
 #include "grnxx/types.hpp"
 
-// TODO: To be removed in future.
-#include "grnxx/slice.hpp"
-
 namespace grnxx {
 
 class StringBuilder;
@@ -58,14 +55,6 @@ class Charset {
   // Return the size of the first character of "bytes". This function may
   // return 0 if "bytes" is empty or an invalid sequence.
   virtual size_t get_char_size(const Bytes &bytes) const = 0;
-
-  // TODO: To be removed in future.
-  // Return the first character of "slice". This function may return an empty
-  // slice if "slice" is empty or an invalid sequence.
-  virtual Slice get_char(const Slice &slice) const = 0;
-  // Return the size of the first character of "slice". This function may
-  // return 0 if "slice" is empty or an invalid sequence.
-  virtual size_t get_char_size(const Slice &slice) const = 0;
 };
 
 }  // namespace grnxx

  Modified: lib/grnxx/charset/euc-jp.cpp (+0 -8)
===================================================================
--- lib/grnxx/charset/euc-jp.cpp    2013-06-27 16:28:19 +0900 (f4371a2)
+++ lib/grnxx/charset/euc-jp.cpp    2013-06-28 17:46:15 +0900 (ea4f287)
@@ -76,13 +76,5 @@ size_t EUC_JP::get_char_size(const Bytes &bytes) const {
   return 1;
 }
 
-Slice EUC_JP::get_char(const Slice &slice) const {
-  return slice.prefix(get_char_size(slice));
-}
-
-size_t EUC_JP::get_char_size(const Slice &slice) const {
-  return get_char_size(Bytes(slice.ptr(), slice.size()));
-}
-
 }  // namespace charset
 }  // namespace grnxx

  Modified: lib/grnxx/charset/euc-jp.hpp (+0 -7)
===================================================================
--- lib/grnxx/charset/euc-jp.hpp    2013-06-27 16:28:19 +0900 (8c8fb03)
+++ lib/grnxx/charset/euc-jp.hpp    2013-06-28 17:46:15 +0900 (a997cd6)
@@ -23,9 +23,6 @@
 #include "grnxx/bytes.hpp"
 #include "grnxx/charset.hpp"
 
-// TODO: To be removed in future.
-#include "grnxx/slice.hpp"
-
 namespace grnxx {
 namespace charset {
 
@@ -38,10 +35,6 @@ class EUC_JP : public Charset {
 
   Bytes get_char(const Bytes &bytes) const;
   size_t get_char_size(const Bytes &bytes) const;
-
-  // TODO: To be removed in future.
-  Slice get_char(const Slice &slice) const;
-  size_t get_char_size(const Slice &slice) const;
 };
 
 }  // namespace charset

  Modified: lib/grnxx/charset/shift_jis.cpp (+0 -8)
===================================================================
--- lib/grnxx/charset/shift_jis.cpp    2013-06-27 16:28:19 +0900 (bd7a3a0)
+++ lib/grnxx/charset/shift_jis.cpp    2013-06-28 17:46:15 +0900 (3e57265)
@@ -54,13 +54,5 @@ size_t Shift_JIS::get_char_size(const Bytes &bytes) const {
   return 1;
 }
 
-Slice Shift_JIS::get_char(const Slice &slice) const {
-  return slice.prefix(get_char_size(slice));
-}
-
-size_t Shift_JIS::get_char_size(const Slice &slice) const {
-  return get_char_size(Bytes(slice.ptr(), slice.size()));
-}
-
 }  // namespace charset
 }  // namespace grnxx

  Modified: lib/grnxx/charset/shift_jis.hpp (+0 -7)
===================================================================
--- lib/grnxx/charset/shift_jis.hpp    2013-06-27 16:28:19 +0900 (b3e2051)
+++ lib/grnxx/charset/shift_jis.hpp    2013-06-28 17:46:15 +0900 (910d6c3)
@@ -23,9 +23,6 @@
 #include "grnxx/bytes.hpp"
 #include "grnxx/charset.hpp"
 
-// TODO: To be removed in future.
-#include "grnxx/slice.hpp"
-
 namespace grnxx {
 namespace charset {
 
@@ -38,10 +35,6 @@ class Shift_JIS : public Charset {
 
   Bytes get_char(const Bytes &bytes) const;
   size_t get_char_size(const Bytes &bytes) const;
-
-  // TODO: To be removed in future.
-  Slice get_char(const Slice &slice) const;
-  size_t get_char_size(const Slice &slice) const;
 };
 
 }  // namespace charset

  Modified: lib/grnxx/charset/utf-8.cpp (+1 -8)
===================================================================
--- lib/grnxx/charset/utf-8.cpp    2013-06-27 16:28:19 +0900 (c6e0c13)
+++ lib/grnxx/charset/utf-8.cpp    2013-06-28 17:46:15 +0900 (a833f2e)
@@ -17,6 +17,7 @@
 */
 #include "grnxx/charset/utf-8.hpp"
 
+#include "grnxx/bytes.hpp"
 #include "grnxx/intrinsic.hpp"
 
 namespace grnxx {
@@ -79,13 +80,5 @@ size_t UTF_8::get_char_size(const Bytes &bytes) const {
   return 1;
 }
 
-Slice UTF_8::get_char(const Slice &slice) const {
-  return slice.prefix(get_char_size(slice));
-}
-
-size_t UTF_8::get_char_size(const Slice &slice) const {
-  return get_char_size(Bytes(slice.ptr(), slice.size()));
-}
-
 }  // namespace charset
 }  // namespace grnxx

  Modified: lib/grnxx/charset/utf-8.hpp (+0 -7)
===================================================================
--- lib/grnxx/charset/utf-8.hpp    2013-06-27 16:28:19 +0900 (27a1c21)
+++ lib/grnxx/charset/utf-8.hpp    2013-06-28 17:46:15 +0900 (481a161)
@@ -23,9 +23,6 @@
 #include "grnxx/bytes.hpp"
 #include "grnxx/charset.hpp"
 
-// TODO: To be removed in future.
-#include "grnxx/slice.hpp"
-
 namespace grnxx {
 namespace charset {
 
@@ -38,10 +35,6 @@ class UTF_8 : public Charset {
 
   Bytes get_char(const Bytes &bytes) const;
   size_t get_char_size(const Bytes &bytes) const;
-
-  // TODO: To be removed in future.
-  Slice get_char(const Slice &slice) const;
-  size_t get_char_size(const Slice &slice) const;
 };
 
 }  // namespace charset

  Modified: lib/grnxx/exception.hpp (+3 -1)
===================================================================
--- lib/grnxx/exception.hpp    2013-06-27 16:28:19 +0900 (214672c)
+++ lib/grnxx/exception.hpp    2013-06-28 17:46:15 +0900 (4f8d6a4)
@@ -18,7 +18,9 @@
 #ifndef GRNXX_EXCEPTION_HPP
 #define GRNXX_EXCEPTION_HPP
 
-#include "grnxx/basic.hpp"
+#include "grnxx/features.hpp"
+
+#include <exception>
 
 #define GRNXX_THROW() (throw ::grnxx::Exception())
 

  Modified: lib/grnxx/lock.hpp (+4 -2)
===================================================================
--- lib/grnxx/lock.hpp    2013-06-27 16:28:19 +0900 (1115d47)
+++ lib/grnxx/lock.hpp    2013-06-28 17:46:15 +0900 (9c36c5c)
@@ -18,7 +18,9 @@
 #ifndef GRNXX_LOCK_HPP
 #define GRNXX_LOCK_HPP
 
-#include "grnxx/basic.hpp"
+#include "grnxx/features.hpp"
+
+#include "grnxx/duration.hpp"
 #include "grnxx/mutex.hpp"
 
 namespace grnxx {
@@ -28,7 +30,7 @@ class Lock {
   Lock() = delete;
   explicit Lock(Mutex *mutex) : mutex_((mutex->lock(), mutex)) {}
   Lock(Mutex *mutex, Duration timeout)
-    : mutex_(mutex->lock(timeout) ? mutex : nullptr) {}
+      : mutex_(mutex->lock(timeout) ? mutex : nullptr) {}
   ~Lock() {
     if (mutex_) {
       mutex_->unlock();

  Modified: lib/grnxx/logger.cpp (+6 -3)
===================================================================
--- lib/grnxx/logger.cpp    2013-06-27 16:28:19 +0900 (0bc4e60)
+++ lib/grnxx/logger.cpp    2013-06-28 17:46:15 +0900 (85709f9)
@@ -20,6 +20,9 @@
 #include <ctime>
 #include <fstream>
 #include <iostream>
+#include <memory>
+#include <string>
+#include <vector>
 
 #include "grnxx/backtrace.hpp"
 #include "grnxx/lock.hpp"
@@ -69,7 +72,7 @@ class LoggerSingleton {
       return false;
     }
     try {
-      String path_dummy(path);
+      std::string path_dummy(path);
       std::unique_ptr<std::ofstream> file_dummy(
           new (std::nothrow) std::ofstream(path_dummy.c_str(),
               std::ios::out | std::ios::app | std::ios::binary));
@@ -88,12 +91,12 @@ class LoggerSingleton {
     Lock lock(&mutex_);
     if (instance_) {
       instance_->file_.reset();
-      instance_->path_ = String();
+      instance_->path_.clear();
     }
   }
 
  private:
-  String path_;
+  std::string path_;
   std::unique_ptr<std::ofstream> file_;
 
   // These variables may be used even after the instance termination.

  Modified: lib/grnxx/logger.hpp (+2 -0)
===================================================================
--- lib/grnxx/logger.hpp    2013-06-27 16:28:19 +0900 (cd77271)
+++ lib/grnxx/logger.hpp    2013-06-28 17:46:15 +0900 (d461357)
@@ -20,7 +20,9 @@
 
 #include "grnxx/features.hpp"
 
+#include "grnxx/flags_impl.hpp"
 #include "grnxx/string_builder.hpp"
+#include "grnxx/types.hpp"
 
 #define GRNXX_ERROR()   GRNXX_LOGGER(::grnxx::ERROR_LOGGER)
 #define GRNXX_WARNING() GRNXX_LOGGER(::grnxx::WARNING_LOGGER)

  Modified: lib/grnxx/map_cursor.cpp (+2 -0)
===================================================================
--- lib/grnxx/map_cursor.cpp    2013-06-27 16:28:19 +0900 (4e06734)
+++ lib/grnxx/map_cursor.cpp    2013-06-28 17:46:15 +0900 (2c29962)
@@ -17,6 +17,8 @@
 */
 #include "grnxx/map_cursor.hpp"
 
+#include <limits>
+
 #include "grnxx/bytes.hpp"
 #include "grnxx/geo_point.hpp"
 #include "grnxx/logger.hpp"

  Modified: lib/grnxx/storage/chunk_index.hpp (+3 -1)
===================================================================
--- lib/grnxx/storage/chunk_index.hpp    2013-06-27 16:28:19 +0900 (64e0f46)
+++ lib/grnxx/storage/chunk_index.hpp    2013-06-28 17:46:15 +0900 (744496d)
@@ -18,7 +18,9 @@
 #ifndef GRNXX_STORAGE_CHUNK_INDEX_HPP
 #define GRNXX_STORAGE_CHUNK_INDEX_HPP
 
-#include "grnxx/basic.hpp"
+#include "grnxx/features.hpp"
+
+#include "grnxx/types.hpp"
 
 namespace grnxx {
 namespace storage {

  Modified: lib/grnxx/storage/file-posix.cpp (+1 -0)
===================================================================
--- lib/grnxx/storage/file-posix.cpp    2013-06-27 16:28:19 +0900 (fa8cbbc)
+++ lib/grnxx/storage/file-posix.cpp    2013-06-28 17:46:15 +0900 (743bc85)
@@ -26,6 +26,7 @@
 #include <unistd.h>
 
 #include <cerrno>
+#include <limits>
 #include <new>
 
 #include "grnxx/error.hpp"

  Modified: lib/grnxx/storage/file-windows.cpp (+4 -1)
===================================================================
--- lib/grnxx/storage/file-windows.cpp    2013-06-27 16:28:19 +0900 (adf7cff)
+++ lib/grnxx/storage/file-windows.cpp    2013-06-28 17:46:15 +0900 (919b59a)
@@ -23,6 +23,9 @@
 #include <sys/stat.h>
 #include <io.h>
 
+#include <limits>
+#include <new>
+
 #include "grnxx/error.hpp"
 #include "grnxx/logger.hpp"
 #include "grnxx/storage/path.hpp"
@@ -191,7 +194,7 @@ bool FileImpl::unlock() {
 void FileImpl::sync() {
   if (!::FlushFileBuffers(handle_)) {
     GRNXX_ERROR() << "failed to sync file: path = " << path_.get()
-                  << ": '::FlushFileBuffers' " << Error(errno);
+                  << ": '::FlushFileBuffers' " << Error(::GetLastError());
     return false;
   }
   return true;

  Modified: lib/grnxx/storage/storage_impl.cpp (+2 -2)
===================================================================
--- lib/grnxx/storage/storage_impl.cpp    2013-06-27 16:28:19 +0900 (8a13b8d)
+++ lib/grnxx/storage/storage_impl.cpp    2013-06-28 17:46:15 +0900 (e3dcaf8)
@@ -21,10 +21,10 @@
 #include <cstring>
 #include <new>
 
+#include "grnxx/bytes.hpp"
 #include "grnxx/intrinsic.hpp"
 #include "grnxx/lock.hpp"
 #include "grnxx/logger.hpp"
-#include "grnxx/slice.hpp"
 #include "grnxx/storage/chunk.hpp"
 #include "grnxx/storage/chunk_index.hpp"
 #include "grnxx/storage/file.hpp"
@@ -1156,7 +1156,7 @@ char *StorageImpl::generate_path(uint16_t file_id) {
   // If "path_" ends with ".grn", the result also ends with ".grn".
   // In this case, "file_id" is inserted before the ".grn".
   // Otherwise, "file_id" is appended as a suffix.
-  const Slice prefix = path_.get();
+  const Bytes prefix = path_.get();
   const bool has_extension = prefix.ends_with(".grn");
   const size_t path_size = prefix.size() + 5;
   char * const path = new (std::nothrow) char[path_size];

  Modified: lib/grnxx/string_builder.cpp (+13 -0)
===================================================================
--- lib/grnxx/string_builder.cpp    2013-06-27 16:28:19 +0900 (61c5112)
+++ lib/grnxx/string_builder.cpp    2013-06-28 17:46:15 +0900 (11a79b6)
@@ -19,6 +19,8 @@
 
 #include <cmath>
 
+#include "grnxx/intrinsic.hpp"
+
 namespace grnxx {
 
 StringBuilder::StringBuilder(size_t size, StringBuilderFlags flags)
@@ -171,4 +173,15 @@ StringBuilder &operator<<(StringBuilder &builder, const void *value) {
   return builder.append(buf, sizeof(buf));
 }
 
+StringBuilder &operator<<(StringBuilder &builder, const Bytes &bytes) {
+  // TODO: StringBuilder should support const uint_8 *.
+  return builder.append(reinterpret_cast<const char *>(bytes.ptr()),
+                        bytes.size());
+}
+
+StringBuilder &operator<<(StringBuilder &builder,
+                          const std::exception &exception) {
+  return builder << "{ what = " << exception.what() << " }";
+}
+
 }  // namespace grnxx

  Modified: lib/grnxx/string_builder.hpp (+14 -14)
===================================================================
--- lib/grnxx/string_builder.hpp    2013-06-27 16:28:19 +0900 (6a385b3)
+++ lib/grnxx/string_builder.hpp    2013-06-28 17:46:15 +0900 (b158dfb)
@@ -18,9 +18,15 @@
 #ifndef GRNXX_STRING_BUILDER_HPP
 #define GRNXX_STRING_BUILDER_HPP
 
-#include "grnxx/basic.hpp"
+#include "grnxx/features.hpp"
+
+#include <cstring>
+#include <exception>
+#include <memory>
+
+#include "grnxx/bytes.hpp"
 #include "grnxx/flags_impl.hpp"
-#include "grnxx/string.hpp"
+#include "grnxx/types.hpp"
 
 namespace grnxx {
 
@@ -175,10 +181,6 @@ class StringBuilder {
     return *this;
   }
 
-  String str() const {
-    return String(begin_, length());
-  }
-
   const char &operator[](size_t i) const {
     return begin_[i];
   }
@@ -186,6 +188,9 @@ class StringBuilder {
     return begin_[i];
   }
 
+  Bytes bytes() const {
+    return Bytes(c_str(), length());
+  }
   const char *c_str() const {
     return begin_ ? begin_ : "";
   }
@@ -282,16 +287,11 @@ inline StringBuilder &operator<<(StringBuilder &builder, const char *value) {
   return builder.append(value, std::strlen(value));
 }
 
-// Strings.
-inline StringBuilder &operator<<(StringBuilder &builder, const String &value) {
-  return builder.append(value.c_str(), value.length());
-}
+StringBuilder &operator<<(StringBuilder &builder, const Bytes &bytes);
 
 // Exceptions.
-inline StringBuilder &operator<<(StringBuilder &builder,
-                                 const std::exception &exception) {
-  return builder << "{ what = " << exception.what() << " }";
-}
+StringBuilder &operator<<(StringBuilder &builder,
+                          const std::exception &exception);
 
 }  // namespace grnxx
 

  Renamed: obsolete/lib/grnxx/alpha/Makefile.am (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/double_array.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/double_array.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/dummy.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/dummy.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/Makefile.am (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/array.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/array.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/cursor.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/cursor.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/double_array-slice.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/double_array.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/double_array.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/header.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/scan.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map/scan.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/alpha/map_range.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/basic.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/db/Makefile.am (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/db/blob_vector.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/db/blob_vector.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/db/vector.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/db/vector.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/Makefile.am (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/block.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/block.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/chunk.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/chunk.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file-posix.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file-posix.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file-windows.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file-windows.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file_info.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/file_info.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/path.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/path.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/pool-impl.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/pool-impl.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/pool.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/pool.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/view-posix.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/view-posix.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/view-windows.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/view-windows.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/view.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/io/view.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/recycler.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/recycler.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/slice.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/slice.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/string.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/lib/grnxx/string.hpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/test/test_alpha_double_array.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/test/test_alpha_map.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/test/test_io.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/test/test_recycler.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/test/test_slice.cpp (+0 -0) 100%
===================================================================

  Renamed: obsolete/test/test_string.cpp (+0 -0) 100%
===================================================================

  Modified: test/Makefile.am (+0 -32)
===================================================================
--- test/Makefile.am    2013-06-27 16:28:19 +0900 (85ac15a)
+++ test/Makefile.am    2013-06-28 17:46:15 +0900 (82d779a)
@@ -1,14 +1,10 @@
 AM_CXXFLAGS = @AM_CXXFLAGS@
 
 TESTS =					\
-	test_alpha_double_array		\
-	test_alpha_map			\
 	test_array			\
 	test_backtrace			\
 	test_bytes			\
 	test_charset			\
-	test_db_blob_vector		\
-	test_db_vector			\
 	test_duration			\
 	test_error			\
 	test_exception			\
@@ -16,15 +12,11 @@ TESTS =					\
 	test_geo_point			\
 	test_grnxx			\
 	test_intrinsic			\
-	test_io				\
 	test_logger			\
 	test_map			\
 	test_mutex			\
 	test_os				\
-	test_recycler			\
-	test_slice			\
 	test_storage			\
-	test_string			\
 	test_string_builder		\
 	test_string_format		\
 	test_thread			\
@@ -34,12 +26,6 @@ TESTS =					\
 
 check_PROGRAMS = $(TESTS)
 
-test_alpha_double_array_SOURCES = test_alpha_double_array.cpp
-test_alpha_double_array_LDADD = ../lib/grnxx/libgrnxx.la
-
-test_alpha_map_SOURCES = test_alpha_map.cpp
-test_alpha_map_LDADD = ../lib/grnxx/libgrnxx.la
-
 test_array_SOURCES = test_array.cpp
 test_array_LDADD = ../lib/grnxx/libgrnxx.la
 
@@ -52,12 +38,6 @@ test_bytes_LDADD = ../lib/grnxx/libgrnxx.la
 test_charset_SOURCES = test_charset.cpp
 test_charset_LDADD = ../lib/grnxx/libgrnxx.la
 
-test_db_blob_vector_SOURCES = test_db_blob_vector.cpp
-test_db_blob_vector_LDADD = ../lib/grnxx/libgrnxx.la
-
-test_db_vector_SOURCES = test_db_vector.cpp
-test_db_vector_LDADD = ../lib/grnxx/libgrnxx.la
-
 test_duration_SOURCES = test_duration.cpp
 test_duration_LDADD = ../lib/grnxx/libgrnxx.la
 
@@ -79,9 +59,6 @@ test_grnxx_LDADD = ../lib/grnxx/libgrnxx.la
 test_intrinsic_SOURCES = test_intrinsic.cpp
 test_intrinsic_LDADD = ../lib/grnxx/libgrnxx.la
 
-test_io_SOURCES = test_io.cpp
-test_io_LDADD = ../lib/grnxx/libgrnxx.la
-
 test_logger_SOURCES = test_logger.cpp
 test_logger_LDADD = ../lib/grnxx/libgrnxx.la
 
@@ -94,18 +71,9 @@ test_mutex_LDADD = ../lib/grnxx/libgrnxx.la
 test_os_SOURCES = test_os.cpp
 test_os_LDADD = ../lib/grnxx/libgrnxx.la
 
-test_recycler_SOURCES = test_recycler.cpp
-test_recycler_LDADD = ../lib/grnxx/libgrnxx.la
-
-test_slice_SOURCES = test_slice.cpp
-test_slice_LDADD = ../lib/grnxx/libgrnxx.la
-
 test_storage_SOURCES = test_storage.cpp
 test_storage_LDADD = ../lib/grnxx/libgrnxx.la
 
-test_string_SOURCES = test_string.cpp
-test_string_LDADD = ../lib/grnxx/libgrnxx.la
-
 test_string_builder_SOURCES = test_string_builder.cpp
 test_string_builder_LDADD = ../lib/grnxx/libgrnxx.la
 

  Modified: test/test_charset.cpp (+22 -21)
===================================================================
--- test/test_charset.cpp    2013-06-27 16:28:19 +0900 (00d785d)
+++ test/test_charset.cpp    2013-06-28 17:46:15 +0900 (19e13f4)
@@ -17,71 +17,72 @@
 */
 #include <cassert>
 
-#include "grnxx/logger.hpp"
+#include "grnxx/bytes.hpp"
 #include "grnxx/charset.hpp"
+#include "grnxx/logger.hpp"
 
 void test_ascii() {
-  const grnxx::Slice query = "Hello, world!";
+  const grnxx::Bytes query = "Hello, world!";
 
   const grnxx::Charset *charset = grnxx::Charset::get(grnxx::CHARSET_EUC_JP);
-  grnxx::Slice query_left = query;
+  grnxx::Bytes query_left = query;
   while (query_left) {
-    const grnxx::Slice next = charset->get_char(query);
+    const grnxx::Bytes next = charset->get_char(query);
     assert(next.size() == 1);
-    query_left.remove_prefix(next.size());
+    query_left = query_left.except_prefix(next.size());
   }
 
   charset = grnxx::Charset::get(grnxx::CHARSET_SHIFT_JIS);
   query_left = query;
   while (query_left) {
-    const grnxx::Slice next = charset->get_char(query);
+    const grnxx::Bytes next = charset->get_char(query);
     assert(next.size() == 1);
-    query_left.remove_prefix(next.size());
+    query_left = query_left.except_prefix(next.size());
   }
 
   charset = grnxx::Charset::get(grnxx::CHARSET_UTF_8);
   query_left = query;
   while (query_left) {
-    const grnxx::Slice next = charset->get_char(query);
+    const grnxx::Bytes next = charset->get_char(query);
     assert(next.size() == 1);
-    query_left.remove_prefix(next.size());
+    query_left = query_left.except_prefix(next.size());
   }
 }
 
 void test_euc_jp() {
-  const grnxx::Slice query = "\xCA\xB8\xBB\xFA\xCE\xF3";
+  const grnxx::Bytes query = "\xCA\xB8\xBB\xFA\xCE\xF3";
 
   const grnxx::Charset *charset = grnxx::Charset::get(grnxx::CHARSET_EUC_JP);
-  grnxx::Slice query_left = query;
+  grnxx::Bytes query_left = query;
   while (query_left) {
-    const grnxx::Slice next = charset->get_char(query);
+    const grnxx::Bytes next = charset->get_char(query);
     assert(next.size() == 2);
-    query_left.remove_prefix(next.size());
+    query_left = query_left.except_prefix(next.size());
   }
 }
 
 void test_shift_jis() {
-  const grnxx::Slice query = "\x95\xB6\x8E\x9A\x97\xF1";
+  const grnxx::Bytes query = "\x95\xB6\x8E\x9A\x97\xF1";
 
   const grnxx::Charset *charset =
       grnxx::Charset::get(grnxx::CHARSET_SHIFT_JIS);
-  grnxx::Slice query_left = query;
+  grnxx::Bytes query_left = query;
   while (query_left) {
-    const grnxx::Slice next = charset->get_char(query);
+    const grnxx::Bytes next = charset->get_char(query);
     assert(next.size() == 2);
-    query_left.remove_prefix(next.size());
+    query_left = query_left.except_prefix(next.size());
   }
 }
 
 void test_utf_8() {
-  const grnxx::Slice query = "\xE6\x96\x87\xE5\xAD\x97\xE5\x88\x97";
+  const grnxx::Bytes query = "\xE6\x96\x87\xE5\xAD\x97\xE5\x88\x97";
 
   const grnxx::Charset *charset = grnxx::Charset::get(grnxx::CHARSET_UTF_8);
-  grnxx::Slice query_left = query;
+  grnxx::Bytes query_left = query;
   while (query_left) {
-    const grnxx::Slice next = charset->get_char(query);
+    const grnxx::Bytes next = charset->get_char(query);
     assert(next.size() == 3);
-    query_left.remove_prefix(next.size());
+    query_left = query_left.except_prefix(next.size());
   }
 }
 

  Modified: test/test_string_builder.cpp (+26 -26)
===================================================================
--- test/test_string_builder.cpp    2013-06-27 16:28:19 +0900 (b52741a)
+++ test/test_string_builder.cpp    2013-06-28 17:46:15 +0900 (5e080be)
@@ -25,27 +25,27 @@ void test_basic_operations() {
   grnxx::StringBuilder builder;
 
   assert(builder);
-  assert(builder.str() == "");
+  assert(builder.bytes() == "");
 
   assert(!builder.append('X'));
-  assert(builder.str() == "");
+  assert(builder.bytes() == "");
 
   char buf[4];
   builder = grnxx::StringBuilder(buf);
 
   assert(builder);
-  assert(builder.str() == "");
+  assert(builder.bytes() == "");
 
   assert(builder.append('0'));
   assert(builder.append('1'));
   assert(builder.append('2'));
   assert(!builder.append('3'));
-  assert(builder.str() == "012");
+  assert(builder.bytes() == "012");
 
   builder = grnxx::StringBuilder(buf, 3);
 
   assert(!builder.append("0123", 4));
-  assert(builder.str() == "01");
+  assert(builder.bytes() == "01");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
@@ -53,21 +53,21 @@ void test_basic_operations() {
   assert(builder.append('Y', 2));
   assert(builder.append('Z', 1));
   assert(builder.append('-', 0));
-  assert(builder.str() == "XXXYYZ");
+  assert(builder.bytes() == "XXXYYZ");
 
-  assert(builder.resize(4).str() == "XXXY");
+  assert(builder.resize(4).bytes() == "XXXY");
   assert(builder.resize(1000).length() == 1000);
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   assert(builder);
-  assert(builder.str() == "");
+  assert(builder.bytes() == "");
 
   const size_t STRING_LENGTH = 1 << 20;
   for (size_t i = 0; i < STRING_LENGTH; ++i) {
     assert(builder.append('X'));
   }
-  assert(builder.str().length() == STRING_LENGTH);
+  assert(builder.bytes().size() == STRING_LENGTH);
 }
 
 void test_char() {
@@ -77,19 +77,19 @@ void test_char() {
   builder << '1';
   builder << '2';
   builder << '3';
-  assert(builder.str() == "0123");
+  assert(builder.bytes() == "0123");
 }
 
 void test_integer() {
   grnxx::StringBuilder builder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << 0;
-  assert(builder.str() == "0");
+  assert(builder.bytes() == "0");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << 0U;
-  assert(builder.str() == "0");
+  assert(builder.bytes() == "0");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
@@ -97,7 +97,7 @@ void test_integer() {
           << std::numeric_limits<std::int8_t>::max() << ','
           << std::numeric_limits<std::uint8_t>::min() << '/'
           << std::numeric_limits<std::uint8_t>::max();
-  assert(builder.str() == "-128/127,0/255");
+  assert(builder.bytes() == "-128/127,0/255");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
@@ -105,7 +105,7 @@ void test_integer() {
           << std::numeric_limits<std::int16_t>::max() << ','
           << std::numeric_limits<std::uint16_t>::min() << '/'
           << std::numeric_limits<std::uint16_t>::max();
-  assert(builder.str() == "-32768/32767,0/65535");
+  assert(builder.bytes() == "-32768/32767,0/65535");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
@@ -113,7 +113,7 @@ void test_integer() {
           << std::numeric_limits<std::int32_t>::max() << ','
           << std::numeric_limits<std::uint32_t>::min() << '/'
           << std::numeric_limits<std::uint32_t>::max();
-  assert(builder.str() == "-2147483648/2147483647,0/4294967295");
+  assert(builder.bytes() == "-2147483648/2147483647,0/4294967295");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
@@ -121,7 +121,7 @@ void test_integer() {
           << std::numeric_limits<std::int64_t>::max() << ','
           << std::numeric_limits<std::uint64_t>::min() << '/'
           << std::numeric_limits<std::uint64_t>::max();
-  assert(builder.str() ==
+  assert(builder.bytes() ==
          "-9223372036854775808/9223372036854775807,0/18446744073709551615");
 }
 
@@ -129,29 +129,29 @@ void test_floating_point_number() {
   grnxx::StringBuilder builder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << 0.0;
-  assert(builder.str() == "0.000000");
+  assert(builder.bytes() == "0.000000");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << 16.5;
-  assert(builder.str() == "16.500000");
+  assert(builder.bytes() == "16.500000");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << 2.75F;
-  assert(builder.str() == "2.750000");
+  assert(builder.bytes() == "2.750000");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << (1.0 / 0.0) << '/' << (-1.0 / 0.0) << '/' << (0.0 / 0.0);
-  assert(builder.str() == "inf/-inf/nan");
+  assert(builder.bytes() == "inf/-inf/nan");
 }
 
 void test_bool() {
   grnxx::StringBuilder builder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << true << '/' << false;
-  assert(builder.str() == "true/false");
+  assert(builder.bytes() == "true/false");
 }
 
 void test_void_pointer() {
@@ -159,27 +159,27 @@ void test_void_pointer() {
 
   builder << reinterpret_cast<void *>(0x13579BDF);
   if (sizeof(void *) == 4) {
-    assert(builder.str() == "0x13579BDF");
+    assert(builder.bytes() == "0x13579BDF");
   } else {
-    assert(builder.str() == "0x0000000013579BDF");
+    assert(builder.bytes() == "0x0000000013579BDF");
   }
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << static_cast<void *>(nullptr);
-  assert(builder.str() == "nullptr");
+  assert(builder.bytes() == "nullptr");
 }
 
 void test_zero_terminated_string() {
   grnxx::StringBuilder builder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << "Hello, " << "world!";
-  assert(builder.str() == "Hello, world!");
+  assert(builder.bytes() == "Hello, world!");
 
   builder = grnxx::StringBuilder(grnxx::STRING_BUILDER_AUTO_RESIZE);
 
   builder << static_cast<char *>(nullptr);
-  assert(builder.str() == "nullptr");
+  assert(builder.bytes() == "nullptr");
 }
 
 int main() {

  Modified: test/test_string_format.cpp (+12 -12)
===================================================================
--- test/test_string_format.cpp    2013-06-27 16:28:19 +0900 (a1af38e)
+++ test/test_string_format.cpp    2013-06-28 17:46:15 +0900 (09f40a8)
@@ -32,19 +32,19 @@ void test_align() {
 
   assert(builder << grnxx::StringFormat::align(
          "ABC", 6, '-', grnxx::STRING_FORMAT_ALIGNMENT_LEFT));
-  assert(builder.str() == "ABC---");
+  assert(builder.bytes() == "ABC---");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align(
          "ABC", 6, '-', grnxx::STRING_FORMAT_ALIGNMENT_RIGHT));
-  assert(builder.str() == "---ABC");
+  assert(builder.bytes() == "---ABC");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align(
          "ABC", 6, '-', grnxx::STRING_FORMAT_ALIGNMENT_CENTER));
-  assert(builder.str() == "-ABC--");
+  assert(builder.bytes() == "-ABC--");
 }
 
 void test_align_left() {
@@ -54,17 +54,17 @@ void test_align_left() {
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align_left(123, 5));
-  assert(builder.str() == "123  ");
+  assert(builder.bytes() == "123  ");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align_left(234, 5, 'X'));
-  assert(builder.str() == "234XX");
+  assert(builder.bytes() == "234XX");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(!(builder << grnxx::StringFormat::align_left(345, 10, 'x')));
-  assert(builder.str() == "345xxxx");
+  assert(builder.bytes() == "345xxxx");
 }
 
 void test_align_right() {
@@ -74,17 +74,17 @@ void test_align_right() {
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align_right(456, 5));
-  assert(builder.str() == "  456");
+  assert(builder.bytes() == "  456");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align_right(567, 5, 'X'));
-  assert(builder.str() == "XX567");
+  assert(builder.bytes() == "XX567");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(!(builder << grnxx::StringFormat::align_right(678, 8, 'x')));
-  assert(builder.str() == "xxxxx67");
+  assert(builder.bytes() == "xxxxx67");
 }
 
 void test_align_center() {
@@ -94,17 +94,17 @@ void test_align_center() {
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align_center(789, 5));
-  assert(builder.str() == " 789 ");
+  assert(builder.bytes() == " 789 ");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(builder << grnxx::StringFormat::align_center(890, 5, 'X'));
-  assert(builder.str() == "X890X");
+  assert(builder.bytes() == "X890X");
 
   builder = grnxx::StringBuilder(buf);
 
   assert(!(builder << grnxx::StringFormat::align_center(901, 8, 'x')));
-  assert(builder.str() == "xx901xx");
+  assert(builder.bytes() == "xx901xx");
 }
 
 void benchmark() {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index