From: Padraig O'Sullivan Date: Sat, 18 Jul 2009 15:54:55 +0000 (-0400) Subject: Updated C++ interface to have include guards. Also modified the naming X-Git-Tag: 0.32~8^2~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=ec47ede7496f74d26369c3ec63430b688ad84006;p=m6w6%2Flibmemcached Updated C++ interface to have include guards. Also modified the naming convention for the functions in the C++ interface. We should use camel case for the C++ interface. --- diff --git a/libmemcached/memcached.hh b/libmemcached/memcached.hh index c6c3ef5e..67262440 100644 --- a/libmemcached/memcached.hh +++ b/libmemcached/memcached.hh @@ -1,3 +1,14 @@ +/* + * Summary: C++ interface for memcached server + * + * Copy: See Copyright for the status of this software. + * + * Authors: Padraig O'Sullivan, Patrick Galbraith + */ + +#ifndef LIBMEMCACHEDPP_H +#define LIBMEMCACHEDPP_H + #include #include @@ -62,15 +73,16 @@ public: return ret_val; } - std::string get_by_key(const std::string &master_key, - const std::string &key, - size_t *value_length) + std::string getByKey(const std::string &master_key, + const std::string &key, + size_t *value_length) { uint32_t flags; memcached_return rc; std::string ret_val; - char *value= memcached_get_by_key(&memc, master_key.c_str(), master_key.length(), + char *value= memcached_get_by_key(&memc, + master_key.c_str(), master_key.length(), key.c_str(), key.length(), value_length, &flags, &rc); if (value) @@ -128,10 +140,10 @@ public: return (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); } - bool set_all(std::vector &keys, - std::vector &values, - time_t expiration, - uint32_t flags) + bool setAll(std::vector &keys, + std::vector &values, + time_t expiration, + uint32_t flags) { if (keys.size() != values.size()) { @@ -153,11 +165,11 @@ public: return retval; } - bool set_by_key(const std::string &master_key, - const std::string &key, - const std::string &value, - time_t expiration, - uint32_t flags) + bool setByKey(const std::string &master_key, + const std::string &key, + const std::string &value, + time_t expiration, + uint32_t flags) { memcached_return rc= memcached_set_by_key(&memc, master_key.c_str(), master_key.length(), @@ -191,9 +203,9 @@ public: return (rc == MEMCACHED_SUCCESS); } - bool add_by_key(const std::string &master_key, - const std::string &key, - const std::string &value) + bool addByKey(const std::string &master_key, + const std::string &key, + const std::string &value) { memcached_return rc= memcached_add_by_key(&memc, master_key.c_str(), @@ -214,9 +226,9 @@ public: return (rc == MEMCACHED_SUCCESS); } - bool replace_by_key(const std::string &master_key, - const std::string &key, - const std::string &value) + bool replaceByKey(const std::string &master_key, + const std::string &key, + const std::string &value) { memcached_return rc= memcached_replace_by_key(&memc, master_key.c_str(), @@ -236,9 +248,9 @@ public: return (rc == MEMCACHED_SUCCESS); } - bool prepend_by_key(const std::string &master_key, - const std::string &key, - const std::string &value) + bool prependByKey(const std::string &master_key, + const std::string &key, + const std::string &value) { memcached_return rc= memcached_prepend_by_key(&memc, master_key.c_str(), @@ -263,9 +275,9 @@ public: return (rc == MEMCACHED_SUCCESS); } - bool append_by_key(const std::string &master_key, - const std::string &key, - const std::string &value) + bool appendByKey(const std::string &master_key, + const std::string &key, + const std::string &value) { memcached_return rc= memcached_append_by_key(&memc, master_key.c_str(), @@ -288,10 +300,10 @@ public: return (rc == MEMCACHED_SUCCESS); } - bool cas_by_key(const std::string &master_key, - const std::string &key, - const std::string &value, - uint64_t cas_arg) + bool casByKey(const std::string &master_key, + const std::string &key, + const std::string &value, + uint64_t cas_arg) { memcached_return rc= memcached_cas_by_key(&memc, master_key.c_str(), @@ -311,8 +323,8 @@ public: return (rc == MEMCACHED_SUCCESS); } - bool delete_by_key(const std::string &master_key, - const std::string &key) + bool removeByKey(const std::string &master_key, + const std::string &key) { memcached_return rc= memcached_delete_by_key(&memc, master_key.c_str(), @@ -329,9 +341,9 @@ public: return (rc == MEMCACHED_SUCCESS); } - bool fetch_execute(memcached_execute_function *callback, - void *context, - unsigned int num_of_callbacks) + bool fetchExecute(memcached_execute_function *callback, + void *context, + unsigned int num_of_callbacks) { memcached_return rc= memcached_fetch_execute(&memc, callback, @@ -340,7 +352,7 @@ public: return (rc == MEMCACHED_SUCCESS); } - const std::string lib_version() const + const std::string libVersion() const { const char *ver= memcached_lib_version(); const std::string version(ver); @@ -351,3 +363,5 @@ private: memcached_st memc; memcached_result_st result; }; + +#endif /* LIBMEMCACHEDPP_H */