coost v3.0.0 released
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.
// {"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.
TLOG("rpc") << "hello " << 23; TLOG("xxx") << "hello " << 23;
-
Improve exception handling in
co/log
on Windows. Thanks to 909254. -
Remove path from
__FILE__
inco/log
. -
Support alias for flag. Add api
flag::alias()
.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
forco/flag
. -
--help
shows only user-defined flags inco/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__
inco/def.h
. -
Add a fast memory allocator. Provide
co::stl_allocator
for STL. -
Provide containers based on
co::stl_allocator
. Seeco/stl.h
for details. -
Improve atomic operations, support memory order. Add
atomic_cas
as an alias ofatomic_compare_swap
and addatomic_bool_cas
. -
Add
nanoid()
,md5digest()
,sha256()
inco/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 forfs::file
. -
Support precision control for float point numbers.
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
fromco/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()
toco::schedulers()
. -
Rename
co::Table
toco::table
. -
Remove
atomic_get
, useatomic_load
instead. -
Remove
atomic_set
, useatomic_store
instead. -
Remove
atomic_reset
, useatomic_store(&x, 0)
instead. -
Remove
err::get()
,err::set()
, useco::error()
instead.
Bugs fixed
-
Fix hook for ioctl. Thanks to Itmit.
-
Fix hook for accept & accept4.
-
Fix a bug in
co::Event
.