Download Latest Version coost c++17 version source code.tar.gz (186.2 kB)
Email in envelope

Get an email when there's a new version of Coost

Home / v3.0.0
Name Modified Size InfoDownloads / Week
Parent folder
coost v3.0.0 released.tar.gz 2022-09-02 313.8 kB
coost v3.0.0 released.zip 2022-09-02 405.0 kB
README.md 2022-09-02 3.6 kB
Totals: 3 Items   722.4 kB 0

New features & improvement

  • Improve cmake scripts and support Conan. Improve export of symbols in shared library. Thanks to SpaceIm.

  • A better JSON library. Support precision control for float point numbers in Json. ```cpp // {"a":23,"b":false,"s":"xx","v":[1,2,3],"o":{"xx":0}} Json x = { { "a", 23 }, { "b", false }, { "s", "xx" }, { "v", {1,2,3} }, { "o", { {"xx", 0} }}, };

// equal to x Json y = Json() .add_member("a", 23) .add_member("b", false) .add_member("s", "xx") .add_member("v", Json().push_back(1).push_back(2).push_back(3)) .add_member("o", Json().add_member("xx", 0));

x.get("a").as_int(); // 23 x.get("s").as_string(); // "xx" x.get("v", 0).as_int(); // 1 x.get("v", 2).as_int(); // 3 x.get("o", "xx").as_int(); // 0 ```

  • Add TLOG to print logs which are grouped by topics. cpp TLOG("rpc") << "hello " << 23; TLOG("xxx") << "hello " << 23;

  • Improve exception handling in co/log on Windows. Thanks to 909254.

  • Remove path from __FILE__ in co/log.

  • Support alias for flag. Add api flag::alias(). cpp DEF_bool(debug, false, ""); // no alias DEF_bool(debug, false, "", d); // d is an alias of debug DEF_bool(debug, false, "", d, dbg); // 2 aliases

  • Ignore non-existing flags in config file.

  • Add --version for co/flag.

  • --help shows only user-defined flags in co/flag by default, and limit flag level to [0-9].

  • Add api flag::set_value() for setting value of a flag.

  • Add log::set_write_cb() to set a callback for writting logs.

  • Add macros __arch64, __arch32, __fname__ and __fnlen__ in co/def.h.

  • Add a fast memory allocator. Provide co::stl_allocator for STL.

  • Provide containers based on co::stl_allocator. See co/stl.h for details.

  • Improve atomic operations, support memory order. Add atomic_cas as an alias of atomic_compare_swap and add atomic_bool_cas.

  • Add nanoid(), md5digest(), sha256() in co/hash.h.

  • Support HTTP protocol for JSON-based RPC framework.

  • Support graceful exit for tcp::Server, http::Server, rpc::Server.

  • Add fs::dir for readding directory.

  • Support + mode for both read and write for fs::file.

  • Support precision control for float point numbers.

```cpp fastream s; s << 3.14159; // "3.14159"

s.clear(); s.maxdp(3) << 3.14159; // "3.141"

s.clear(); s << co::maxdp(2) << 3.14159; // "3.14"

LOG << co::maxdp(2) << 1.234e-7; // "1.23e-7" ```

  • Improve hook on macos with fishhook. Thanks to shuai132.

Changed

  • Remove flag a from co/unitest, run all tests by default.

  • Remove log::init(), log::close(), log::set_single_write_cb().

  • Remove co::init(), co::exit().

  • Rename co::all_schedulers() to co::schedulers().

  • Rename co::Table to co::table.

  • Remove atomic_get, use atomic_load instead.

  • Remove atomic_set, use atomic_store instead.
  • Remove atomic_reset, use atomic_store(&x, 0) instead.

  • Remove err::get(), err::set(), use co::error() instead.

Bugs fixed

Source: README.md, updated 2022-09-02