[Groonga-commit] groonga/grnxx [master] Add grnxx::MapCursor.

Back to archive index

susumu.yata null+****@clear*****
Wed Mar 13 10:10:04 JST 2013


susumu.yata	2013-03-13 10:10:04 +0900 (Wed, 13 Mar 2013)

  New Revision: 7f78705e04f7badaf18ee413ed42e2954734a73f
  https://github.com/groonga/grnxx/commit/7f78705e04f7badaf18ee413ed42e2954734a73f

  Message:
    Add grnxx::MapCursor.

  Modified files:
    lib/map.cpp
    lib/map.hpp

  Modified: lib/map.cpp (+3 -0)
===================================================================
--- lib/map.cpp    2013-03-12 12:37:54 +0900 (a9b8a4f)
+++ lib/map.cpp    2013-03-13 10:10:04 +0900 (d9d1374)
@@ -28,6 +28,9 @@ MapOptions::MapOptions() : type(MAP_UNKNOWN) {}
 
 MapHeader::MapHeader() : type(MAP_UNKNOWN) {}
 
+MapCursor::MapCursor() : map_(nullptr), key_id_(-1), key_() {}
+MapCursor::~MapCursor() {}
+
 MapScan::~MapScan() {}
 
 MapScan *MapScan::open(Map *map, const Slice &query, const Charset *charset) {

  Modified: lib/map.hpp (+27 -0)
===================================================================
--- lib/map.hpp    2013-03-12 12:37:54 +0900 (10d7514)
+++ lib/map.hpp    2013-03-13 10:10:04 +0900 (a123770)
@@ -125,6 +125,33 @@ inline std::ostream &operator<<(std::ostream &stream, const MapKey &key) {
   return stream << key.slice();
 }
 
+// TODO
+class MapCursor {
+ public:
+  MapCursor();
+  virtual ~MapCursor();
+
+  // Move the cursor to the next key and return true on success.
+  virtual bool next() = 0;
+
+  // Remove the current key and return true on success.
+  virtual bool remove_key() = 0;
+
+  // Return the ID of the current key.
+  int64_t key_id() const {
+    return key_id_;
+  }
+  // Return a reference to the current key.
+  const MapKey &key() const {
+    return key_;
+  }
+
+ protected:
+  Map *map_;
+  int64_t key_id_;
+  MapKey key_;
+};
+
 class MapScan {
  public:
   ~MapScan();
-------------- next part --------------
HTML����������������������������...
Download 



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