[Groonga-commit] groonga/grnxx at b31a11c [master] Rename Index::create_cursor() to Index::find_in_range(). (#52)

Back to archive index

susumu.yata null+****@clear*****
Tue Sep 16 19:43:41 JST 2014


susumu.yata	2014-09-16 19:43:41 +0900 (Tue, 16 Sep 2014)

  New Revision: b31a11c08ffdb3e9e7528c9afee32b17e484470f
  https://github.com/groonga/grnxx/commit/b31a11c08ffdb3e9e7528c9afee32b17e484470f

  Message:
    Rename Index::create_cursor() to Index::find_in_range(). (#52)

  Modified files:
    include/grnxx/index.hpp
    lib/grnxx/index.cpp
    lib/grnxx/tree_index.hpp
    test/test_index.cpp

  Modified: include/grnxx/index.hpp (+1 -1)
===================================================================
--- include/grnxx/index.hpp    2014-09-16 19:42:19 +0900 (0ee3cd5)
+++ include/grnxx/index.hpp    2014-09-16 19:43:41 +0900 (b34ea42)
@@ -97,7 +97,7 @@ class Index {
   // Returns a pointer to the cursor on success.
   // On failure, returns nullptr and stores error information into "*error" if
   // "error" != nullptr.
-  virtual unique_ptr<Cursor> create_cursor(
+  virtual unique_ptr<Cursor> find_in_range(
       Error *error,
       const IndexRange &range = IndexRange(),
       const CursorOptions &options = CursorOptions()) const;

  Modified: lib/grnxx/index.cpp (+5 -5)
===================================================================
--- lib/grnxx/index.cpp    2014-09-16 19:42:19 +0900 (e512049)
+++ lib/grnxx/index.cpp    2014-09-16 19:43:41 +0900 (529ae98)
@@ -20,7 +20,7 @@ unique_ptr<Cursor> Index::find(
   return nullptr;
 }
 
-unique_ptr<Cursor> Index::create_cursor(
+unique_ptr<Cursor> Index::find_in_range(
     Error *error,
     const IndexRange &,
     const CursorOptions &) const {
@@ -417,7 +417,7 @@ unique_ptr<Cursor> TreeIndex<Bool>::find(
   }
 }
 
-unique_ptr<Cursor> TreeIndex<Bool>::create_cursor(
+unique_ptr<Cursor> TreeIndex<Bool>::find_in_range(
     Error *error,
     const IndexRange &range,
     const CursorOptions &options) const {
@@ -578,7 +578,7 @@ unique_ptr<Cursor> TreeIndex<Int>::find(
   }
 }
 
-unique_ptr<Cursor> TreeIndex<Int>::create_cursor(
+unique_ptr<Cursor> TreeIndex<Int>::find_in_range(
     Error *error,
     const IndexRange &range,
     const CursorOptions &options) const {
@@ -738,7 +738,7 @@ unique_ptr<Cursor> TreeIndex<Float>::find(
   }
 }
 
-unique_ptr<Cursor> TreeIndex<Float>::create_cursor(
+unique_ptr<Cursor> TreeIndex<Float>::find_in_range(
     Error *error,
     const IndexRange &range,
     const CursorOptions &options) const {
@@ -912,7 +912,7 @@ unique_ptr<Cursor> TreeIndex<Text>::find(
   }
 }
 
-unique_ptr<Cursor> TreeIndex<Text>::create_cursor(
+unique_ptr<Cursor> TreeIndex<Text>::find_in_range(
     Error *error,
     const IndexRange &range,
     const CursorOptions &options) const {

  Modified: lib/grnxx/tree_index.hpp (+4 -4)
===================================================================
--- lib/grnxx/tree_index.hpp    2014-09-16 19:42:19 +0900 (ff21e2b)
+++ lib/grnxx/tree_index.hpp    2014-09-16 19:43:41 +0900 (34c8166)
@@ -32,7 +32,7 @@ class TreeIndex<Bool> : public Index {
       const Datum &datum,
       const CursorOptions &options = CursorOptions()) const;
 
-  unique_ptr<Cursor> create_cursor(
+  unique_ptr<Cursor> find_in_range(
       Error *error,
       const IndexRange &range,
       const CursorOptions &options) const;
@@ -66,7 +66,7 @@ class TreeIndex<Int> : public Index {
       const Datum &datum,
       const CursorOptions &options = CursorOptions()) const;
 
-  unique_ptr<Cursor> create_cursor(
+  unique_ptr<Cursor> find_in_range(
       Error *error,
       const IndexRange &range,
       const CursorOptions &options) const;
@@ -112,7 +112,7 @@ class TreeIndex<Float> : public Index {
       const Datum &datum,
       const CursorOptions &options = CursorOptions()) const;
 
-  unique_ptr<Cursor> create_cursor(
+  unique_ptr<Cursor> find_in_range(
       Error *error,
       const IndexRange &range,
       const CursorOptions &options) const;
@@ -146,7 +146,7 @@ class TreeIndex<Text> : public Index {
       const Datum &datum,
       const CursorOptions &options = CursorOptions()) const;
 
-  unique_ptr<Cursor> create_cursor(
+  unique_ptr<Cursor> find_in_range(
       Error *error,
       const IndexRange &range,
       const CursorOptions &options) const;

  Modified: test/test_index.cpp (+10 -10)
===================================================================
--- test/test_index.cpp    2014-09-16 19:42:19 +0900 (1501ef3)
+++ test/test_index.cpp    2014-09-16 19:43:41 +0900 (01d0088)
@@ -94,7 +94,7 @@ void test_set_and_index() {
   assert(index);
 
   // Create a cursor.
-  auto cursor = index->create_cursor(&error);
+  auto cursor = index->find_in_range(&error);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -143,7 +143,7 @@ void test_index_and_set() {
   }
 
   // Create a cursor.
-  auto cursor = index->create_cursor(&error);
+  auto cursor = index->find_in_range(&error);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -198,7 +198,7 @@ void test_remove() {
   }
 
   // Create a cursor.
-  auto cursor = index->create_cursor(&error);
+  auto cursor = index->find_in_range(&error);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -497,7 +497,7 @@ void test_int_range() {
   grnxx::IndexRange range;
   range.set_lower_bound(grnxx::Int(10), grnxx::INCLUSIVE_END_POINT);
   range.set_upper_bound(grnxx::Int(90), grnxx::EXCLUSIVE_END_POINT);
-  auto cursor = index->create_cursor(&error, range);
+  auto cursor = index->find_in_range(&error, range);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -557,7 +557,7 @@ void test_float_range() {
   grnxx::IndexRange range;
   range.set_lower_bound(grnxx::Float(64 / 256.0), grnxx::INCLUSIVE_END_POINT);
   range.set_upper_bound(grnxx::Float(192 / 256.0), grnxx::EXCLUSIVE_END_POINT);
-  auto cursor = index->create_cursor(&error, range);
+  auto cursor = index->find_in_range(&error, range);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -621,7 +621,7 @@ void test_text_range() {
   grnxx::IndexRange range;
   range.set_lower_bound(grnxx::Text("25"), grnxx::EXCLUSIVE_END_POINT);
   range.set_upper_bound(grnxx::Text("75"), grnxx::INCLUSIVE_END_POINT);
-  auto cursor = index->create_cursor(&error, range);
+  auto cursor = index->find_in_range(&error, range);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -683,7 +683,7 @@ void test_reverse() {
   range.set_upper_bound(grnxx::Int(90), grnxx::EXCLUSIVE_END_POINT);
   grnxx::CursorOptions options;
   options.order_type = grnxx::REVERSE_ORDER;
-  auto cursor = index->create_cursor(&error, range, options);
+  auto cursor = index->find_in_range(&error, range, options);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -740,7 +740,7 @@ void test_offset_and_limit() {
   assert(index);
 
   // Create a cursor.
-  auto cursor = index->create_cursor(&error);
+  auto cursor = index->find_in_range(&error);
   assert(cursor);
 
   grnxx::Array<grnxx::Record> records;
@@ -751,7 +751,7 @@ void test_offset_and_limit() {
   // Create a cursor with an offset.
   grnxx::CursorOptions options;
   options.offset = OFFSET;
-  cursor = index->create_cursor(&error, grnxx::IndexRange(), options);
+  cursor = index->find_in_range(&error, grnxx::IndexRange(), options);
 
   grnxx::Array<grnxx::Record> records_with_offset;
   assert(cursor->read_all(&error, &records_with_offset) == (NUM_ROWS - OFFSET));
@@ -765,7 +765,7 @@ void test_offset_and_limit() {
 
   // Create a cursor with an offset and a limit.
   options.limit = LIMIT;
-  cursor = index->create_cursor(&error, grnxx::IndexRange(), options);
+  cursor = index->find_in_range(&error, grnxx::IndexRange(), options);
 
   grnxx::Array<grnxx::Record> records_with_offset_and_limit;
   assert(cursor->read_all(&error, &records_with_offset_and_limit) == LIMIT);
-------------- next part --------------
HTML����������������������������...
다운로드 



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