From: Padraig O'Sullivan Date: Sat, 18 Jul 2009 20:40:59 +0000 (-0400) Subject: Converted remaining functions in the C++ interface to take values as X-Git-Tag: 0.32~8^2~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e388513914653f6c706f55f2209484584d8d26ef;p=awesomized%2Flibmemcached Converted remaining functions in the C++ interface to take values as std::vector instead of std::string. --- diff --git a/libmemcached/memcached.hh b/libmemcached/memcached.hh index fa535c0c..3e24aee9 100644 --- a/libmemcached/memcached.hh +++ b/libmemcached/memcached.hh @@ -202,113 +202,113 @@ public: } - bool add(const std::string &key, const std::string &value) + bool add(const std::string &key, const std::vector &value) { memcached_return rc= memcached_add(&memc, key.c_str(), key.length(), - value.c_str(), value.length(), 0, 0); + &value[0], value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } bool addByKey(const std::string &master_key, const std::string &key, - const std::string &value) + const std::vector &value) { memcached_return rc= memcached_add_by_key(&memc, master_key.c_str(), master_key.length(), key.c_str(), key.length(), - value.c_str(), - value.length(), + &value[0], + value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } - bool replace(const std::string &key, const std::string &value) + bool replace(const std::string &key, const std::vector &value) { memcached_return rc= memcached_replace(&memc, key.c_str(), key.length(), - value.c_str(), value.length(), + &value[0], value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } bool replaceByKey(const std::string &master_key, const std::string &key, - const std::string &value) + const std::vector &value) { memcached_return rc= memcached_replace_by_key(&memc, master_key.c_str(), master_key.length(), key.c_str(), key.length(), - value.c_str(), - value.length(), + &value[0], + value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } - bool prepend(const std::string &key, const std::string &value) + bool prepend(const std::string &key, const std::vector &value) { memcached_return rc= memcached_prepend(&memc, key.c_str(), key.length(), - value.c_str(), value.length(), 0, 0); + &value[0], value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } bool prependByKey(const std::string &master_key, const std::string &key, - const std::string &value) + const std::vector &value) { memcached_return rc= memcached_prepend_by_key(&memc, master_key.c_str(), master_key.length(), key.c_str(), key.length(), - value.c_str(), - value.length(), + &value[0], + value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } - bool append(const std::string &key, const std::string &value) + bool append(const std::string &key, const std::vector &value) { memcached_return rc= memcached_append(&memc, key.c_str(), key.length(), - value.c_str(), - value.length(), + &value[0], + value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } bool appendByKey(const std::string &master_key, const std::string &key, - const std::string &value) + const std::vector &value) { memcached_return rc= memcached_append_by_key(&memc, master_key.c_str(), master_key.length(), key.c_str(), key.length(), - value.c_str(), - value.length(), + &value[0], + value.size(), 0, 0); return (rc == MEMCACHED_SUCCESS); } bool cas(const std::string &key, - const std::string &value, + const std::vector &value, uint64_t cas_arg) { memcached_return rc= memcached_cas(&memc, key.c_str(), key.length(), - value.c_str(), value.length(), + &value[0], value.size(), 0, 0, cas_arg); return (rc == MEMCACHED_SUCCESS); } bool casByKey(const std::string &master_key, const std::string &key, - const std::string &value, + const std::vector &value, uint64_t cas_arg) { memcached_return rc= memcached_cas_by_key(&memc, @@ -316,13 +316,12 @@ public: master_key.length(), key.c_str(), key.length(), - value.c_str(), - value.length(), + &value[0], + value.size(), 0, 0, cas_arg); return (rc == MEMCACHED_SUCCESS); } - // using 'remove' vs. 'delete' since 'delete' is a keyword bool remove(const std::string &key) { memcached_return rc= memcached_delete(&memc, key.c_str(), key.length(), 0);