From e388513914653f6c706f55f2209484584d8d26ef Mon Sep 17 00:00:00 2001 From: Padraig O'Sullivan Date: Sat, 18 Jul 2009 16:40:59 -0400 Subject: [PATCH] Converted remaining functions in the C++ interface to take values as std::vector instead of std::string. --- libmemcached/memcached.hh | 53 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 27 deletions(-) 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); -- 2.30.2