utility functions More...
#include <kccommon.h>
Namespaces | |
namespace | kyotocabinet |
All symbols of Kyoto Cabinet. | |
Typedefs | |
typedef std::unordered_map < std::string, std::string > | kyotocabinet::StringHashMap |
An alias of hash map of strings. | |
typedef std::map< std::string, std::string > | kyotocabinet::StringTreeMap |
An alias of tree map of strings. | |
Functions | |
int64_t | kyotocabinet::atoi (const char *str) |
Convert a decimal string to an integer. | |
int64_t | kyotocabinet::atoix (const char *str) |
Convert a decimal string with a metric prefix to an integer. | |
int64_t | kyotocabinet::atoih (const char *str) |
Convert a hexadecimal string to an integer. | |
int64_t | kyotocabinet::atoin (const char *ptr, size_t size) |
Convert a decimal byte array to an integer. | |
double | kyotocabinet::atof (const char *str) |
Convert a decimal string to a real number. | |
double | kyotocabinet::atofn (const char *ptr, size_t size) |
Convert a decimal byte array to a real number. | |
uint16_t | kyotocabinet::hton16 (uint16_t num) |
Normalize a 16-bit number in the native order into the network byte order. | |
uint32_t | kyotocabinet::hton32 (uint32_t num) |
Normalize a 32-bit number in the native order into the network byte order. | |
uint64_t | kyotocabinet::hton64 (uint64_t num) |
Normalize a 64-bit number in the native order into the network byte order. | |
uint16_t | kyotocabinet::ntoh16 (uint16_t num) |
Denormalize a 16-bit number in the network byte order into the native order. | |
uint32_t | kyotocabinet::ntoh32 (uint32_t num) |
Denormalize a 32-bit number in the network byte order into the native order. | |
uint64_t | kyotocabinet::ntoh64 (uint64_t num) |
Denormalize a 64-bit number in the network byte order into the native order. | |
void | kyotocabinet::writefixnum (void *buf, uint64_t num, size_t width) |
Write a number in fixed length format into a buffer. | |
uint64_t | kyotocabinet::readfixnum (const void *buf, size_t width) |
Read a number in fixed length format from a buffer. | |
size_t | kyotocabinet::writevarnum (void *buf, uint64_t num) |
Write a number in variable length format into a buffer. | |
size_t | kyotocabinet::readvarnum (const void *buf, size_t size, uint64_t *np) |
Read a number in variable length format from a buffer. | |
size_t | kyotocabinet::sizevarnum (uint64_t num) |
Check the size of variable length format of a number. | |
uint64_t | kyotocabinet::hashmurmur (const void *buf, size_t size) |
Get the hash value by MurMur hashing. | |
uint64_t | kyotocabinet::hashfnv (const void *buf, size_t size) |
Get the hash value by FNV hashing. | |
uint32_t | kyotocabinet::hashpath (const void *buf, size_t size, char *obuf) |
Get the hash value suitable for a file name. | |
uint64_t | kyotocabinet::nearbyprime (uint64_t num) |
Get a prime number nearby a number. | |
double | kyotocabinet::nan () |
Get the quiet Not-a-Number value. | |
double | kyotocabinet::inf () |
Get the positive infinity value. | |
bool | kyotocabinet::chknan (double num) |
Check a number is a Not-a-Number value. | |
bool | kyotocabinet::chkinf (double num) |
Check a number is an infinity value. | |
void | kyotocabinet::vstrprintf (std::string *dest, const char *format, va_list ap) |
Append a formatted string at the end of a string. | |
void | kyotocabinet::strprintf (std::string *dest, const char *format,...) |
Append a formatted string at the end of a string. | |
std::string | kyotocabinet::strprintf (const char *format,...) |
Generate a formatted string. | |
size_t | kyotocabinet::strsplit (const std::string &str, char delim, std::vector< std::string > *elems) |
Split a string with a delimiter. | |
size_t | kyotocabinet::strsplit (const std::string &str, const std::string &delims, std::vector< std::string > *elems) |
Split a string with delimiters. | |
char * | kyotocabinet::hexencode (const void *buf, size_t size) |
Encode a serial object by hexadecimal encoding. | |
char * | kyotocabinet::hexdecode (const char *str, size_t *sp) |
Decode a string encoded by hexadecimal encoding. | |
char * | kyotocabinet::urlencode (const void *buf, size_t size) |
Encode a serial object by URL encoding. | |
char * | kyotocabinet::urldecode (const char *str, size_t *sp) |
Decode a string encoded by URL encoding. | |
char * | kyotocabinet::quoteencode (const void *buf, size_t size) |
Encode a serial object by Quoted-printable encoding. | |
char * | kyotocabinet::quotedecode (const char *str, size_t *sp) |
Decode a string encoded by Quoted-printable encoding. | |
char * | kyotocabinet::baseencode (const void *buf, size_t size) |
Encode a serial object by Base64 encoding. | |
char * | kyotocabinet::basedecode (const char *str, size_t *sp) |
Decode a string encoded by Base64 encoding. | |
void | kyotocabinet::arccipher (const void *ptr, size_t size, const void *kbuf, size_t ksiz, void *obuf) |
Cipher or decipher a serial object with the Arcfour stream cipher. | |
char * | kyotocabinet::memdup (const char *ptr, size_t size) |
Duplicate a region on memory. | |
char * | kyotocabinet::strdup (const char *str) |
Duplicate a string on memory. | |
char * | kyotocabinet::strtoupper (char *str) |
Convert the letters of a string into upper case. | |
char * | kyotocabinet::strtolower (char *str) |
Convert the letters of a string into lower case. | |
char * | kyotocabinet::strtrim (char *str) |
Cut space characters at head or tail of a string. | |
char * | kyotocabinet::strsqzspc (char *str) |
Squeeze space characters in a string and trim it. | |
char * | kyotocabinet::strnrmspc (char *str) |
Normalize space characters in a string and trim it. | |
int32_t | kyotocabinet::stricmp (const char *astr, const char *bstr) |
Compare two strings with case insensitive evaluation. | |
bool | kyotocabinet::strfwm (const char *str, const char *key) |
Check whether a string begins with a key. | |
bool | kyotocabinet::strifwm (const char *str, const char *key) |
Check whether a string begins with a key by case insensitive evaluation. | |
bool | kyotocabinet::strbwm (const char *str, const char *key) |
Check whether a string ends with a key. | |
bool | kyotocabinet::stribwm (const char *str, const char *key) |
Check whether a string ends with a key by case insensitive evaluation. | |
void * | kyotocabinet::xmalloc (size_t size) |
Allocate a region on memory. | |
void * | kyotocabinet::xcalloc (size_t nmemb, size_t size) |
Allocate a nullified region on memory. | |
void * | kyotocabinet::xrealloc (void *ptr, size_t size) |
Re-allocate a region on memory. | |
void | kyotocabinet::xfree (void *ptr) |
Free a region on memory. | |
void * | kyotocabinet::mapalloc (size_t size) |
Allocate a nullified region on mapped memory. | |
void | kyotocabinet::mapfree (void *ptr) |
Free a region on mapped memory. | |
double | kyotocabinet::time () |
Get the time of day in seconds. | |
int64_t | kyotocabinet::getpid () |
Get the process ID. | |
const char * | kyotocabinet::getenv (const char *name) |
Get the value of an environment variable. | |
void | kyotocabinet::getsysinfo (std::map< std::string, std::string > *strmap) |
Get system information of the environment. | |
void | kyotocabinet::setstdiobin () |
Set the standard streams into the binary mode. | |
Variables | |
const char *const | kyotocabinet::VERSION |
The package version. | |
const int32_t | kyotocabinet::LIBVER |
The library version. | |
const int32_t | kyotocabinet::LIBREV |
The library revision. | |
const int32_t | kyotocabinet::FMTVER |
The database format version. | |
const char * | kyotocabinet::SYSNAME |
The system name. | |
const bool | kyotocabinet::BIGEND |
The flag for big endian environments. | |
const int32_t | kyotocabinet::CLOCKTICK |
The clock tick of interruption. | |
const int32_t | kyotocabinet::PAGESIZE |
The size of a page. | |
const char *const | kyotocabinet::FEATURES |
The extra feature list. | |
const size_t | kyotocabinet::NUMBUFSIZ = 32 |
The buffer size for numeric data. | |
const size_t | kyotocabinet::MEMMAXSIZ = INT32_MAX / 2 |
The maximum memory size for debugging. |
utility functions