ProductPromotion
Logo

C++ Programming

made by https://0x3d.site

GitHub - tboox/tbox: ๐ŸŽ A glib-like multi-platform c library
๐ŸŽ A glib-like multi-platform c library. Contribute to tboox/tbox development by creating an account on GitHub.
Visit Site

GitHub - tboox/tbox: ๐ŸŽ A glib-like multi-platform c library

GitHub - tboox/tbox: ๐ŸŽ A glib-like multi-platform c library

Supporting the project

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. ๐Ÿ™ [Become a sponsor]

Introduction (ไธญๆ–‡)

TBOX is a glib-like cross-platform C library that is simple to use yet powerful in nature.

The project focuses on making C development easier and provides many modules (.e.g stream, coroutine, regex, container, algorithm ...), so that any developer can quickly pick it up and enjoy the productivity boost when developing in C language.

It supports the following platforms: Windows, Macosx, Linux, Android, iOS, *BSD and etc.

And it provides many compiling options using xmake:

  • Release: Disable debug information, assertion, memory checking and enable optimization.
  • Debug: Enable debug information, assertion, memory checking and disable optimization.
  • Small: Disable all extensional modules and enable space optimization.
  • Micro: compiling micro library (~64K) for the embed system.

If you want to know more, please refer to: Documents, Github and Gitee

Features

The stream library

  • Supports file, data, http and socket source
  • Supports the stream filter for gzip, charset and...
  • Implements stream transfer
  • Implements the static buffer stream for parsing data
  • Supports coroutine and implements asynchronous operation

The coroutine library

  • Provides high-performance coroutine switch
  • Supports arm, arm64, x86, x86_64 ..
  • Provides channel interfaces
  • Provides semaphore and lock interfaces
  • Supports io socket and stream operation in coroutine
  • Provides some io servers (http ..) using coroutine
  • Provides stackfull and stackless coroutines
  • Support epoll, kqueue, poll, select and IOCP
  • Support to wait pipe, socket and process in coroutine and poller at same time

The database library

  • Supports mysql and sqlite3 database and enumerates data using the iterator mode

The xml parser library

  • Supports DOM and SAX mode and Supports xpath

The serialization and deserialization library

  • Supports xml, json, bplist, xplist, binary formats

The memory library

  • Implements some memory pools for optimizing memory
  • Supports fast memory error detecting. it can detect the following types of bugs for the debug mode:
    • out-of-bounds accesses to heap and globals
    • use-after-free
    • double-free, invalid free
    • memory leaks

The container library

  • Implements hash table, single list, double list, vector, stack, queue and min/max heap. Supports iterator mode for algorithm

The algorithm library

  • Uses the iterator mode
  • Implements find, binary find and reverse find algorithm
  • Implements sort, bubble sort, quick sort, heap sort and insert sort algorithm
  • Implements count, walk items, reverse walk items, for_all and rfor_all

The network library

  • Implements dns(cached)
  • Implements ssl(openssl, polarssl, mbedtls)
  • Implements http
  • Implements cookies
  • Supports ipv4, ipv6
  • Supports coroutine

The platform library

  • Implements timer, fast and low precision timer
  • Implements atomic and atomic64 operation
  • Implements spinlock, mutex, event, semaphore, thread and thread pool
  • Implements file, socket operation
  • Implements poller using epoll, poll, select, kqueue ...
  • Implements switch context interfaces for coroutine

The charset library

  • Supports utf8, utf16, gbk, gb2312, uc2 and uc4
  • Supports big endian and little endian mode

The zip library

  • Supports gzip, zlibraw, zlib formats using the zlib library if exists
  • Implements lzsw, lz77 and rlc algorithm

The utils library

  • Implements base32, base64 encoder and decoder
  • Implements assert and trace output for the debug mode
  • Implements bits operation for parsing u8, u16, u32, u64 data

The math library

  • Implements random generator
  • Implements fast fixed-point calculation, Supports 6-bits, 16-bits, 30-bits fixed-point number

The libc library

  • Implements lightweight libc library interfaces, the interface name contains tb_xxx prefix for avoiding conflict
  • Implements strixxx strrxxx wcsixxx wcsrxxx interface extension
  • Optimizes some frequently-used interface, .e.g. memset, memcpy, strcpy ...
  • Implements memset_u16, memset_u32, memset_u64 extension interfaces

The libm library

  • Implements lightweight libm library interfaces, the interface name contains tb_xxx prefix for avoiding conflict
  • Supports float and double type

The regex library

  • Supports match and replace
  • Supports global/multiline/caseless mode
  • Uses pcre, pcre2 and posix regex modules

The hash library

  • Implements crc32, adler32, md5 and sha1 hash algorithm
  • Implements some string hash algorithms (.e.g bkdr, fnv32, fnv64, sdbm, djb2, rshash, aphash ...)
  • Implements uuid generator

Projects

Some projects using tbox:

Build (xmake)

Please install xmake first: xmake

# build for the host platform
$ cd ./tbox
$ xmake

# build for the mingw platform
$ cd ./tbox
$ xmake f -p mingw --sdk=/home/mingwsdk
$ xmake

# build for the iphoneos platform
$ cd ./tbox
$ xmake f -p iphoneos
$ xmake

# build for the android platform
$ cd ./tbox
$ xmake f -p android --ndk=xxxxx
$ xmake

# build for the linux cross-platform
$ cd ./tbox
$ xmake f -p linux --sdk=/home/sdk # --bin=/home/sdk/bin
$ xmake

Build (xmake.sh)

$ ./configure
$ make

Example

#include "tbox/tbox.h"

int main(int argc, char** argv) {
    if (!tb_init(tb_null, tb_null)) return 0;

    tb_vector_ref_t vector = tb_vector_init(0, tb_element_str(tb_true));
    if (vector) {
        tb_vector_insert_tail(vector, "hello");
        tb_vector_insert_tail(vector, "tbox");

        tb_for_all (tb_char_t const*, cstr, vector) {
            tb_trace_i("%s", cstr);
        }
        tb_vector_exit(vector);
    }
    tb_exit();
    return 0;
}

Technical Support

You can also consider sponsoring us to get technical support services, [Become a sponsor]

Contacts

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory