Kyoto Cabinet: kyotocabinet::TinyArrayList Class Reference

Kyoto Cabinet

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
kyotocabinet::TinyArrayList Class Reference

Memory-saving string array list. More...

`#include <kcmap.h>`

List of all members.

## Public Member Functions
| TinyArrayList ()
| Default constructor.
| ~TinyArrayList ()
| Destructor.
void | push (const char *buf, size_t size)
| Insert a record at the bottom of the list.
bool | pop ()
| Remove a record at the bottom of the list.
void | unshift (const char *buf, size_t size)
| Insert a record at the top of the list.
bool | shift ()
| Remove a record at the top of the list.
void | insert (const char *buf, size_t size, size_t idx)
| Insert a record at the position of the given index of the list.
void | remove (size_t idx)
| Remove a record at the position of the given index of the list.
const char * | get (size_t idx, size_t *sp)
| Retrieve a record at the position of the given index of the list.
void | clear ()
| Remove all records.
size_t | count ()
| Get the number of records.

## Detailed Description

Memory-saving string array list.

## Constructor & Destructor Documentation

kyotocabinet::TinyArrayList::TinyArrayList | ( |  | ) | `[explicit]`

Default constructor.

kyotocabinet::TinyArrayList::~TinyArrayList | ( |  | ) |

Destructor.

## Member Function Documentation

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

Insert a record at the bottom of the list.

Parameters:

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

bool kyotocabinet::TinyArrayList::pop | ( |  | ) |

Remove a record at the bottom of the list.

Returns:
  true if the operation success, or false if there is no record in the list.

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

Insert a record at the top of the list.

Parameters:

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

bool kyotocabinet::TinyArrayList::shift | ( |  | ) |

Remove a record at the top of the list.

Returns:
  true if the operation success, or false if there is no record in the list.

void kyotocabinet::TinyArrayList::insert | ( | const char * | buf,
|  | size_t | size,
|  | size_t | idx
| ) |  |

Insert a record at the position of the given index of the list.

Parameters:

  buf | the pointer to the record region.
  size | the size of the record region.
  idx | the index of the position. It must be equal to or less than the number of records.

void kyotocabinet::TinyArrayList::remove | ( | size_t | idx | ) |

Remove a record at the position of the given index of the list.

Parameters:

  idx | the index of the position. It must be less than the number of records.

const char* kyotocabinet::TinyArrayList::get | ( | size_t | idx,
|  | size_t * | sp
| ) |  |

Retrieve a record at the position of the given index of the list.

Parameters:

  idx | the index of the position. It must be less than the number of records.
  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 retrieved record.

void kyotocabinet::TinyArrayList::clear | ( |  | ) |

Remove all records.

size_t kyotocabinet::TinyArrayList::count | ( |  | ) |

Get the number of records.

Returns:
  the number of records.