Kyoto Cabinet

- Main Page
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Typedefs | Functions | Variables
kyotocabinet Namespace Reference

All symbols of Kyoto Cabinet. More...

## Classes

class | CacheDB
| On-memory hash database with LRU deletion. More...
class | Comparator
| Interfrace of comparator of record keys. More...
class | LexicalComparator
| Comparator in the lexical order. More...
class | LexicalDescendingComparator
| Comparator in the lexical descending order. More...
class | DecimalComparator
| Comparator in the decimal order. More...
class | DecimalDescendingComparator
| Comparator in the decimal descending order. More...
class | Compressor
| Interfrace of data compression and decompression. More...
class | ZLIB
| ZLIB compressor. More...
class | LZO
| LZO compressor. More...
class | LZMA
| LZMA compressor. More...
class | ZLIBCompressor
| Compressor with ZLIB. More...
class | LZOCompressor
| Compressor with LZO. More...
class | LZMACompressor
| Compressor with LZMA. More...
class | ArcfourCompressor
| Compressor with the Arcfour cipher. More...
class | DB
| Interface of database abstraction. More...
class | BasicDB
| Basic implementation of database. More...
class | MapReduce
| MapReduce framework. More...
class | IndexDB
| Index database. More...
class | DirDB
| Directory hash database. More...
class | File
| Filesystem abstraction. More...
class | DirStream
| Directory stream abstraction. More...
class | HashDB
| File hash database. More...
class | LinkedHashMap
| Doubly-linked hash map. More...
class | TinyHashMap
| Memory-saving string hash map. More...
class | TinyArrayList
| Memory-saving string array list. More...
class | PlantDB
| Plant database. More...
class | PolyDB
| Polymorphic database. More...
class | ProtoDB
| Prototype implementation of database with STL. More...
class | Regex
| Regular expression. More...
class | StashDB
| Economical on-memory hash database. More...
class | TextDB
| Plain text database. More...
class | Thread
| Threading device. More...
class | Mutex
| Basic mutual exclusion device. More...
class | ScopedMutex
| Scoped mutex device. More...
class | SlottedMutex
| Slotted mutex device. More...
class | SpinLock
| Lightweight mutual exclusion device. More...
class | ScopedSpinLock
| Scoped spin lock device. More...
class | SlottedSpinLock
| Slotted spin lock devices. More...
class | RWLock
| Reader-writer locking device. More...
class | ScopedRWLock
| Scoped reader-writer locking device. More...
class | SlottedRWLock
| Slotted reader-writer lock devices. More...
class | SpinRWLock
| Lightweight reader-writer locking device. More...
class | ScopedSpinRWLock
| Scoped reader-writer locking device. More...
class | SlottedSpinRWLock
| Slotted lightweight reader-writer lock devices. More...
class | CondVar
| Condition variable. More...
class | CondMap
| Assosiative condition variable. More...
class | TSDKey
| Key of thread specific data. More...
class | TSD
| Smart pointer to thread specific data. More...
class | AtomicInt64
| Integer with atomic operations. More...
class | TaskQueue
| Task queue device. More...

## Typedefs

typedef PlantDB< CacheDB, BasicDB::TYPEGRASS > | GrassDB
| An alias of the cache tree database.
typedef PlantDB< DirDB, BasicDB::TYPEFOREST > | ForestDB
| An alias of the directory tree database.
typedef PlantDB< HashDB, BasicDB::TYPETREE > | TreeDB
| An alias of the file tree database.
typedef ProtoDB< StringHashMap, BasicDB::TYPEPHASH > | ProtoHashDB
| An alias of the prototype hash database.
typedef ProtoDB< StringTreeMap, BasicDB::TYPEPTREE > | ProtoTreeDB
| An alias of the prototype tree database.
typedef std::unordered_map < std::string, std::string > | StringHashMap
| An alias of hash map of strings.
typedef std::map< std::string, std::string > | StringTreeMap
| An alias of tree map of strings.

## Functions

int64_t | atoi (const char *str)
| Convert a decimal string to an integer.
int64_t | atoix (const char *str)
| Convert a decimal string with a metric prefix to an integer.
int64_t | atoih (const char *str)
| Convert a hexadecimal string to an integer.
int64_t | atoin (const char *ptr, size_t size)
| Convert a decimal byte array to an integer.
double | atof (const char *str)
| Convert a decimal string to a real number.
double | atofn (const char *ptr, size_t size)
| Convert a decimal byte array to a real number.
uint16_t | hton16 (uint16_t num)
| Normalize a 16-bit number in the native order into the network byte order.
uint32_t | hton32 (uint32_t num)
| Normalize a 32-bit number in the native order into the network byte order.
uint64_t | hton64 (uint64_t num)
| Normalize a 64-bit number in the native order into the network byte order.
uint16_t | ntoh16 (uint16_t num)
| Denormalize a 16-bit number in the network byte order into the native order.
uint32_t | ntoh32 (uint32_t num)
| Denormalize a 32-bit number in the network byte order into the native order.
uint64_t | ntoh64 (uint64_t num)
| Denormalize a 64-bit number in the network byte order into the native order.
void | writefixnum (void *buf, uint64_t num, size_t width)
| Write a number in fixed length format into a buffer.
uint64_t | readfixnum (const void *buf, size_t width)
| Read a number in fixed length format from a buffer.
size_t | writevarnum (void *buf, uint64_t num)
| Write a number in variable length format into a buffer.
size_t | readvarnum (const void *buf, size_t size, uint64_t *np)
| Read a number in variable length format from a buffer.
size_t | sizevarnum (uint64_t num)
| Check the size of variable length format of a number.
uint64_t | hashmurmur (const void *buf, size_t size)
| Get the hash value by MurMur hashing.
uint64_t | hashfnv (const void *buf, size_t size)
| Get the hash value by FNV hashing.
uint32_t | hashpath (const void *buf, size_t size, char *obuf)
| Get the hash value suitable for a file name.
uint64_t | nearbyprime (uint64_t num)
| Get a prime number nearby a number.
double | nan ()
| Get the quiet Not-a-Number value.
double | inf ()
| Get the positive infinity value.
bool | chknan (double num)
| Check a number is a Not-a-Number value.
bool | chkinf (double num)
| Check a number is an infinity value.
void | vstrprintf (std::string *dest, const char *format, va_list ap)
| Append a formatted string at the end of a string.
void | strprintf (std::string *dest, const char *format,...)
| Append a formatted string at the end of a string.
std::string | strprintf (const char *format,...)
| Generate a formatted string.
size_t | strsplit (const std::string &str, char delim, std::vector< std::string > *elems)
| Split a string with a delimiter.
size_t | strsplit (const std::string &str, const std::string &delims, std::vector< std::string > *elems)
| Split a string with delimiters.
std::string * | strtoupper (std::string *str)
| Convert the letters of a string into upper case.
std::string * | strtolower (std::string *str)
| Convert the letters of a string into lower case.
bool | strfwm (const std::string &str, const std::string &key)
| Check whether a string begins with a key.
bool | strbwm (const std::string &str, const std::string &key)
| Check whether a string ends with a key.
std::string * | strtrim (std::string *str)
| Cut space characters at head or tail of a string.
void | strutftoucs (const std::string &src, std::vector< uint32_t > *dest)
| Convert a UTF-8 string into a UCS-4 array.
void | strucstoutf (const std::vector< uint32_t > &src, std::string *dest)
| Convert a UCS-4 array into a UTF-8 string.
void | strvecdump (const std::vector< std::string > &src, std::string *dest)
| Serialize a string vector object into a string object.
void | strvecload (const std::string &src, std::vector< std::string > *dest)
| Deserialize a string object into a string vector object.
void | strmapdump (const std::map< std::string, std::string > &src, std::string *dest)
| Serialize a string vector object into a string object.
void | strmapload (const std::string &src, std::map< std::string, std::string > *dest)
| Deserialize a string object into a string map object.
char * | hexencode (const void *buf, size_t size)
| Encode a serial object by hexadecimal encoding.
char * | hexdecode (const char *str, size_t *sp)
| Decode a string encoded by hexadecimal encoding.
char * | urlencode (const void *buf, size_t size)
| Encode a serial object by URL encoding.
char * | urldecode (const char *str, size_t *sp)
| Decode a string encoded by URL encoding.
char * | quoteencode (const void *buf, size_t size)
| Encode a serial object by Quoted-printable encoding.
char * | quotedecode (const char *str, size_t *sp)
| Decode a string encoded by Quoted-printable encoding.
char * | baseencode (const void *buf, size_t size)
| Encode a serial object by Base64 encoding.
char * | basedecode (const char *str, size_t *sp)
| Decode a string encoded by Base64 encoding.
void | 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 * | memdup (const char *ptr, size_t size)
| Duplicate a region on memory.
int32_t | memicmp (const void *abuf, const void *bbuf, size_t size)
| Compare two regions by case insensitive evaluation.
void * | memmem (const void *hbuf, size_t hsiz, const void *nbuf, size_t nsiz)
| Find the first occurrence of a sub pattern.
void * | memimem (const void *hbuf, size_t hsiz, const void *nbuf, size_t nsiz)
| Find the first occurrence of a sub pattern by case insensitive evaluation.
size_t | memdist (const void *abuf, size_t asiz, const void *bbuf, size_t bsiz)
| Calculate the levenshtein distance of two regions in bytes.
char * | strdup (const char *str)
| Duplicate a string on memory.
char * | strtoupper (char *str)
| Convert the letters of a string into upper case.
char * | strtolower (char *str)
| Convert the letters of a string into lower case.
char * | strtrim (char *str)
| Cut space characters at head or tail of a string.
char * | strsqzspc (char *str)
| Squeeze space characters in a string and trim it.
char * | strnrmspc (char *str)
| Normalize space characters in a string and trim it.
int32_t | stricmp (const char *astr, const char *bstr)
| Compare two strings by case insensitive evaluation.
char * | stristr (const char *hstr, const char *nstr)
| Find the first occurrence of a substring by case insensitive evaluation.
bool | strfwm (const char *str, const char *key)
| Check whether a string begins with a key.
bool | strifwm (const char *str, const char *key)
| Check whether a string begins with a key by case insensitive evaluation.
bool | strbwm (const char *str, const char *key)
| Check whether a string ends with a key.
bool | stribwm (const char *str, const char *key)
| Check whether a string ends with a key by case insensitive evaluation.
size_t | strutflen (const char *str)
| Get the number of characters in a UTF-8 string.
void | strutftoucs (const char *src, uint32_t *dest, size_t *np)
| Convert a UTF-8 string into a UCS-4 array.
void | strutftoucs (const char *src, size_t slen, uint32_t *dest, size_t *np)
| Convert a UTF-8 string into a UCS-4 array.
size_t | strucstoutf (const uint32_t *src, size_t snum, char *dest)
| Convert a UCS-4 array into a UTF-8 string.
size_t | strutfdist (const char *astr, const char *bstr)
| Calculate the levenshtein distance of two UTF-8 strings.
size_t | strucsdist (const uint32_t *aary, size_t anum, const uint32_t *bary, size_t bnum)
| Calculate the levenshtein distance of two UCS-4 arrays.
void * | xmalloc (size_t size)
| Allocate a region on memory.
void * | xcalloc (size_t nmemb, size_t size)
| Allocate a nullified region on memory.
void * | xrealloc (void *ptr, size_t size)
| Re-allocate a region on memory.
void | xfree (void *ptr)
| Free a region on memory.
void * | mapalloc (size_t size)
| Allocate a nullified region on mapped memory.
void | mapfree (void *ptr)
| Free a region on mapped memory.
double | time ()
| Get the time of day in seconds.
int64_t | getpid ()
| Get the process ID.
const char * | getenv (const char *name)
| Get the value of an environment variable.
void | getsysinfo (std::map< std::string, std::string > *strmap)
| Get system information of the environment.
void | setstdiobin ()
| Set the standard streams into the binary mode.
bool | _dummytest ()
| Dummy test driver.

## Variables

LexicalComparator *const | LEXICALCOMP
| Prepared pointer of the comparator in the lexical order.
LexicalDescendingComparator *const | LEXICALDESCCOMP
| Prepared pointer of the comparator in the lexical descending order.
DecimalComparator *const | DECIMALCOMP
| Prepared pointer of the comparator in the decimal order.
DecimalDescendingComparator *const | DECIMALDESCCOMP
| Prepared pointer of the comparator in the decimal descending order.
ZLIBCompressor< ZLIB::RAW > *const | ZLIBRAWCOMP
| Prepared pointer of the compressor with ZLIB raw mode.
const int8_t | INT8MAX = (std::numeric_limits<int8_t>::max)()
| The maximum value of int8_t.
const int16_t | INT16MAX = (std::numeric_limits<int16_t>::max)()
| The maximum value of int16_t.
const int32_t | INT32MAX = (std::numeric_limits<int32_t>::max)()
| The maximum value of int32_t.
const int64_t | INT64MAX = (std::numeric_limits<int64_t>::max)()
| The maximum value of int64_t.
const int8_t | INT8MIN = (std::numeric_limits<int8_t>::min)()
| The minimum value of int8_t.
const int16_t | INT16MIN = (std::numeric_limits<int16_t>::min)()
| The minimum value of int16_t.
const int32_t | INT32MIN = (std::numeric_limits<int32_t>::min)()
| The minimum value of int32_t.
const int64_t | INT64MIN = (std::numeric_limits<int64_t>::min)()
| The minimum value of int64_t.
const uint8_t | UINT8MAX = (std::numeric_limits<uint8_t>::max)()
| The maximum value of uint8_t.
const uint16_t | UINT16MAX = (std::numeric_limits<uint16_t>::max)()
| The maximum value of uint16_t.
const uint32_t | UINT32MAX = (std::numeric_limits<uint32_t>::max)()
| The maximum value of uint32_t.
const uint64_t | UINT64MAX = (std::numeric_limits<uint64_t>::max)()
| The maximum value of uint64_t.
const size_t | SIZEMAX = (std::numeric_limits<size_t>::max)()
| The maximum value of size_t.
const float | FLTMAX = (std::numeric_limits<float>::max)()
| The maximum value of float.
const double | DBLMAX = (std::numeric_limits<double>::max)()
| The maximum value of double.
const char *const | VERSION
| The package version.
const int32_t | LIBVER
| The library version.
const int32_t | LIBREV
| The library revision.
const int32_t | FMTVER
| The database format version.
const char *const | OSNAME
| The system name.
const bool | BIGEND
| The flag for big endian environments.
const int32_t | CLOCKTICK
| The clock tick of interruption.
const int32_t | PAGESIZ
| The size of a page.
const char *const | FEATURES
| The extra feature list.
const size_t | NUMBUFSIZ = 32
| The buffer size for numeric data.
const size_t | MEMMAXSIZ = INT32MAX / 2
| The maximum memory size for debugging.

## Detailed Description

All symbols of Kyoto Cabinet.

Common namespace of Kyoto Cabinet.

## Typedef Documentation

typedef PlantDB<CacheDB, BasicDB::TYPEGRASS> kyotocabinet::GrassDB

An alias of the cache tree database.

typedef PlantDB<DirDB, BasicDB::TYPEFOREST> kyotocabinet::ForestDB

An alias of the directory tree database.

typedef PlantDB<HashDB, BasicDB::TYPETREE> kyotocabinet::TreeDB

An alias of the file tree database.

typedef ProtoDB<StringHashMap, BasicDB::TYPEPHASH> kyotocabinet::ProtoHashDB

An alias of the prototype hash database.

typedef ProtoDB<StringTreeMap, BasicDB::TYPEPTREE> kyotocabinet::ProtoTreeDB

An alias of the prototype tree database.

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.

## Function Documentation

int64_t kyotocabinet::atoi | ( | const char * | str | ) |

Convert a decimal string to an integer.

Parameters:

  str | the decimal string.

Returns:
  the integer. If the string does not contain numeric expression, 0 is returned.

int64_t kyotocabinet::atoix | ( | const char * | str | ) |

Convert a decimal string with a metric prefix to an integer.

Parameters:

  str | the decimal string, which can be trailed by a binary metric prefix. "K", "M", "G", "T", "P", and "E" are supported. They are case-insensitive.

Returns:
  the integer. If the string does not contain numeric expression, 0 is returned. If the integer overflows the domain, kyotocabinet::INT64MAX or kyotocabinet::INT64_MIN is returned according to the sign.

int64_t kyotocabinet::atoih | ( | const char * | str | ) |

Convert a hexadecimal string to an integer.

Parameters:

  str | the hexadecimal string.

Returns:
  the integer. If the string does not contain numeric expression, 0 is returned.

int64_t kyotocabinet::atoin | ( | const char * | ptr,
|  | size_t | size
| ) |  |

Convert a decimal byte array to an integer.

Parameters:

  ptr | the decimal byte array.
  size | the size of the decimal byte array.

Returns:
  the integer. If the string does not contain numeric expression, 0 is returned.

double kyotocabinet::atof | ( | const char * | str | ) |

Convert a decimal string to a real number.

Parameters:

  str | the decimal string.

Returns:
  the real number. If the string does not contain numeric expression, 0.0 is returned.

double kyotocabinet::atofn | ( | const char * | ptr,
|  | size_t | size
| ) |  |

Convert a decimal byte array to a real number.

Parameters:

  ptr | the decimal byte array.
  size | the size of the decimal byte array.

Returns:
  the real number. If the string does not contain numeric expression, 0.0 is returned.

uint16_t kyotocabinet::hton16 | ( | uint16_t | num | ) |

Normalize a 16-bit number in the native order into the network byte order.

Parameters:

  num | the 16-bit number in the native order.

Returns:
  the number in 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.

Parameters:

  num | the 32-bit number in the native order.

Returns:
  the number in 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.

Parameters:

  num | the 64-bit number in the native order.

Returns:
  the number in 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.

Parameters:

  num | the 16-bit number in the network byte order.

Returns:
  the converted number in the native order.

uint32_t kyotocabinet::ntoh32 | ( | uint32_t | num | ) |

Denormalize a 32-bit number in the network byte order into the native order.

Parameters:

  num | the 32-bit number in the network byte order.

Returns:
  the converted number in the native order.

uint64_t kyotocabinet::ntoh64 | ( | uint64_t | num | ) |

Denormalize a 64-bit number in the network byte order into the native order.

Parameters:

  num | the 64-bit number in the network byte order.

Returns:
  the converted number in the native order.

void kyotocabinet::writefixnum | ( | void * | buf,
|  | uint64_t | num,
|  | size_t | width
| ) |  |

Write a number in fixed length format into a buffer.

Parameters:

  buf | the desitination buffer.
  num | the number.
  width | the width.

uint64_t kyotocabinet::readfixnum | ( | const void * | buf,
|  | size_t | width
| ) |  |

Read a number in fixed length format from a buffer.

Parameters:

  buf | the source buffer.
  width | the width.

Returns:
  the read number.

size_t kyotocabinet::writevarnum | ( | void * | buf,
|  | uint64_t | num
| ) |  |

Write a number in variable length format into a buffer.

Parameters:

  buf | the desitination buffer.
  num | the number.

Returns:
  the length of the written region.

size_t kyotocabinet::readvarnum | ( | const void * | buf,
|  | size_t | size,
|  | uint64_t * | np
| ) |  |

Read a number in variable length format from a buffer.

Parameters:

  buf | the source buffer.
  size | the size of the source buffer.
  np | the pointer to the variable into which the read number is assigned.

Returns:
  the length of the read region, or 0 on failure.

size_t kyotocabinet::sizevarnum | ( | uint64_t | num | ) |

Check the size of variable length format of a number.

Returns:
  the size of variable length format.

uint64_t kyotocabinet::hashmurmur | ( | const void * | buf,
|  | size_t | size
| ) |  |

Get the hash value by MurMur hashing.

Parameters:

  buf | the source buffer.
  size | the size of the source buffer.

Returns:
  the hash value.

uint64_t kyotocabinet::hashfnv | ( | const void * | buf,
|  | size_t | size
| ) |  |

Get the hash value by FNV hashing.

Parameters:

  buf | the source buffer.
  size | the size of the source buffer.

Returns:
  the hash value.

uint32_t kyotocabinet::hashpath | ( | const void * | buf,
|  | size_t | size,
|  | char * | obuf
| ) |  |

Get the hash value suitable for a file name.

Parameters:

  buf | the source buffer.
  size | the size of the source buffer.
  obuf | the buffer into which the result hash string is written. It must be more than NUMBUFSIZ.

Returns:
  the auxiliary hash value.

uint64_t kyotocabinet::nearbyprime | ( | uint64_t | num | ) |

Get a prime number nearby a number.

Parameters:

  num | a natural number.

Returns:
  the result number.

double kyotocabinet::nan | ( |  | ) |

Get the quiet Not-a-Number value.

Returns:
  the quiet Not-a-Number value.

double kyotocabinet::inf | ( |  | ) |

Get the positive infinity value.

Returns:
  the positive infinity value.

bool kyotocabinet::chknan | ( | double | num | ) |

Check a number is a Not-a-Number value.

Returns:
  true for the number is a Not-a-Number value, or false if not.

bool kyotocabinet::chkinf | ( | double | num | ) |

Check a number is an infinity value.

Returns:
  true for the number is an infinity value, or false if not.

void kyotocabinet::vstrprintf | ( | std::string * | dest,
|  | const char * | format,
|  | va_list | ap
| ) |  |

Append a formatted string at the end of a string.

Parameters:

  dest | the destination string.
  format | the printf-like format string. The conversion character `' can be used with such flag characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', and `'.
  ap | used according to the format string.

void kyotocabinet::strprintf | ( | std::string * | dest,
|  | const char * | format,
|  |  | ...
| ) |  |

Append a formatted string at the end of a string.

Parameters:

  dest | the destination string.
  format | the printf-like format string. The conversion character `' can be used with such flag characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', and `'.
  ... | used according to the format string.

std::string kyotocabinet::strprintf | ( | const char * | format,
|  |  | ...
| ) |  |

Generate a formatted string.

Generate a formatted string on memory.

Parameters:

  format | the printf-like format string. The conversion character `' can be used with such flag characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', and `'.
  ... | used according to the format string.

Returns:
  the result string.

size_t kyotocabinet::strsplit | ( | const std::string & | str,
|  | char | delim,
|  | std::vector< std::string > * | elems
| ) |  |

Split a string with a delimiter.

Parameters:

  str | the string.
  delim | the delimiter.
  elems | a vector object into which the result elements are pushed.

Returns:
  the number of result elements.

size_t kyotocabinet::strsplit | ( | const std::string & | str,
|  | const std::string & | delims,
|  | std::vector< std::string > * | elems
| ) |  |

Split a string with delimiters.

Parameters:

  str | the string.
  delims | the delimiters.
  elems | a vector object into which the result elements are pushed.

Returns:
  the number of result elements.

std::string * kyotocabinet::strtoupper | ( | std::string * | str | ) |

Convert the letters of a string into upper case.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

std::string * kyotocabinet::strtolower | ( | std::string * | str | ) |

Convert the letters of a string into lower case.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

bool kyotocabinet::strfwm | ( | const std::string & | str,
|  | const std::string & | key
| ) |  |

Check whether a string begins with a key.

Parameters:

  str | the string.
  key | the forward matching key string.

Returns:
  true if the target string begins with the key, else, it is false.

bool kyotocabinet::strbwm | ( | const std::string & | str,
|  | const std::string & | key
| ) |  |

Check whether a string ends with a key.

Parameters:

  str | the string.
  key | the backward matching key string.

Returns:
  true if the target string ends with the key, else, it is false.

std::string * kyotocabinet::strtrim | ( | std::string * | str | ) |

Cut space characters at head or tail of a string.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

void kyotocabinet::strutftoucs | ( | const std::string & | src,
|  | std::vector< uint32_t > * | dest
| ) |  |

Convert a UTF-8 string into a UCS-4 array.

Parameters:

  src | the source object.
  dest | the destination object.

void kyotocabinet::strucstoutf | ( | const std::vector< uint32_t > & | src,
|  | std::string * | dest
| ) |  |

Convert a UCS-4 array into a UTF-8 string.

Parameters:

  src | the source object.
  dest | the destination object.

void kyotocabinet::strvecdump | ( | const std::vector< std::string > & | src,
|  | std::string * | dest
| ) |  |

Serialize a string vector object into a string object.

Parameters:

  src | the source object.
  dest | the destination object.

void kyotocabinet::strvecload | ( | const std::string & | src,
|  | std::vector< std::string > * | dest
| ) |  |

Deserialize a string object into a string vector object.

Parameters:

  src | the source object.
  dest | the destination object.

void kyotocabinet::strmapdump | ( | const std::map< std::string, std::string > & | src,
|  | std::string * | dest
| ) |  |

Serialize a string vector object into a string object.

Parameters:

  src | the source object.
  dest | the destination object.

void kyotocabinet::strmapload | ( | const std::string & | src,
|  | std::map< std::string, std::string > * | dest
| ) |  |

Deserialize a string object into a string map object.

Parameters:

  src | the source object.
  dest | the destination object.

char * kyotocabinet::hexencode | ( | const void * | buf,
|  | size_t | size
| ) |  |

Encode a serial object by hexadecimal encoding.

Parameters:

  buf | the pointer to the region.
  size | the size of the region.

Returns:
  the result string.

Note:
  Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::hexdecode | ( | const char * | str,
|  | size_t * | sp
| ) |  |

Decode a string encoded by hexadecimal encoding.

Parameters:

  str | specifies the encoded string.
  sp | the pointer to the variable into which the size of the region of the return value is assigned.

Returns:
  the pointer to the region of the result.

Note:
  Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::urlencode | ( | const void * | buf,
|  | size_t | size
| ) |  |

Encode a serial object by URL encoding.

Parameters:

  buf | the pointer to the region.
  size | the size of the region.

Returns:
  the result string.

Note:
  Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::urldecode | ( | const char * | str,
|  | size_t * | sp
| ) |  |

Decode a string encoded by URL encoding.

Parameters:

  str | specifies the encoded string.
  sp | the pointer to the variable into which the size of the region of the return value is assigned.

Returns:
  the pointer to the region of the result.

Note:
  Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::quoteencode | ( | const void * | buf,
|  | size_t | size
| ) |  |

Encode a serial object by Quoted-printable encoding.

Parameters:

  buf | the pointer to the region.
  size | the size of the region.

Returns:
  the result string.

Note:
  Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::quotedecode | ( | const char * | str,
|  | size_t * | sp
| ) |  |

Decode a string encoded by Quoted-printable encoding.

Parameters:

  str | specifies the encoded string.
  sp | the pointer to the variable into which the size of the region of the return value is assigned.

Returns:
  the pointer to the region of the result.

Note:
  Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::baseencode | ( | const void * | buf,
|  | size_t | size
| ) |  |

Encode a serial object by Base64 encoding.

Parameters:

  buf | the pointer to the region.
  size | the size of the region.

Returns:
  the result string.

Note:
  Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::basedecode | ( | const char * | str,
|  | size_t * | sp
| ) |  |

Decode a string encoded by Base64 encoding.

Parameters:

  str | specifies the encoded string.
  sp | the pointer to the variable into which the size of the region of the return value is assigned.

Returns:
  the pointer to the region of the result.

Note:
  Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

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.

Parameters:

  ptr | the pointer to the region.
  size | the size of the region.
  kbuf | the pointer to the region of the cipher key.
  ksiz | the size of the region of the cipher key.
  obuf | the pointer to the region into which the result data is written. The size of the buffer should be equal to or more than the input region. The region can be the same as the source region.

char * kyotocabinet::memdup | ( | const char * | ptr,
|  | size_t | size
| ) |  |

Duplicate a region on memory.

Parameters:

  ptr | the source buffer.
  size | the size of the source buffer.

Note:
  Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

int32_t kyotocabinet::memicmp | ( | const void * | abuf,
|  | const void * | bbuf,
|  | size_t | size
| ) |  |

Compare two regions by case insensitive evaluation.

Parameters:

  abuf | a buffer.
  bbuf | the other buffer.
  size | the size of each buffer.

Returns:
  positive if the former is big, negative if the latter is big, 0 if both are equivalent.

void * kyotocabinet::memmem | ( | const void * | hbuf,
|  | size_t | hsiz,
|  | const void * | nbuf,
|  | size_t | nsiz
| ) |  |

Find the first occurrence of a sub pattern.

Parameters:

  hbuf | the target pattern buffer.
  hsiz | the size of the target pattern buffer.
  nbuf | the sub pattern buffer.
  nsiz | the size of the sub pattern buffer.

Returns:
  the pointer to the beginning of the sub pattern in the target pattern buffer, or NULL if the sub pattern is not found.

void * kyotocabinet::memimem | ( | const void * | hbuf,
|  | size_t | hsiz,
|  | const void * | nbuf,
|  | size_t | nsiz
| ) |  |

Find the first occurrence of a sub pattern by case insensitive evaluation.

Parameters:

  hbuf | the target pattern buffer.
  hsiz | the size of the target pattern buffer.
  nbuf | the sub pattern buffer.
  nsiz | the size of the sub pattern buffer.

Returns:
  the pointer to the beginning of the sub pattern in the target pattern buffer, or NULL if the sub pattern is not found.

size_t kyotocabinet::memdist | ( | const void * | abuf,
|  | size_t | asiz,
|  | const void * | bbuf,
|  | size_t | bsiz
| ) |  |

Calculate the levenshtein distance of two regions in bytes.

Parameters:

  abuf | the pointer to the region of one buffer.
  asiz | the size of the region of one buffer.
  bbuf | the pointer to the region of the other buffer.
  bsiz | the size of the region of the other buffer.

Returns:
  the levenshtein distance of two regions.

char * kyotocabinet::strdup | ( | const char * | str | ) |

Duplicate a string on memory.

Parameters:

  str | the source string.

Note:
  Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

char * kyotocabinet::strtoupper | ( | char * | str | ) |

Convert the letters of a string into upper case.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

char * kyotocabinet::strtolower | ( | char * | str | ) |

Convert the letters of a string into lower case.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

char * kyotocabinet::strtrim | ( | char * | str | ) |

Cut space characters at head or tail of a string.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

char * kyotocabinet::strsqzspc | ( | char * | str | ) |

Squeeze space characters in a string and trim it.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

char * kyotocabinet::strnrmspc | ( | char * | str | ) |

Normalize space characters in a string and trim it.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

int32_t kyotocabinet::stricmp | ( | const char * | astr,
|  | const char * | bstr
| ) |  |

Compare two strings by case insensitive evaluation.

Parameters:

  astr | a string.
  bstr | the other string.

Returns:
  positive if the former is big, negative if the latter is big, 0 if both are equivalent.

char * kyotocabinet::stristr | ( | const char * | hstr,
|  | const char * | nstr
| ) |  |

Find the first occurrence of a substring by case insensitive evaluation.

Parameters:

  hstr | the target string.
  nstr | the substring.

Returns:
  the pointer to the beginning of the substring in the target string, or NULL if the substring is not found.

bool kyotocabinet::strfwm | ( | const char * | str,
|  | const char * | key
| ) |  |

Check whether a string begins with a key.

Parameters:

  str | the string.
  key | the forward matching key string.

Returns:
  true if the target string begins with the key, else, it is false.

bool kyotocabinet::strifwm | ( | const char * | str,
|  | const char * | key
| ) |  |

Check whether a string begins with a key by case insensitive evaluation.

Parameters:

  str | the string.
  key | the forward matching key string.

Returns:
  true if the target string begins with the key, else, it is false.

bool kyotocabinet::strbwm | ( | const char * | str,
|  | const char * | key
| ) |  |

Check whether a string ends with a key.

Parameters:

  str | the string.
  key | the backward matching key string.

Returns:
  true if the target string ends with the key, else, it is false.

bool kyotocabinet::stribwm | ( | const char * | str,
|  | const char * | key
| ) |  |

Check whether a string ends with a key by case insensitive evaluation.

Parameters:

  str | the string.
  key | the backward matching key string.

Returns:
  true if the target string ends with the key, else, it is false.

size_t kyotocabinet::strutflen | ( | const char * | str | ) |

Get the number of characters in a UTF-8 string.

Parameters:

  str | the UTF-8 string.

Returns:
  the number of characters in the string.

void kyotocabinet::strutftoucs | ( | const char * | src,
|  | uint32_t * | dest,
|  | size_t * | np
| ) |  |

Convert a UTF-8 string into a UCS-4 array.

Parameters:

  src | the source object.
  dest | the destination object. It must have enough size.
  np | the pointer to the variable into which the number of elements in the destination object is assgined.

void kyotocabinet::strutftoucs | ( | const char * | src,
|  | size_t | slen,
|  | uint32_t * | dest,
|  | size_t * | np
| ) |  |

Convert a UTF-8 string into a UCS-4 array.

Parameters:

  src | the source object which does not have to be trailed by zero code.
  slen | the length of the source object.
  dest | the destination object. It must have enough size.
  np | the pointer to the variable into which the number of elements in the destination object is assgined.

size_t kyotocabinet::strucstoutf | ( | const uint32_t * | src,
|  | size_t | snum,
|  | char * | dest
| ) |  |

Convert a UCS-4 array into a UTF-8 string.

Parameters:

  src | the source object.
  snum | the number of elements in the source object.
  dest | the destination object. It must have enough size.

Returns:
  the size of the result string.

size_t kyotocabinet::strutfdist | ( | const char * | astr,
|  | const char * | bstr
| ) |  |

Calculate the levenshtein distance of two UTF-8 strings.

Parameters:

  astr | one UTF-8 string.
  bstr | the other UTF-8 string.

Returns:
  the levenshtein distance of two arrays.

size_t kyotocabinet::strucsdist | ( | const uint32_t * | aary,
|  | size_t | anum,
|  | const uint32_t * | bary,
|  | size_t | bnum
| ) |  |

Calculate the levenshtein distance of two UCS-4 arrays.

Parameters:

  aary | one UCS-4 array.
  anum | the number of elements of one array.
  bary | the other UCS-4 array.
  bnum | the number of elements of the other array.

Returns:
  the levenshtein distance of two arrays.

void * kyotocabinet::xmalloc | ( | size_t | size | ) |

Allocate a region on memory.

Parameters:

  size | the size of the region.

Returns:
  the pointer to the allocated region.

void * kyotocabinet::xcalloc | ( | size_t | nmemb,
|  | size_t | size
| ) |  |

Allocate a nullified region on memory.

Parameters:

  nmemb | the number of elements.
  size | the size of each element.

Returns:
  the pointer to the allocated region.

void * kyotocabinet::xrealloc | ( | void * | ptr,
|  | size_t | size
| ) |  |

Re-allocate a region on memory.

Parameters:

  ptr | the pointer to the region.
  size | the size of the region.

Returns:
  the pointer to the re-allocated region.

void kyotocabinet::xfree | ( | void * | ptr | ) |

Free a region on memory.

Parameters:

  ptr | the pointer to the region.

void* kyotocabinet::mapalloc | ( | size_t | size | ) |

Allocate a nullified region on mapped memory.

Parameters:

  size | the size of the region.

Returns:
  the pointer to the allocated region. It should be released with the memfree call.

void kyotocabinet::mapfree | ( | void * | ptr | ) |

Free a region on mapped memory.

Parameters:

  ptr | the pointer to the allocated region.

double kyotocabinet::time | ( |  | ) |

Get the time of day in seconds.

Returns:
  the time of day in seconds. The accuracy is in microseconds.

int64_t kyotocabinet::getpid | ( |  | ) |

Get the process ID.

Returns:
  the process ID.

const char* kyotocabinet::getenv | ( | const char * | name | ) |

Get the value of an environment variable.

Returns:
  the value of the environment variable, or NULL on failure.

void kyotocabinet::getsysinfo | ( | std::map< std::string, std::string > * | strmap | ) |

Get system information of the environment.

Parameters:

  strmap | a string map to contain the result.

void kyotocabinet::setstdiobin | ( |  | ) |

Set the standard streams into the binary mode.

bool kyotocabinet::_dummytest | ( |  | ) |

Dummy test driver.

Returns:
  always true.

## Variable Documentation

LexicalComparator* const kyotocabinet::LEXICALCOMP

Prepared pointer of the comparator in the lexical order.

LexicalDescendingComparator* const kyotocabinet::LEXICALDESCCOMP

Prepared pointer of the comparator in the lexical descending order.

DecimalComparator* const kyotocabinet::DECIMALCOMP

Prepared pointer of the comparator in the decimal order.

DecimalDescendingComparator* const kyotocabinet::DECIMALDESCCOMP

Prepared pointer of the comparator in the decimal descending order.

ZLIBCompressor<ZLIB::RAW>* const kyotocabinet::ZLIBRAWCOMP

Prepared pointer of the compressor with ZLIB raw mode.

const int8_t kyotocabinet::INT8MAX = (std::numeric_limits<int8_t>::max)()

The maximum value of int8_t.

const int16_t kyotocabinet::INT16MAX = (std::numeric_limits<int16_t>::max)()

The maximum value of int16_t.

const int32_t kyotocabinet::INT32MAX = (std::numeric_limits<int32_t>::max)()

The maximum value of int32_t.

const int64_t kyotocabinet::INT64MAX = (std::numeric_limits<int64_t>::max)()

The maximum value of int64_t.

const int8_t kyotocabinet::INT8MIN = (std::numeric_limits<int8_t>::min)()

The minimum value of int8_t.

const int16_t kyotocabinet::INT16MIN = (std::numeric_limits<int16_t>::min)()

The minimum value of int16_t.

const int32_t kyotocabinet::INT32MIN = (std::numeric_limits<int32_t>::min)()

The minimum value of int32_t.

const int64_t kyotocabinet::INT64MIN = (std::numeric_limits<int64_t>::min)()

The minimum value of int64_t.

const uint8_t kyotocabinet::UINT8MAX = (std::numeric_limits<uint8_t>::max)()

The maximum value of uint8_t.

const uint16_t kyotocabinet::UINT16MAX = (std::numeric_limits<uint16_t>::max)()

The maximum value of uint16_t.

const uint32_t kyotocabinet::UINT32MAX = (std::numeric_limits<uint32_t>::max)()

The maximum value of uint32_t.

const uint64_t kyotocabinet::UINT64MAX = (std::numeric_limits<uint64_t>::max)()

The maximum value of uint64_t.

const size_t kyotocabinet::SIZEMAX = (std::numeric_limits<size_t>::max)()

The maximum value of size_t.

const float kyotocabinet::FLTMAX = (std::numeric_limits<float>::max)()

The maximum value of float.

const double kyotocabinet::DBLMAX = (std::numeric_limits<double>::max)()

The maximum value of double.

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* const kyotocabinet::OSNAME

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::PAGESIZ

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 = INT32MAX / 2

The maximum memory size for debugging.