Kyoto Tycoon

- Main Page
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Typedefs | Functions | Variables
kyototycoon Namespace Reference

All symbols of Kyoto Tycoon. More...

## Classes
class | MapReduce
| MapReduce framework. More...
class | URL
| URL accessor. More...
class | HTTPClient
| HTTP client. More...
class | HTTPServer
| HTTP server. More...
class | PluggableDB
| Interface of pluggable database abstraction. More...
class | PluggableServer
| Interface of pluggable server abstraction. More...
class | RemoteDB
| Remote database. More...
class | ReplicationClient
| Replication client. More...
class | RPCClient
| RPC client. More...
class | RPCServer
| RPC server. More...
class | SharedLibrary
| Shared library. More...
class | Pollable
| Interface of poolable I/O event. More...
class | Socket
| Network stream abstraction based on TCP/IP. More...
class | ServerSocket
| Network server abstraction based on TCP/IP. More...
class | Poller
| I/O event notification. More...
class | ThreadedServer
| Threaded TCP Server. More...
class | TimedDB
| Timed database. More...
class | UpdateLogger
| Update logger. More...
## Typedefs
typedef PluggableDB *(* | KTDBINIT )()
| Initializer of a database implementation.
typedef PluggableServer *(* | KTSERVINIT )()
| Initializer of a server implementation.
## Functions
bool | setkillsignalhandler (void(*handler)(int))
| Set the signal handler for termination signals.
bool | maskthreadsignal ()
| Set the signal mask of the current to ignore all.
bool | daemonize ()
| Switch the process into the background.
int32_t | executecommand (const std::vector< std::string > &args)
| Execute a shell command.
const char * | strmapget (const std::map< std::string, std::string > &map, const char *key, size_t *sp=NULL)
| Get the C-style string value of a record in a string map.
void | printstrvec (const std::vector< std::string > &vec, std::ostream &strm=std::cout)
| Print all records in a string vector.
void | printstrmap (const std::map< std::string, std::string > &map, std::ostream &strm=std::cout)
| Print all records in a string map.
void | urlbreak (const char *url, std::map< std::string, std::string > *elems)
| Break up a URL into elements.
char * | xmlescape (const char *str)
| Escape meta characters in a string with the entity references of XML.
char * | xmlunescape (const char *str)
| Unescape meta characters in a string with the entity references of XML.
void | wwwformtomap (const std::string &str, std::map< std::string, std::string > *map)
| Parse a www-form-urlencoded string and store each records into a map.
void | maptowwwform (const std::map< std::string, std::string > &map, std::string *str)
| Serialize a string map into a www-form-urlencoded string.
void | tsvtomap (const std::string &str, std::map< std::string, std::string > *map)
| Parse a TSV string and store each records into a map.
void | maptotsv (const std::map< std::string, std::string > &map, std::string *str)
| Serialize a string map into a TSV string.
void | tsvmapencode (std::map< std::string, std::string > *map, int32_t mode)
| Encode each record of a string map.
void | tsvmapdecode (std::map< std::string, std::string > *map, int32_t mode)
| Decode each record of a string map.
int32_t | checkmapenc (const std::map< std::string, std::string > &map)
| Check the best suited encoding of a string map.
char * | strcapitalize (char *str)
| Capitalize letters of a string.
bool | strisalnum (const char *str)
| Check a string is composed of alphabets or numbers only.
void | strtokenize (const char *str, std::vector< std::string > *tokens)
| Tokenize a string separating by space characters.
void | getcalendar (int64_t t, int32_t jl, int32_t *yearp=NULL, int32_t *monp=NULL, int32_t *dayp=NULL, int32_t *hourp=NULL, int32_t *minp=NULL, int32_t *secp=NULL)
| Get the Gregorian calendar of a time.
void | datestrwww (int64_t t, int32_t jl, char *buf)
| Format a date as a string in W3CDTF.
void | datestrwww (double t, int32_t jl, int32_t acr, char *buf)
| Format a date as a string in W3CDTF with the fraction part.
void | datestrhttp (int64_t t, int32_t jl, char *buf)
| Format a date as a string in RFC 1123 format.
int64_t | strmktime (const char *str)
| Get the time value of a date string.
int32_t | jetlag ()
| Get the jet lag of the local time.
int32_t | dayofweek (int32_t year, int32_t mon, int32_t day)
| Get the day of week of a date.
bool | getlocaltime (time_t time, struct std::tm *result)
| Get the local time of a time.
bool | getgmtime (time_t time, struct std::tm *result)
| Get the GMT local time of a time.
time_t | mkgmtime (struct std::tm *tm)
| Make the GMT from a time structure.
## Variables
const char *const | KTDBINITNAME = "ktdbinit"
| The name of the initializer function.
const char *const | KTSERVINITNAME = "ktservinit"
| The name of the initializer function.
const char *const | VERSION
| The package version.
const int32_t | LIBVER
| The library version.
const int32_t | LIBREV
| The library revision.
const char *const | FEATURES
| The extra feature list.
const int32_t | DEFPORT = 1978
| The default port number.

## Detailed Description

All symbols of Kyoto Tycoon.

Common namespace of Kyoto Tycoon.

## Typedef Documentation

typedef PluggableDB*(* kyototycoon::KTDBINIT)()

Initializer of a database implementation.

Note:
  Each shared library of a pluggable database module must implement a function whose name is "ktdbinit" and return a new instance of a derived class of the PluggableDB class. The instance will be deleted implicitly by the caller.

typedef PluggableServer*(* kyototycoon::KTSERVINIT)()

Initializer of a server implementation.

Note:
  Each shared library of a pluggable server module must implement a function whose name is "ktservinit" and return a new instance of a derived class of the PluggableServer class. The instance will be deleted implicitly by the caller.

## Function Documentation

bool kyototycoon::setkillsignalhandler | ( | void(*)(int) | handler | ) |

Set the signal handler for termination signals.

Parameters:

  handler | the function pointer of the signal handler.

Returns:
  true on success, or false on failure.

bool kyototycoon::maskthreadsignal | ( |  | ) |

Set the signal mask of the current to ignore all.

Returns:
  true on success, or false on failure.

bool kyototycoon::daemonize | ( |  | ) |

Switch the process into the background.

Returns:
  true on success, or false on failure.

int32_t kyototycoon::executecommand | ( | const std::vector< std::string > & | args | ) |

Execute a shell command.

Parameters:

  args | an array of the command name and its arguments.

Returns:
  the exit code of the command or `INT32_MIN' on failure.

Note:
  The command name and the arguments are quoted and meta characters are escaped.

const char * kyototycoon::strmapget | ( | const std::map< std::string, std::string > & | map,
|  | const char * | key,
|  | size_t * | sp = `NULL`
| ) |  |

Get the C-style string value of a record in a string map.

Parameters:

  map | the target string map.
  key | the key.
  sp | the pointer to the variable into which the size of the region of the return value is assigned. If it is NULL, it is ignored.

Returns:
  the C-style string value of the corresponding record, or NULL if there is no corresponding record.

void kyototycoon::printstrvec | ( | const std::vector< std::string > & | vec,
|  | std::ostream & | strm = `std::cout`
| ) |  |

Print all records in a string vector.

Parameters:

  vec | the target string vector.
  strm | the output stream.

void kyototycoon::printstrmap | ( | const std::map< std::string, std::string > & | map,
|  | std::ostream & | strm = `std::cout`
| ) |  |

Print all records in a string map.

Parameters:

  map | the target string map.
  strm | the output stream.

void kyototycoon::urlbreak | ( | const char * | url,
|  | std::map< std::string, std::string > * | elems
| ) |  |

Break up a URL into elements.

Parameters:

  url | the URL string.
  elems | the map object to contain the result elements. The key "self" indicates the URL itself. "scheme" indicates the scheme. "host" indicates the host of the server. "port" indicates the port number of the server. "authority" indicates the authority information. "path" indicates the path of the resource. "file" indicates the file name without the directory section. "query" indicates the query string. "fragment" indicates the fragment string.

Note:
  Supported schema are HTTP, HTTPS, FTP, and FILE. Both of absolute URL and relative URL are supported.

char * kyototycoon::xmlescape | ( | const char * | str | ) |

Escape meta characters in a string with the entity references of XML.

Parameters:

  str | the string.

Returns:
  the escaped 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 * kyototycoon::xmlunescape | ( | const char * | str | ) |

Unescape meta characters in a string with the entity references of XML.

Parameters:

  str | the string.

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

void kyototycoon::wwwformtomap | ( | const std::string & | str,
|  | std::map< std::string, std::string > * | map
| ) |  |

Parse a www-form-urlencoded string and store each records into a map.

Parameters:

  str | the source string.
  map | the destination string map.

void kyototycoon::maptowwwform | ( | const std::map< std::string, std::string > & | map,
|  | std::string * | str
| ) |  |

Serialize a string map into a www-form-urlencoded string.

Parameters:

  map | the source string map.
  str | the destination string.

void kyototycoon::tsvtomap | ( | const std::string & | str,
|  | std::map< std::string, std::string > * | map
| ) |  |

Parse a TSV string and store each records into a map.

Parameters:

  str | the source string.
  map | the destination string map.

void kyototycoon::maptotsv | ( | const std::map< std::string, std::string > & | map,
|  | std::string * | str
| ) |  |

Serialize a string map into a TSV string.

Parameters:

  map | the source string map.
  str | the destination string.

void kyototycoon::tsvmapencode | ( | std::map< std::string, std::string > * | map,
|  | int32_t | mode
| ) |  |

Encode each record of a string map.

Parameters:

  map | the string map.
  mode | the encoding mode. 'B' for Base64 encoding, 'Q' for Quoted-printable encoding, 'U' for URL encoding.

void kyototycoon::tsvmapdecode | ( | std::map< std::string, std::string > * | map,
|  | int32_t | mode
| ) |  |

Decode each record of a string map.

Parameters:

  map | the string map.
  mode | the encoding mode. 'B' for Base64 encoding, 'Q' for Quoted-printable encoding, 'U' for URL encoding.

int32_t kyototycoon::checkmapenc | ( | const std::map< std::string, std::string > & | map | ) |

Check the best suited encoding of a string map.

Parameters:

  map | the string map.

Returns:
  the the best suited encoding. 0 for the raw format, 'B' for Base64 encoding, 'Q' for Quoted-printable encoding,

char * kyototycoon::strcapitalize | ( | char * | str | ) |

Capitalize letters of a string.

Parameters:

  str | the string to convert.

Returns:
  the string itself.

bool kyototycoon::strisalnum | ( | const char * | str | ) |

Check a string is composed of alphabets or numbers only.

Returns:
  true if it is composed of alphabets or numbers only, or false if not.

void kyototycoon::strtokenize | ( | const char * | str,
|  | std::vector< std::string > * | tokens
| ) |  |

Tokenize a string separating by space characters.

Parameters:

  str | the source string.
  tokens | a string vector to contain the result tokens.

void kyototycoon::getcalendar | ( | int64_t | t,
|  | int32_t | jl,
|  | int32_t * | yearp = `NULL`,
|  | int32_t * | monp = `NULL`,
|  | int32_t * | dayp = `NULL`,
|  | int32_t * | hourp = `NULL`,
|  | int32_t * | minp = `NULL`,
|  | int32_t * | secp = `NULL`
| ) |  |

Get the Gregorian calendar of a time.

Parameters:

  t | the source time in seconds from the epoch. If it is kyotocabinet::INT64MAX, the current time is specified.
  jl | the jet lag of a location in seconds. If it is kyotocabinet::INT32MAX, the local jet lag is specified.
  yearp | the pointer to a variable to which the year is assigned. If it is NULL, it is not used.
  monp | the pointer to a variable to which the month is assigned. If it is NULL, it is not used. 1 means January and 12 means December.
  dayp | the pointer to a variable to which the day of the month is assigned. If it is NULL, it is not used.
  hourp | the pointer to a variable to which the hours is assigned. If it is NULL, it is not used.
  minp | the pointer to a variable to which the minutes is assigned. If it is NULL, it is not used.
  secp | the pointer to a variable to which the seconds is assigned. If it is NULL, it is not used.

void kyototycoon::datestrwww | ( | int64_t | t,
|  | int32_t | jl,
|  | char * | buf
| ) |  |

Format a date as a string in W3CDTF.

Parameters:

  t | the source time in seconds from the epoch. If it is kyotocabinet::INT64MAX, the current time is specified.
  jl | the jet lag of a location in seconds. If it is kyotocabinet::INT32MAX, the local jet lag is specified.
  buf | the pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.

void kyototycoon::datestrwww | ( | double | t,
|  | int32_t | jl,
|  | int32_t | acr,
|  | char * | buf
| ) |  |

Format a date as a string in W3CDTF with the fraction part.

Parameters:

  t | the source time in seconds from the epoch. If it is Not-a-Number, the current time is specified.
  jl | the jet lag of a location in seconds. If it is kyotocabinet::INT32MAX, the local jet lag is specified.
  acr | the accuracy of time by the number of columns of the fraction part.
  buf | the pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.

void kyototycoon::datestrhttp | ( | int64_t | t,
|  | int32_t | jl,
|  | char * | buf
| ) |  |

Format a date as a string in RFC 1123 format.

Parameters:

  t | the source time in seconds from the epoch. If it is kyotocabinet::INT64MAX, the current time is specified.
  jl | the jet lag of a location in seconds. If it is kyotocabinet::INT32MAX, the local jet lag is specified.
  buf | the pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.

int64_t kyototycoon::strmktime | ( | const char * | str | ) |

Get the time value of a date string.

Parameters:

  str | the date string in decimal, hexadecimal, W3CDTF, or RFC 822 (1123). Decimal can be trailed by "s" for in seconds, "m" for in minutes, "h" for in hours, and "d" for in days.

Returns:
  the time value of the date or INT64_MIN if the format is invalid.

int32_t kyototycoon::jetlag | ( |  | ) |

Get the jet lag of the local time.

Returns:
  the jet lag of the local time in seconds.

int32_t kyototycoon::dayofweek | ( | int32_t | year,
|  | int32_t | mon,
|  | int32_t | day
| ) |  |

Get the day of week of a date.

Parameters:

  year | the year of a date.
  mon | the month of the date.
  day | the day of the date.

Returns:
  the day of week of the date. 0 means Sunday and 6 means Saturday.

bool kyototycoon::getlocaltime | ( | time_t | time,
|  | struct std::tm * | result
| ) |  |

Get the local time of a time.

Parameters:

  time | the time.
  result | the resulb buffer.

Returns:
  true on success, or false on failure.

bool kyototycoon::getgmtime | ( | time_t | time,
|  | struct std::tm * | result
| ) |  |

Get the GMT local time of a time.

Parameters:

  time | the time.
  result | the resulb buffer.

Returns:
  true on success, or false on failure.

time_t kyototycoon::mkgmtime | ( | struct std::tm * | tm | ) |

Make the GMT from a time structure.

Parameters:

  tm | the pointer to the time structure.

Returns:
  the GMT.

## Variable Documentation

const char* const kyototycoon::KTDBINITNAME = "ktdbinit"

The name of the initializer function.

const char* const kyototycoon::KTSERVINITNAME = "ktservinit"

The name of the initializer function.

const char* const kyototycoon::VERSION

The package version.

const int32_t kyototycoon::LIBVER

The library version.

const int32_t kyototycoon::LIBREV

The library revision.

const char* const kyototycoon::FEATURES

The extra feature list.

const int32_t kyototycoon::DEFPORT = 1978

The default port number.