qLibc Project

WE'VE MODED

We've moved to https://github.com/wolkykim/qlibc Please check out out new home for the latest updates.

What's qLibc?

The goal of qLibc project is to provide a simple but powerful general purpose C/C++ library which includes all kinds of containers and general library routines. It provides ready-made set of common container APIs with constant look that can be used with any built-in types and with any user-defined types.

qLibc Copyright

All of the deliverable code in qLibc has been dedicated to the public domain by the authors. Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original qLibc code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

All of the deliverable code in qLibc has been written from scratch (except of MD5 code published by RSA Data Security, Inc). No code has been taken from other projects or from the open internet. Every line of code can be traced back to its original author. So the qLibc code base is clean and is not contaminated with licensed code from other projects.

Features

Constant Look

All container APIs have constant look, basically it provides a creator function which usually returns a pointer of a container structure. And every functions related to the container can be accessed through function pointers inside of the container.

So regardless of what container you use, you can simple put elements into list like pContainer->put(pContainer, ...). It looks like C++ class but it's pure C implementation. Of course it works with both of your C and C++ codes.

We used this concept as much as possible because it simplifies the thinking way and helps to improve readability. Consequently it helps people to write bugless codes more easily.

See the example below to see how it works.

// create a hash-table with hash range 100.
// Hash range does NOT mean maximum number of elements. Refer API doc.
qhashtbl_t *tbl = qhashtbl(100);
 
// add an element which key name is "score".
int x = 12345;
tbl->put(tbl, "score", &x, sizeof(int));
 
// get the value of the element.
int *px = tbl->get(tbl, "score", NULL, true);
if(px != NULL) {
        printf("%d\n", *px);             
        free(px);
}
 
// release table
tbl->free(tbl);

Here is a same implementation of above code but using Linked-List-Table container.

// create a linked-list-table.
qlisttbl_t *tbl = qlisttbl();
 
// add an element which key name is "score".
int x = 12345;
tbl->put(tbl, "score", &x, sizeof(int), true);
 
// get the value of the element.
int *px = tbl->get(tbl, "score", NULL, true);
if(px != NULL) {
        printf("%d\n", *px);             
        free(px);
}
 
// release table
tbl->free(tbl);

Compatible Platforms

  • Operating System : Linux, FreeBSD and most of Unix-like systems.
 
qlibc.txt · Last modified: 2014/03/22 09:16 by Seungyoung Kim