[Groonga-commit] groonga/grnxx [master] Add skeletons of grnxx::alpha::BlobVector::append/prepend().

Zurück zum Archiv-Index

susumu.yata null+****@clear*****
Tue Dec 11 19:12:12 JST 2012


susumu.yata	2012-12-11 19:12:12 +0900 (Tue, 11 Dec 2012)

  New Revision: 44ea0699e3ab619b3f004d6bbf2640bc0fc0c39c
  https://github.com/groonga/grnxx/commit/44ea0699e3ab619b3f004d6bbf2640bc0fc0c39c

  Log:
    Add skeletons of grnxx::alpha::BlobVector::append/prepend().

  Modified files:
    lib/alpha/blob_vector.cpp
    lib/alpha/blob_vector.hpp

  Modified: lib/alpha/blob_vector.cpp (+8 -0)
===================================================================
--- lib/alpha/blob_vector.cpp    2012-12-11 19:03:36 +0900 (010eabb)
+++ lib/alpha/blob_vector.cpp    2012-12-11 19:12:12 +0900 (3bc9adc)
@@ -131,6 +131,14 @@ void BlobVectorImpl::set_value(uint64_t id, const Blob &value) {
   free_value(old_cell);
 }
 
+void BlobVectorImpl::append(uint64_t id, const Blob &value) {
+  // TODO
+}
+
+void BlobVectorImpl::prepend(uint64_t id, const Blob &value) {
+  // TODO
+}
+
 StringBuilder &BlobVectorImpl::write_to(StringBuilder &builder) const {
   if (!builder) {
     return builder;

  Modified: lib/alpha/blob_vector.hpp (+28 -0)
===================================================================
--- lib/alpha/blob_vector.hpp    2012-12-11 19:03:36 +0900 (5458300)
+++ lib/alpha/blob_vector.hpp    2012-12-11 19:12:12 +0900 (0811359)
@@ -353,6 +353,11 @@ class BlobRef {
     return *this;
   }
 
+  BlobRef &operator+=(const Blob &value) {
+    append(value);
+    return *this;
+  }
+
   Blob get() const;
   void set(std::nullptr_t) {
     set(Blob(nullptr));
@@ -362,6 +367,15 @@ class BlobRef {
     set(Blob(ptr, length));
   }
 
+  void append(const Blob &value);
+  void append(const void *ptr, uint64_t length) {
+    append(Blob(ptr, length));
+  }
+  void prepend(const Blob &value);
+  void prepend(const void *ptr, uint64_t length) {
+    prepend(Blob(ptr, length));
+  }
+
  private:
   BlobVector &vector_;
   uint64_t id_;
@@ -388,6 +402,9 @@ class BlobVectorImpl {
   Blob get_value(uint64_t id);
   void set_value(uint64_t id, const Blob &value);
 
+  void append(uint64_t id, const Blob &value);
+  void prepend(uint64_t id, const Blob &value);
+
   uint32_t block_id() const {
     return block_info_->id();
   }
@@ -468,6 +485,9 @@ class BlobVector {
     impl_->set_value(id, value);
   }
 
+  void append(uint64_t id, const Blob &value);
+  void prepend(uint64_t id, const Blob &value);
+
   uint32_t block_id() const {
     return impl_->block_id();
   }
@@ -509,6 +529,14 @@ inline void BlobRef::set(const Blob &value) {
   vector_.set_value(id_, value);
 }
 
+inline void BlobRef::append(const Blob &value) {
+  vector_.append(id_, value);
+}
+
+inline void BlobRef::prepend(const Blob &value) {
+  vector_.prepend(id_, value);
+}
+
 }  // namespace alpha
 }  // namespace grnxx
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index