From 957e5e891ae8914effecb0f9a9dfebd9bd81fe46 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 24 Jan 2019 14:06:05 +0100 Subject: [PATCH] updated doc: v1.13.0 --- README_8md_source.html | 4 +- annotated.html | 17 +- async_8hpp_source.html | 2 +- check_8hpp_source.html | 2 +- classes.html | 20 +- classuvw_1_1AsyncHandle-members.html | 2 +- classuvw_1_1AsyncHandle.html | 2 +- classuvw_1_1AsyncHandle__coll__graph.png | Bin 19910 -> 21717 bytes classuvw_1_1AsyncHandle__inherit__graph.png | Bin 19910 -> 21717 bytes classuvw_1_1CheckHandle-members.html | 2 +- classuvw_1_1CheckHandle.html | 2 +- classuvw_1_1CheckHandle__coll__graph.png | Bin 19310 -> 21403 bytes classuvw_1_1CheckHandle__inherit__graph.png | Bin 19310 -> 21403 bytes classuvw_1_1Emitter-members.html | 2 +- classuvw_1_1Emitter.html | 2 +- classuvw_1_1Emitter__inherit__graph.png | Bin 10474 -> 11199 bytes classuvw_1_1FileReq-members.html | 2 +- classuvw_1_1FileReq.html | 2 +- classuvw_1_1FileReq__coll__graph.png | Bin 3437 -> 3802 bytes classuvw_1_1FileReq__inherit__graph.png | Bin 3437 -> 3802 bytes classuvw_1_1Flags-members.html | 2 +- classuvw_1_1Flags.html | 2 +- classuvw_1_1FsEventHandle-members.html | 2 +- classuvw_1_1FsEventHandle.html | 2 +- classuvw_1_1FsEventHandle__coll__graph.png | Bin 19255 -> 20236 bytes classuvw_1_1FsEventHandle__inherit__graph.png | Bin 19255 -> 20236 bytes classuvw_1_1FsPollHandle-members.html | 2 +- classuvw_1_1FsPollHandle.html | 2 +- classuvw_1_1FsPollHandle__coll__graph.png | Bin 17497 -> 19005 bytes classuvw_1_1FsPollHandle__inherit__graph.png | Bin 17497 -> 19005 bytes classuvw_1_1FsReq-members.html | 2 +- classuvw_1_1FsReq.html | 2 +- classuvw_1_1FsReq__coll__graph.png | Bin 3402 -> 3726 bytes classuvw_1_1FsReq__inherit__graph.png | Bin 3402 -> 3726 bytes classuvw_1_1FsRequest-members.html | 2 +- classuvw_1_1FsRequest.html | 2 +- classuvw_1_1GetAddrInfoReq-members.html | 2 +- classuvw_1_1GetAddrInfoReq.html | 2 +- classuvw_1_1GetNameInfoReq-members.html | 2 +- classuvw_1_1GetNameInfoReq.html | 2 +- classuvw_1_1Handle-members.html | 2 +- classuvw_1_1Handle.html | 2 +- classuvw_1_1Handle__coll__graph.png | Bin 11850 -> 12409 bytes classuvw_1_1Handle__inherit__graph.png | Bin 16212 -> 17026 bytes classuvw_1_1IdleHandle-members.html | 2 +- classuvw_1_1IdleHandle.html | 2 +- classuvw_1_1IdleHandle__coll__graph.png | Bin 15239 -> 16342 bytes classuvw_1_1IdleHandle__inherit__graph.png | Bin 15239 -> 16342 bytes classuvw_1_1Loop-members.html | 2 +- classuvw_1_1Loop.html | 2 +- classuvw_1_1Loop__coll__graph.png | Bin 3395 -> 3758 bytes classuvw_1_1Loop__inherit__graph.png | Bin 3395 -> 3758 bytes classuvw_1_1PipeHandle-members.html | 2 +- classuvw_1_1PipeHandle.html | 2 +- classuvw_1_1PipeHandle__coll__graph.png | Bin 21710 -> 23309 bytes classuvw_1_1PipeHandle__inherit__graph.png | Bin 21710 -> 23309 bytes classuvw_1_1PollHandle-members.html | 2 +- classuvw_1_1PollHandle.html | 2 +- classuvw_1_1PollHandle__coll__graph.png | Bin 16454 -> 17660 bytes classuvw_1_1PollHandle__inherit__graph.png | Bin 16454 -> 17660 bytes classuvw_1_1PrepareHandle-members.html | 2 +- classuvw_1_1PrepareHandle.html | 2 +- classuvw_1_1PrepareHandle__coll__graph.png | Bin 16793 -> 18395 bytes classuvw_1_1PrepareHandle__inherit__graph.png | Bin 16793 -> 18395 bytes classuvw_1_1ProcessHandle-members.html | 2 +- classuvw_1_1ProcessHandle.html | 2 +- classuvw_1_1ProcessHandle__coll__graph.png | Bin 20042 -> 22095 bytes classuvw_1_1ProcessHandle__inherit__graph.png | Bin 20042 -> 22095 bytes classuvw_1_1Resource-members.html | 2 +- classuvw_1_1Resource.html | 2 +- classuvw_1_1Resource__coll__graph.png | Bin 8163 -> 8438 bytes classuvw_1_1Resource__inherit__graph.png | Bin 13430 -> 14072 bytes classuvw_1_1SharedLib-members.html | 2 +- classuvw_1_1SharedLib.html | 2 +- classuvw_1_1SharedLib__coll__graph.png | Bin 5483 -> 6104 bytes classuvw_1_1SharedLib__inherit__graph.png | Bin 5483 -> 6104 bytes classuvw_1_1SignalHandle-members.html | 2 +- classuvw_1_1SignalHandle.html | 2 +- classuvw_1_1SignalHandle__coll__graph.png | Bin 19608 -> 21062 bytes classuvw_1_1SignalHandle__inherit__graph.png | Bin 19608 -> 21062 bytes classuvw_1_1StreamHandle-members.html | 2 +- classuvw_1_1StreamHandle.html | 2 +- classuvw_1_1StreamHandle__coll__graph.png | Bin 16251 -> 17016 bytes classuvw_1_1StreamHandle__inherit__graph.png | Bin 16251 -> 17016 bytes classuvw_1_1TCPHandle-members.html | 2 +- classuvw_1_1TCPHandle.html | 2 +- classuvw_1_1TCPHandle__coll__graph.png | Bin 22823 -> 24969 bytes classuvw_1_1TCPHandle__inherit__graph.png | Bin 22823 -> 24969 bytes classuvw_1_1TTYHandle-members.html | 2 +- classuvw_1_1TTYHandle.html | 2 +- classuvw_1_1TTYHandle__coll__graph.png | Bin 21935 -> 23103 bytes classuvw_1_1TTYHandle__inherit__graph.png | Bin 21935 -> 23103 bytes classuvw_1_1TimerHandle-members.html | 2 +- classuvw_1_1TimerHandle.html | 2 +- classuvw_1_1TimerHandle__coll__graph.png | Bin 16082 -> 17135 bytes classuvw_1_1TimerHandle__inherit__graph.png | Bin 16082 -> 17135 bytes classuvw_1_1UDPHandle-members.html | 2 +- classuvw_1_1UDPHandle.html | 2 +- classuvw_1_1UDPHandle__coll__graph.png | Bin 16619 -> 18018 bytes classuvw_1_1UDPHandle__inherit__graph.png | Bin 16619 -> 18018 bytes classuvw_1_1UnderlyingType-members.html | 2 +- classuvw_1_1UnderlyingType.html | 2 +- ...suvw_1_1UnderlyingType__inherit__graph.png | Bin 10078 -> 10844 bytes classuvw_1_1WorkReq-members.html | 2 +- classuvw_1_1WorkReq.html | 2 +- dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- dir_98934c98f70735fe3a272005a9eb8736.html | 2 +- dns_8hpp_source.html | 8 +- emitter_8hpp_source.html | 2 +- fs_8hpp_source.html | 2 +- fs__event_8hpp_source.html | 2 +- fs__poll_8hpp_source.html | 2 +- functions.html | 2 +- functions_b.html | 2 +- functions_c.html | 2 +- functions_d.html | 2 +- functions_e.html | 2 +- functions_f.html | 2 +- functions_func.html | 2 +- functions_func_b.html | 2 +- functions_func_c.html | 2 +- functions_func_d.html | 2 +- functions_func_e.html | 2 +- functions_func_f.html | 2 +- functions_func_g.html | 2 +- functions_func_h.html | 2 +- functions_func_i.html | 2 +- functions_func_k.html | 2 +- functions_func_l.html | 2 +- functions_func_m.html | 5 +- functions_func_n.html | 2 +- functions_func_o.html | 2 +- functions_func_p.html | 2 +- functions_func_q.html | 2 +- functions_func_r.html | 7 +- functions_func_s.html | 7 +- functions_func_t.html | 2 +- functions_func_u.html | 5 +- functions_func_v.html | 77 ++++++ functions_func_w.html | 2 +- functions_g.html | 2 +- functions_h.html | 2 +- functions_i.html | 2 +- functions_k.html | 2 +- functions_l.html | 2 +- functions_m.html | 5 +- functions_n.html | 2 +- functions_o.html | 2 +- functions_p.html | 2 +- functions_q.html | 2 +- functions_r.html | 7 +- functions_s.html | 5 +- functions_t.html | 2 +- functions_u.html | 5 +- functions_v.html | 77 ++++++ functions_vars.html | 2 +- functions_w.html | 2 +- graph_legend.html | 2 +- graph_legend.png | Bin 19465 -> 20323 bytes handle_8hpp_source.html | 4 +- hierarchy.html | 133 +++++----- idle_8hpp_source.html | 2 +- index.html | 6 +- inherit_graph_0.png | Bin 1029 -> 1109 bytes inherit_graph_1.png | Bin 1565 -> 1721 bytes inherit_graph_10.png | Bin 1190 -> 1325 bytes inherit_graph_11.png | Bin 1369 -> 1502 bytes inherit_graph_12.png | Bin 1208 -> 1372 bytes inherit_graph_13.png | Bin 2859 -> 3095 bytes inherit_graph_14.png | Bin 3037 -> 3330 bytes inherit_graph_15.png | Bin 1539 -> 1705 bytes inherit_graph_16.png | Bin 2033 -> 2224 bytes inherit_graph_17.png | Bin 2990 -> 3450 bytes inherit_graph_18.png | Bin 2989 -> 3411 bytes inherit_graph_19.png | Bin 2930 -> 3387 bytes inherit_graph_2.png | Bin 1623 -> 1758 bytes inherit_graph_20.png | Bin 3262 -> 3774 bytes inherit_graph_21.png | Bin 3501 -> 4004 bytes inherit_graph_22.png | Bin 3212 -> 3626 bytes inherit_graph_23.png | Bin 2894 -> 3377 bytes inherit_graph_24.png | Bin 3093 -> 3453 bytes inherit_graph_25.png | Bin 1492 -> 1669 bytes inherit_graph_26.png | Bin 1207 -> 1341 bytes inherit_graph_27.png | Bin 1250 -> 1444 bytes inherit_graph_28.png | Bin 1403 -> 1590 bytes inherit_graph_29.png | Bin 2346 -> 2552 bytes inherit_graph_3.png | Bin 1515 -> 1730 bytes inherit_graph_30.png | Bin 2231 -> 2402 bytes inherit_graph_31.png | Bin 1704 -> 1938 bytes inherit_graph_32.png | Bin 2103 -> 2408 bytes inherit_graph_33.png | Bin 2141 -> 2519 bytes inherit_graph_34.png | Bin 1164 -> 1363 bytes inherit_graph_35.png | Bin 1776 -> 1987 bytes inherit_graph_36.png | Bin 930 -> 1030 bytes inherit_graph_37.png | Bin 1012 -> 1126 bytes inherit_graph_38.png | Bin 1270 -> 1456 bytes inherit_graph_39.png | Bin 1559 -> 1788 bytes inherit_graph_4.png | Bin 1538 -> 1682 bytes inherit_graph_40.png | Bin 1229 -> 1339 bytes inherit_graph_41.png | Bin 1284 -> 1438 bytes inherit_graph_42.png | Bin 1444 -> 1671 bytes inherit_graph_43.png | Bin 1403 -> 1578 bytes inherit_graph_44.png | Bin 1656 -> 1872 bytes inherit_graph_45.png | Bin 1771 -> 2007 bytes inherit_graph_46.png | Bin 1209 -> 1430 bytes inherit_graph_47.png | Bin 1468 -> 1702 bytes inherit_graph_48.map | 2 +- inherit_graph_48.md5 | 2 +- inherit_graph_48.png | Bin 3096 -> 1432 bytes inherit_graph_49.map | 2 +- inherit_graph_49.md5 | 2 +- inherit_graph_49.png | Bin 2919 -> 3499 bytes inherit_graph_5.png | Bin 1492 -> 1617 bytes inherit_graph_50.map | 4 +- inherit_graph_50.md5 | 2 +- inherit_graph_50.png | Bin 10426 -> 3235 bytes inherit_graph_51.map | 6 +- inherit_graph_51.md5 | 2 +- inherit_graph_51.png | Bin 8900 -> 11048 bytes inherit_graph_52.map | 6 +- inherit_graph_52.md5 | 2 +- inherit_graph_52.png | Bin 9180 -> 9651 bytes inherit_graph_53.map | 6 +- inherit_graph_53.md5 | 2 +- inherit_graph_53.png | Bin 12085 -> 9703 bytes inherit_graph_54.map | 6 +- inherit_graph_54.md5 | 2 +- inherit_graph_54.png | Bin 11905 -> 13212 bytes inherit_graph_55.map | 4 +- inherit_graph_55.md5 | 2 +- inherit_graph_55.png | Bin 2746 -> 12968 bytes inherit_graph_56.map | 2 +- inherit_graph_56.md5 | 2 +- inherit_graph_56.png | Bin 2792 -> 3118 bytes inherit_graph_57.map | 2 +- inherit_graph_57.md5 | 2 +- inherit_graph_57.png | Bin 3237 -> 3082 bytes inherit_graph_58.map | 2 +- inherit_graph_58.md5 | 2 +- inherit_graph_58.png | Bin 3235 -> 3700 bytes inherit_graph_59.map | 4 +- inherit_graph_59.md5 | 2 +- inherit_graph_59.png | Bin 9803 -> 3530 bytes inherit_graph_6.png | Bin 1381 -> 1501 bytes inherit_graph_60.map | 5 +- inherit_graph_60.md5 | 2 +- inherit_graph_60.png | Bin 3821 -> 11020 bytes inherit_graph_61.map | 5 +- inherit_graph_61.md5 | 2 +- inherit_graph_61.png | Bin 10568 -> 4557 bytes inherit_graph_62.map | 4 +- inherit_graph_62.md5 | 2 +- inherit_graph_62.png | Bin 2677 -> 11934 bytes inherit_graph_63.map | 2 +- inherit_graph_63.md5 | 2 +- inherit_graph_63.png | Bin 4085 -> 2983 bytes inherit_graph_64.map | 82 +------ inherit_graph_64.md5 | 2 +- inherit_graph_64.png | Bin 304215 -> 4459 bytes inherit_graph_65.map | 84 ++++++- inherit_graph_65.md5 | 2 +- inherit_graph_65.png | Bin 10119 -> 314528 bytes inherit_graph_66.map | 6 +- inherit_graph_66.md5 | 2 +- inherit_graph_66.png | Bin 9778 -> 10938 bytes inherit_graph_67.map | 4 +- inherit_graph_67.md5 | 2 +- inherit_graph_67.png | Bin 1206 -> 10526 bytes inherit_graph_68.map | 2 +- inherit_graph_68.md5 | 2 +- inherit_graph_68.png | Bin 1618 -> 1293 bytes inherit_graph_69.map | 2 +- inherit_graph_69.md5 | 2 +- inherit_graph_69.png | Bin 1527 -> 1722 bytes inherit_graph_7.png | Bin 1433 -> 1635 bytes inherit_graph_70.map | 2 +- inherit_graph_70.md5 | 2 +- inherit_graph_70.png | Bin 1582 -> 1672 bytes inherit_graph_71.map | 2 +- inherit_graph_71.md5 | 2 +- inherit_graph_71.png | Bin 1636 -> 1783 bytes inherit_graph_72.map | 2 +- inherit_graph_72.md5 | 2 +- inherit_graph_72.png | Bin 1422 -> 1777 bytes inherit_graph_73.map | 3 + inherit_graph_73.md5 | 1 + inherit_graph_73.png | Bin 0 -> 1605 bytes inherit_graph_8.png | Bin 2238 -> 2378 bytes inherit_graph_9.png | Bin 2401 -> 2791 bytes inherits.html | 57 +++-- lib_8hpp_source.html | 2 +- loop_8hpp_source.html | 2 +- menudata.js | 2 + namespacemembers.html | 2 +- namespacemembers_type.html | 2 +- namespacemembers_vars.html | 2 +- namespaces.html | 2 +- namespaceuvw.html | 5 +- pipe_8hpp_source.html | 4 +- poll_8hpp_source.html | 2 +- prepare_8hpp_source.html | 2 +- process_8hpp_source.html | 2 +- request_8hpp_source.html | 2 +- resource_8hpp_source.html | 2 +- search/all_10.js | 1 + search/all_11.js | 3 +- search/all_13.js | 1 + search/all_14.js | 12 +- search/all_15.html | 26 ++ search/all_15.js | 14 ++ search/all_b.js | 1 + search/classes_10.js | 1 + search/functions_10.js | 1 + search/functions_11.js | 3 +- search/functions_13.js | 1 + search/functions_14.js | 7 +- search/functions_15.html | 26 ++ search/functions_15.js | 9 + search/functions_b.js | 1 + search/searchdata.js | 4 +- signal_8hpp_source.html | 2 +- stream_8hpp_source.html | 2 +- structuvw_1_1Addr-members.html | 2 +- structuvw_1_1Addr.html | 8 +- structuvw_1_1AddrInfoEvent-members.html | 2 +- structuvw_1_1AddrInfoEvent.html | 2 +- structuvw_1_1AsyncEvent.html | 2 +- structuvw_1_1BaseHandle-members.html | 2 +- structuvw_1_1BaseHandle.html | 2 +- structuvw_1_1BaseHandle__inherit__graph.png | Bin 104078 -> 105256 bytes structuvw_1_1CPUInfo-members.html | 2 +- structuvw_1_1CPUInfo.html | 10 +- structuvw_1_1CheckEvent.html | 2 +- structuvw_1_1CloseEvent.html | 2 +- structuvw_1_1ConnectEvent.html | 2 +- structuvw_1_1DataEvent-members.html | 2 +- structuvw_1_1DataEvent.html | 2 +- ...tuvw_1_1Emitter_1_1Connection-members.html | 2 +- structuvw_1_1Emitter_1_1Connection.html | 2 +- structuvw_1_1EndEvent.html | 2 +- structuvw_1_1ErrorEvent-members.html | 2 +- structuvw_1_1ErrorEvent.html | 2 +- structuvw_1_1ExitEvent-members.html | 2 +- structuvw_1_1ExitEvent.html | 2 +- structuvw_1_1FsEvent-members.html | 2 +- structuvw_1_1FsEvent.html | 2 +- structuvw_1_1FsEventEvent-members.html | 2 +- structuvw_1_1FsEventEvent.html | 2 +- structuvw_1_1FsEventEvent__coll__graph.png | Bin 4347 -> 4836 bytes ...ils_1_1UVFsType_1_1FSTAT_01_4-members.html | 2 +- ...3_01details_1_1UVFsType_1_1FSTAT_01_4.html | 2 +- ...ils_1_1UVFsType_1_1LSTAT_01_4-members.html | 2 +- ...3_01details_1_1UVFsType_1_1LSTAT_01_4.html | 2 +- ..._1_1UVFsType_1_1READLINK_01_4-members.html | 2 +- ...1details_1_1UVFsType_1_1READLINK_01_4.html | 2 +- ...ails_1_1UVFsType_1_1READ_01_4-members.html | 2 +- ..._3_01details_1_1UVFsType_1_1READ_01_4.html | 2 +- ...s_1_1UVFsType_1_1SCANDIR_01_4-members.html | 2 +- ...01details_1_1UVFsType_1_1SCANDIR_01_4.html | 2 +- ..._1_1UVFsType_1_1SENDFILE_01_4-members.html | 2 +- ...1details_1_1UVFsType_1_1SENDFILE_01_4.html | 2 +- ...ails_1_1UVFsType_1_1STAT_01_4-members.html | 2 +- ..._3_01details_1_1UVFsType_1_1STAT_01_4.html | 2 +- ...ils_1_1UVFsType_1_1WRITE_01_4-members.html | 2 +- ...3_01details_1_1UVFsType_1_1WRITE_01_4.html | 2 +- structuvw_1_1FsHelper-members.html | 2 +- structuvw_1_1FsHelper.html | 2 +- structuvw_1_1FsPollEvent-members.html | 2 +- structuvw_1_1FsPollEvent.html | 2 +- structuvw_1_1IPv4.html | 4 +- structuvw_1_1IPv6.html | 4 +- structuvw_1_1IdleEvent.html | 2 +- structuvw_1_1InterfaceAddress-members.html | 2 +- structuvw_1_1InterfaceAddress.html | 14 +- ...ctuvw_1_1InterfaceAddress__coll__graph.png | Bin 4327 -> 4673 bytes structuvw_1_1ListenEvent.html | 2 +- structuvw_1_1NameInfoEvent-members.html | 2 +- structuvw_1_1NameInfoEvent.html | 2 +- structuvw_1_1Passwd-members.html | 2 +- structuvw_1_1Passwd.html | 2 +- structuvw_1_1PollEvent-members.html | 2 +- structuvw_1_1PollEvent.html | 2 +- structuvw_1_1PollEvent__coll__graph.png | Bin 5572 -> 6032 bytes structuvw_1_1PrepareEvent.html | 2 +- structuvw_1_1SendEvent.html | 2 +- structuvw_1_1ShutdownEvent.html | 2 +- structuvw_1_1SignalEvent-members.html | 2 +- structuvw_1_1SignalEvent.html | 2 +- structuvw_1_1TimerEvent.html | 2 +- structuvw_1_1UDPDataEvent-members.html | 2 +- structuvw_1_1UDPDataEvent.html | 2 +- structuvw_1_1UDPDataEvent__coll__graph.png | Bin 3966 -> 4312 bytes structuvw_1_1UName-members.html | 85 +++++++ structuvw_1_1UName.html | 232 ++++++++++++++++++ structuvw_1_1Utilities-members.html | 2 +- structuvw_1_1Utilities.html | 44 ++-- structuvw_1_1Utilities_1_1OS-members.html | 3 +- structuvw_1_1Utilities_1_1OS.html | 54 +++- structuvw_1_1WinSize-members.html | 2 +- structuvw_1_1WinSize.html | 2 +- structuvw_1_1WorkEvent.html | 2 +- structuvw_1_1WriteEvent.html | 2 +- tcp_8hpp_source.html | 12 +- thread_8hpp_source.html | 2 +- timer_8hpp_source.html | 2 +- tty_8hpp_source.html | 2 +- udp_8hpp_source.html | 12 +- underlying__type_8hpp_source.html | 2 +- util_8hpp_source.html | 98 ++++---- uvw_8hpp_source.html | 2 +- work_8hpp_source.html | 2 +- 411 files changed, 1222 insertions(+), 601 deletions(-) create mode 100644 functions_func_v.html create mode 100644 functions_v.html create mode 100644 inherit_graph_73.map create mode 100644 inherit_graph_73.md5 create mode 100644 inherit_graph_73.png create mode 100644 search/all_15.html create mode 100644 search/all_15.js create mode 100644 search/functions_15.html create mode 100644 search/functions_15.js create mode 100644 structuvw_1_1UName-members.html create mode 100644 structuvw_1_1UName.html diff --git a/README_8md_source.html b/README_8md_source.html index ac558492..70810010 100644 --- a/README_8md_source.html +++ b/README_8md_source.html @@ -22,7 +22,7 @@
uvw -  1.12.0 +  1.13.0
@@ -63,7 +63,7 @@ $(function() {
README.md
-
1 ![uvw - libuv wrapper in modern C++](https://user-images.githubusercontent.com/1812216/46069406-c977a600-c17b-11e8-9a47-9bba6f412c57.png)
2 
3 <!--
4 @cond TURN_OFF_DOXYGEN
5 -->
6 [![Build Status](https://travis-ci.org/skypjack/uvw.svg?branch=master)](https://travis-ci.org/skypjack/uvw)
7 [![Build status](https://ci.appveyor.com/api/projects/status/m5ndm8gnu8isg2to?svg=true)](https://ci.appveyor.com/project/skypjack/uvw)
8 [![Coverage Status](https://coveralls.io/repos/github/skypjack/uvw/badge.svg?branch=master)](https://coveralls.io/github/skypjack/uvw?branch=master)
9 [![Download](https://api.bintray.com/packages/skypjack/conan/uvw%3Askypjack/images/download.svg)](https://bintray.com/skypjack/conan/uvw%3Askypjack/_latestVersion)
10 [![Gitter chat](https://badges.gitter.im/skypjack/uvw.png)](https://gitter.im/skypjack/uvw)
11 [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
12 
13 [![Patreon](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/bePatron?u=11330786)
14 
15 <!--
16 @endcond TURN_OFF_DOXYGEN
17 -->
18 
19 # Introduction
20 
21 `uvw` is a header-only, event based, tiny and easy to use *libuv* wrapper in modern C++.<br/>
22 The basic idea is to hide completely the *C-ish* interface of *libuv* behind a graceful C++ API. Currently, no `uv_*_t` data structure is actually exposed by the library.<br/>
23 Note that `uvw` stays true to the API of *libuv* and it doesn't add anything to its interface. For the same reasons, users of the library must follow the same rules who are used to follow with *libuv*.<br/>
24 As an example, a *handle* should be initialized before any other operation and closed once it is no longer in use.
25 
26 ## Code Example
27 
28 ```cpp
29 #include <uvw.hpp>
30 #include <memory>
31 
32 void listen(uvw::Loop &loop) {
33  std::shared_ptr<uvw::TCPHandle> tcp = loop.resource<uvw::TCPHandle>();
34 
35  tcp->once<uvw::ListenEvent>([](const uvw::ListenEvent &, uvw::TCPHandle &srv) {
36  std::shared_ptr<uvw::TCPHandle> client = srv.loop().resource<uvw::TCPHandle>();
37 
38  client->on<uvw::CloseEvent>([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TCPHandle &) { ptr->close(); });
39  client->on<uvw::EndEvent>([](const uvw::EndEvent &, uvw::TCPHandle &client) { client.close(); });
40 
41  srv.accept(*client);
42  client->read();
43  });
44 
45  tcp->bind("127.0.0.1", 4242);
46  tcp->listen();
47 }
48 
49 void conn(uvw::Loop &loop) {
50  auto tcp = loop.resource<uvw::TCPHandle>();
51 
52  tcp->on<uvw::ErrorEvent>([](const uvw::ErrorEvent &, uvw::TCPHandle &) { /* handle errors */ });
53 
54  tcp->once<uvw::ConnectEvent>([](const uvw::ConnectEvent &, uvw::TCPHandle &tcp) {
55  auto dataWrite = std::unique_ptr<char[]>(new char[2]{ 'b', 'c' });
56  tcp.write(std::move(dataWrite), 2);
57  tcp.close();
58  });
59 
60  tcp->connect(std::string{"127.0.0.1"}, 4242);
61 }
62 
63 int main() {
64  auto loop = uvw::Loop::getDefault();
65  listen(*loop);
66  conn(*loop);
67  loop->run();
68 }
69 ```
70 
71 ## Motivation
72 
73 The main reason for which `uvw` has been written is the fact that it does not exist a valid *libuv* wrapper in C++. That's all.
74 
75 # Build Instructions
76 
77 ## Requirements
78 
79 To be able to use `uvw`, users must provide the following system-wide tools:
80 
81 * A full-featured compiler that supports at least C++14.
82 * `libuv` (which version depends on the tag of `uvw` in use).
83 
84 The requirements below are mandatory to compile the tests and to extract the documentation:
85 
86 * CMake version 3.2 or later.
87 * Doxygen version 1.8 or later.
88 
89 Note that `libuv` is part of the dependencies of the project and it will be cloned by `cmake` (see below for further details).<br/>
90 Because of that, users have not to install it to compile and execute the tests.
91 
92 ## Library
93 
94 `uvw` is a header-only library.<br/>
95 This means that including the `uvw.hpp` header or one of the other `uvw/*.hpp` headers is enough to use it.<br/>
96 It's a matter of adding the following line at the top of a file:
97 
98 ```cpp
99 #include <uvw.hpp>
100 ```
101 
102 Then pass the proper `-I` argument to the compiler to add the `src` directory to the include paths.<br/>
103 Note that users are demanded to correctly setup include directories and libraries search paths for *libuv*.
104 
105 ## Versioning
106 
107 Starting with tag _v1.12.0_ of `libuv`, `uvw` follows the [semantic versioning](http://semver.org/) scheme.<br/>
108 The problem is that any version of `uvw` also requires to track explicitly the version of `libuv` to which it is bound.<br/>
109 Because of that, the latter wil be appended to the version of `uvw`. As an example:
110 
111  vU.V.W_libuv-vX.Y
112 
113 In particular, the following applies:
114 
115 * _U.V.W_ are major, minor and patch versions of `uvw`.
116 * _X.Y_ is the version of `libuv` to which to refer (where any patch version is valid).
117 
118 In other terms, tags will look like this from now on:
119 
120  v1.0.0_libuv-v1.12
121 
122 Branch `master` of `uvw` will be a work in progress branch that follows branch _v1.x_ of `libuv` (at least as long as it remains their _master_ branch).<br/>
123 
124 ## Documentation
125 
126 The documentation is based on [`doxygen`](http://www.stack.nl/~dimitri/doxygen/). To build it:
127 
128 * `$ cd build`
129 * `$ cmake ..`
130 * `$ make docs`
131 
132 The API reference will be created in HTML format within the directory `build/docs/html`.<br/>
133 To navigate it with your favorite browser:
134 
135 * `$ cd build`
136 * `$ your_favorite_browser docs/html/index.html`
137 
138 The API reference is also available [online](https://skypjack.github.io/uvw/) for the latest version.
139 
140 ### Note
141 
142 The documentation is mostly inspired by the official [libuv API documentation](http://docs.libuv.org/en/v1.x/) for obvious reasons.<br/>
143 If you are mainly interested in the way `uvw` imports `libuv` in a `cmake` based project, I suggest you to take a look at [this](https://github.com/skypjack/libuv_cmake) repository instead.
144 
145 ## Tests
146 
147 To compile and run the tests, `uvw` requires *libuv* and *googletest*.<br/>
148 `cmake` will download and compile both the libraries before to compile anything else.
149 
150 To build the tests:
151 
152 * `$ cd build`
153 * `$ cmake .. -DBUILD_TESTING=ON`
154 * `$ make`
155 * `$ ctest -j4 -R uvw`
156 
157 Omit `-R uvw` if you also want to test `libuv` and other dependencies.
158 
159 # Crash Course
160 
161 ## Vademecum
162 
163 There is only one rule when using `uvw`: always initialize the resources and terminate them.
164 
165 Resources belong mainly to two families: _handles_ and _requests_.<br/>
166 Handles represent long-lived objects capable of performing certain operations while active.<br/>
167 Requests represent (typically) short-lived operations performed either over a handle or standalone.
168 
169 The following sections will explain in short what it means to initialize and terminate these kinds of resources.<br/>
170 For more details, please refer to the [online documentation](https://skypjack.github.io/uvw/).
171 
172 ## Handles
173 
174 Initialization is usually performed under the hood and can be even passed over, as far as handles are created using the `Loop::resource` member function.<br/>
175 On the other side, handles keep themselves alive until one explicitly closes them. Because of that, memory usage will grow up if users simply forget about a handle.<br/>
176 Therefore the rule quickly becomes *always close your handles*. It's as simple as calling the `close` member function on them.
177 
178 ## Requests
179 
180 Usually initializing a request object is not required. Anyway, the recommended way to create a request is still through the `Loop::resource` member function.<br/>
181 Requests will keep themselves alive as long as they are bound to unfinished underlying activities. This means that users have not to discard explicitly a request.<br/>
182 Therefore the rule quickly becomes *feel free to make a request and forget about it*. It's as simple as calling a member function on them.
183 
184 ## The Loop and the Resource
185 
186 The first thing to do to use `uvw` is to create a loop. In case the default one is enough, it's easy as doing this:
187 
188 ```cpp
189 auto loop = uvw::Loop::getDefault();
190 ```
191 
192 Note that loop objects don't require to be closed explicitly, even if they offer the `close` member function in case an user wants to do that.<br/>
193 Loops can be started using the `run` member function. The two calls below are equivalent:
194 
195 ```cpp
196 loop->run();
197 loop->run<uvw::Loop::Mode::DEFAULT>();
198 ```
199 
200 Available modes are: `DEFAULT`, `ONCE`, `NOWAIT`. Please refer to the documentation of *libuv* for further details.
201 
202 In order to create a resource and to bind it to the given loop, just do the following:
203 
204 ```cpp
205 auto tcp = loop.resource<uvw::TCPHandle>();
206 ```
207 
208 The line above will create and initialize a tcp handle, then a shared pointer to that resource will be returned.<br/>
209 Users should check if pointers have been correctly initialized: in case of errors, they won't be.<br/>
210 Another way to create a resource is:
211 
212 ```cpp
213 auto tcp = TCPHandle::create(loop);
214 tcp->init();
215 ```
216 
217 Pretty annoying indeed. Using a loop is the recommended approach.
218 
219 The resources also accept arbitrary user-data that won't be touched in any case.<br/>
220 Users can set and get them through the `data` member function as it follows:
221 
222 ```cpp
223 resource->data(std::make_shared<int>(42));
224 std::shared_ptr<void> data = resource->data();
225 ```
226 
227 Resources expect a `std::shared_pointer<void>` and return it, therefore any kind of data is welcome.<br/>
228 Users can explicitly specify a type other than `void` when calling the `data` member function:
229 
230 ```cpp
231 std::shared_ptr<int> data = resource->data<int>();
232 ```
233 
234 Remember from the previous section that a handle will keep itself alive until one invokes the `close` member function on it.<br/>
235 To know what are the handles that are still alive and bound to a given loop, just do the following:
236 
237 ```cpp
238 loop.walk([](uvw::BaseHandle &){ /* application code here */ });
239 ```
240 
241 `BaseHandle` exposes a few methods and cannot be promoted to the original type of the handle (even though `type` and `category` member functions fill the gap somehow).<br/>
242 Anyway, it can be used to close the handle that originated from it. As an example, all the pending handles can be closed easily as it follows:
243 
244 ```cpp
245 loop.walk([](uvw::BaseHandle &h){ h.close(); });
246 ```
247 
248 No need to keep track of them.
249 
250 To know what are the available resources' types, please refer the API reference.
251 
252 ## The event-based approach
253 
254 For `uvw` offers an event-based approach, resources are small event emitters to which listeners can be attached.<br/>
255 Attaching a listener to a resource is the recommended way to be notified about changes.<br/>
256 Listeners must be callable objects of type `void(EventType &, ResourceType &)`, where:
257 
258 * `EventType` is the type of the event for which they have been designed.
259 * `ResourceType` is the type of the resource that has originated the event.
260 
261 It means that the following function types are all valid:
262 
263 * `void(EventType &, ResourceType &)`
264 * `void(const EventType &, ResourceType &)`
265 * `void(EventType &, const ResourceType &)`
266 * `void(const EventType &, const ResourceType &)`
267 
268 Once more, please note that there is no need to keep around references to the resources: they will pass themselves as an argument whenever an event is published.
269 
270 There exist two methods to attach an event to a resource:
271 
272 * `resource.once<EventType>(listener)`: the listener will be automatically removed after the first event of the given type.
273 * `resource.on<EventType>(listener)`: to be used for long-running listeners.
274 
275 Both of them return an object of type `ResourceType::Connection` (as an example, `TCPHandle::Connection`).<br/>
276 A connection object can be used later as an argument to the `erase` member function of the resource to remove the listener.<br/>
277 There exists also the `clear` member function to drop all the listeners at once.
278 
279 Almost all the resources use to emit `ErrorEvent` events in case of errors.<br/>
280 All the other events are specific for the given resource and documented in the API reference.
281 
282 The code below shows how to create a simple tcp server using `uvw`:
283 
284 ```cpp
285 auto loop = uvw::Loop::getDefault();
286 auto tcp = loop.resource<uvw::TCPHandle>();
287 
288 tcp->on<uvw::ErrorEvent>([](const uvw::ErrorEvent &, uvw::TCPHandle &) { /* something went wrong */ });
289 
290 tcp->on<uvw::ListenEvent>([](const uvw::ListenEvent &, uvw::TCPHandle &srv) {
291  std::shared_ptr<uvw::TCPHandle> client = srv.loop().resource<uvw::TCPHandle>();
292  client->once<uvw::EndEvent>([](const uvw::EndEvent &, uvw::TCPHandle &client) { client.close(); });
293  client->on<uvw::DataEvent>([](const uvw::DataEvent &, uvw::TCPHandle &) { /* data received */ });
294  srv.accept(*client);
295  client->read();
296 });
297 
298 tcp->bind("127.0.0.1", 4242);
299 tcp->listen();
300 ```
301 
302 Note also that `uvw::TCPHandle` already supports _IPv6_ out-of-the-box. The statement above is equivalent to `tcp->bind<uvw::IPv4>("127.0.0.1", 4242)`.<br/>
303 It's suffice to explicitly specify `uvw::IPv6` as the underlying protocol to use it.
304 
305 The API reference is the recommended documentation for further details about resources and their methods.
306 
307 ## Going raw
308 
309 In case users need to use functionalities not wrapped yet by `uvw` or if they
310 want to get the underlying data structures as defined by `libuv` for some other
311 reasons, almost all the classes in `uvw` give direct access to them.<br/>
312 Please, note that this functions should not be used directly unless users know
313 exactly what they are doing and what are the risks. Going raw is dangerous,
314 mainly because the lifetime management of a loop, a handle or a request is
315 completely in charge to the library and working around it could quickly break
316 things.
317 
318 That being said, _going raw_ is a matter of using the `raw` member functions:
319 
320 ```cpp
321 auto loop = uvw::Loop::getDefault();
322 auto tcp = loop.resource<uvw::TCPHandle>();
323 
324 uv_loop_t *raw = loop->raw();
325 uv_tcp_t *handle = tcp->raw();
326 ```
327 
328 Go the raw way at your own risk, but do not expect any support in case of bugs.
329 
330 # Contributors
331 
332 If you want to contribute, please send patches as pull requests against the branch master.<br/>
333 Check the [contributors list](https://github.com/skypjack/uvw/blob/master/AUTHORS) to see who has partecipated so far.
334 
335 # License
336 
337 Code and documentation Copyright (c) 2016-2018 Michele Caini.<br/>
338 Logo Copyright (c) 2018 Richard Caseres.
339 
340 Code released under
341 [the MIT license](https://github.com/skypjack/uvw/blob/master/LICENSE).
342 Documentation released under
343 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).<br/>
344 Logo released under
345 [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
346 
347 <!--
348 @cond TURN_OFF_DOXYGEN
349 -->
350 # Support
351 
352 ## Patreon
353 
354 Become a [patron](https://www.patreon.com/bePatron?c=1772573) and get access to
355 extra content, help me spend more time on the projects you love and create new
356 ones for you. Your support will help me to continue the work done so far and
357 make it more professional and feature-rich every day.<br/>
358 It takes very little to
359 [become a patron](https://www.patreon.com/bePatron?c=1772573) and thus help the
360 software you use every day. Don't miss the chance.
361 
362 ## Donation
363 
364 Developing and maintaining `uvw` takes some time and lots of coffee. It still lacks a proper test suite, documentation is partially incomplete and not all functionalities have been fully implemented yet.<br/>
365 If you want to support this project, you can offer me an espresso. I'm from Italy, we're used to turning the best coffee ever in code. If you find that it's not enough, feel free to support me the way you prefer.<br/>
366 Take a look at the donation button at the top of the page for more details or just click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted).
367 
368 ## Hire me
369 
370 If you start using `uvw` and need help, if you want a new feature and want me
371 to give it the highest priority, if you have any other reason to contact me:
372 do not hesitate. I'm available for hiring.<br/>
373 Feel free to take a look at my [profile](https://github.com/skypjack) and
374 contact me by mail.
375 <!--
376 @endcond TURN_OFF_DOXYGEN
377 -->
+
1 ![uvw - libuv wrapper in modern C++](https://user-images.githubusercontent.com/1812216/46069406-c977a600-c17b-11e8-9a47-9bba6f412c57.png)
2 
3 <!--
4 @cond TURN_OFF_DOXYGEN
5 -->
6 [![Build Status](https://travis-ci.org/skypjack/uvw.svg?branch=master)](https://travis-ci.org/skypjack/uvw)
7 [![Build status](https://ci.appveyor.com/api/projects/status/m5ndm8gnu8isg2to?svg=true)](https://ci.appveyor.com/project/skypjack/uvw)
8 [![Coverage Status](https://coveralls.io/repos/github/skypjack/uvw/badge.svg?branch=master)](https://coveralls.io/github/skypjack/uvw?branch=master)
9 [![Download](https://api.bintray.com/packages/skypjack/conan/uvw%3Askypjack/images/download.svg)](https://bintray.com/skypjack/conan/uvw%3Askypjack/_latestVersion)
10 [![Gitter chat](https://badges.gitter.im/skypjack/uvw.png)](https://gitter.im/skypjack/uvw)
11 [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
12 
13 [![Patreon](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/bePatron?u=11330786)
14 
15 <!--
16 @endcond TURN_OFF_DOXYGEN
17 -->
18 
19 # Introduction
20 
21 `uvw` is a header-only, event based, tiny and easy to use *libuv* wrapper in modern C++.<br/>
22 The basic idea is to hide completely the *C-ish* interface of *libuv* behind a graceful C++ API. Currently, no `uv_*_t` data structure is actually exposed by the library.<br/>
23 Note that `uvw` stays true to the API of *libuv* and it doesn't add anything to its interface. For the same reasons, users of the library must follow the same rules who are used to follow with *libuv*.<br/>
24 As an example, a *handle* should be initialized before any other operation and closed once it is no longer in use.
25 
26 ## Code Example
27 
28 ```cpp
29 #include <uvw.hpp>
30 #include <memory>
31 
32 void listen(uvw::Loop &loop) {
33  std::shared_ptr<uvw::TCPHandle> tcp = loop.resource<uvw::TCPHandle>();
34 
35  tcp->once<uvw::ListenEvent>([](const uvw::ListenEvent &, uvw::TCPHandle &srv) {
36  std::shared_ptr<uvw::TCPHandle> client = srv.loop().resource<uvw::TCPHandle>();
37 
38  client->on<uvw::CloseEvent>([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TCPHandle &) { ptr->close(); });
39  client->on<uvw::EndEvent>([](const uvw::EndEvent &, uvw::TCPHandle &client) { client.close(); });
40 
41  srv.accept(*client);
42  client->read();
43  });
44 
45  tcp->bind("127.0.0.1", 4242);
46  tcp->listen();
47 }
48 
49 void conn(uvw::Loop &loop) {
50  auto tcp = loop.resource<uvw::TCPHandle>();
51 
52  tcp->on<uvw::ErrorEvent>([](const uvw::ErrorEvent &, uvw::TCPHandle &) { /* handle errors */ });
53 
54  tcp->once<uvw::ConnectEvent>([](const uvw::ConnectEvent &, uvw::TCPHandle &tcp) {
55  auto dataWrite = std::unique_ptr<char[]>(new char[2]{ 'b', 'c' });
56  tcp.write(std::move(dataWrite), 2);
57  tcp.close();
58  });
59 
60  tcp->connect(std::string{"127.0.0.1"}, 4242);
61 }
62 
63 int main() {
64  auto loop = uvw::Loop::getDefault();
65  listen(*loop);
66  conn(*loop);
67  loop->run();
68 }
69 ```
70 
71 ## Motivation
72 
73 The main reason for which `uvw` has been written is the fact that it does not exist a valid *libuv* wrapper in C++. That's all.
74 
75 # Build Instructions
76 
77 ## Requirements
78 
79 To be able to use `uvw`, users must provide the following system-wide tools:
80 
81 * A full-featured compiler that supports at least C++14.
82 * `libuv` (which version depends on the tag of `uvw` in use).
83 
84 The requirements below are mandatory to compile the tests and to extract the documentation:
85 
86 * CMake version 3.2 or later.
87 * Doxygen version 1.8 or later.
88 
89 Note that `libuv` is part of the dependencies of the project and it will be cloned by `cmake` (see below for further details).<br/>
90 Because of that, users have not to install it to compile and execute the tests.
91 
92 ## Library
93 
94 `uvw` is a header-only library.<br/>
95 This means that including the `uvw.hpp` header or one of the other `uvw/*.hpp` headers is enough to use it.<br/>
96 It's a matter of adding the following line at the top of a file:
97 
98 ```cpp
99 #include <uvw.hpp>
100 ```
101 
102 Then pass the proper `-I` argument to the compiler to add the `src` directory to the include paths.<br/>
103 Note that users are demanded to correctly setup include directories and libraries search paths for *libuv*.
104 
105 ## Versioning
106 
107 Starting with tag _v1.12.0_ of `libuv`, `uvw` follows the [semantic versioning](http://semver.org/) scheme.<br/>
108 The problem is that any version of `uvw` also requires to track explicitly the version of `libuv` to which it is bound.<br/>
109 Because of that, the latter wil be appended to the version of `uvw`. As an example:
110 
111  vU.V.W_libuv-vX.Y
112 
113 In particular, the following applies:
114 
115 * _U.V.W_ are major, minor and patch versions of `uvw`.
116 * _X.Y_ is the version of `libuv` to which to refer (where any patch version is valid).
117 
118 In other terms, tags will look like this from now on:
119 
120  v1.0.0_libuv-v1.12
121 
122 Branch `master` of `uvw` will be a work in progress branch that follows branch _v1.x_ of `libuv` (at least as long as it remains their _master_ branch).<br/>
123 
124 ## Documentation
125 
126 The documentation is based on [`doxygen`](http://www.stack.nl/~dimitri/doxygen/). To build it:
127 
128 * `$ cd build`
129 * `$ cmake ..`
130 * `$ make docs`
131 
132 The API reference will be created in HTML format within the directory `build/docs/html`.<br/>
133 To navigate it with your favorite browser:
134 
135 * `$ cd build`
136 * `$ your_favorite_browser docs/html/index.html`
137 
138 The API reference is also available [online](https://skypjack.github.io/uvw/) for the latest version.
139 
140 ### Note
141 
142 The documentation is mostly inspired by the official [libuv API documentation](http://docs.libuv.org/en/v1.x/) for obvious reasons.<br/>
143 If you are mainly interested in the way `uvw` imports `libuv` in a `cmake` based project, I suggest you to take a look at [this](https://github.com/skypjack/libuv_cmake) repository instead.
144 
145 ## Tests
146 
147 To compile and run the tests, `uvw` requires *libuv* and *googletest*.<br/>
148 `cmake` will download and compile both the libraries before to compile anything else.
149 
150 To build the tests:
151 
152 * `$ cd build`
153 * `$ cmake .. -DBUILD_TESTING=ON`
154 * `$ make`
155 * `$ ctest -j4 -R uvw`
156 
157 Omit `-R uvw` if you also want to test `libuv` and other dependencies.
158 
159 # Crash Course
160 
161 ## Vademecum
162 
163 There is only one rule when using `uvw`: always initialize the resources and terminate them.
164 
165 Resources belong mainly to two families: _handles_ and _requests_.<br/>
166 Handles represent long-lived objects capable of performing certain operations while active.<br/>
167 Requests represent (typically) short-lived operations performed either over a handle or standalone.
168 
169 The following sections will explain in short what it means to initialize and terminate these kinds of resources.<br/>
170 For more details, please refer to the [online documentation](https://skypjack.github.io/uvw/).
171 
172 ## Handles
173 
174 Initialization is usually performed under the hood and can be even passed over, as far as handles are created using the `Loop::resource` member function.<br/>
175 On the other side, handles keep themselves alive until one explicitly closes them. Because of that, memory usage will grow up if users simply forget about a handle.<br/>
176 Therefore the rule quickly becomes *always close your handles*. It's as simple as calling the `close` member function on them.
177 
178 ## Requests
179 
180 Usually initializing a request object is not required. Anyway, the recommended way to create a request is still through the `Loop::resource` member function.<br/>
181 Requests will keep themselves alive as long as they are bound to unfinished underlying activities. This means that users have not to discard explicitly a request.<br/>
182 Therefore the rule quickly becomes *feel free to make a request and forget about it*. It's as simple as calling a member function on them.
183 
184 ## The Loop and the Resource
185 
186 The first thing to do to use `uvw` is to create a loop. In case the default one is enough, it's easy as doing this:
187 
188 ```cpp
189 auto loop = uvw::Loop::getDefault();
190 ```
191 
192 Note that loop objects don't require to be closed explicitly, even if they offer the `close` member function in case an user wants to do that.<br/>
193 Loops can be started using the `run` member function. The two calls below are equivalent:
194 
195 ```cpp
196 loop->run();
197 loop->run<uvw::Loop::Mode::DEFAULT>();
198 ```
199 
200 Available modes are: `DEFAULT`, `ONCE`, `NOWAIT`. Please refer to the documentation of *libuv* for further details.
201 
202 In order to create a resource and to bind it to the given loop, just do the following:
203 
204 ```cpp
205 auto tcp = loop.resource<uvw::TCPHandle>();
206 ```
207 
208 The line above will create and initialize a tcp handle, then a shared pointer to that resource will be returned.<br/>
209 Users should check if pointers have been correctly initialized: in case of errors, they won't be.<br/>
210 Another way to create a resource is:
211 
212 ```cpp
213 auto tcp = TCPHandle::create(loop);
214 tcp->init();
215 ```
216 
217 Pretty annoying indeed. Using a loop is the recommended approach.
218 
219 The resources also accept arbitrary user-data that won't be touched in any case.<br/>
220 Users can set and get them through the `data` member function as it follows:
221 
222 ```cpp
223 resource->data(std::make_shared<int>(42));
224 std::shared_ptr<void> data = resource->data();
225 ```
226 
227 Resources expect a `std::shared_pointer<void>` and return it, therefore any kind of data is welcome.<br/>
228 Users can explicitly specify a type other than `void` when calling the `data` member function:
229 
230 ```cpp
231 std::shared_ptr<int> data = resource->data<int>();
232 ```
233 
234 Remember from the previous section that a handle will keep itself alive until one invokes the `close` member function on it.<br/>
235 To know what are the handles that are still alive and bound to a given loop, just do the following:
236 
237 ```cpp
238 loop.walk([](uvw::BaseHandle &){ /* application code here */ });
239 ```
240 
241 `BaseHandle` exposes a few methods and cannot be promoted to the original type of the handle (even though `type` and `category` member functions fill the gap somehow).<br/>
242 Anyway, it can be used to close the handle that originated from it. As an example, all the pending handles can be closed easily as it follows:
243 
244 ```cpp
245 loop.walk([](uvw::BaseHandle &h){ h.close(); });
246 ```
247 
248 No need to keep track of them.
249 
250 To know what are the available resources' types, please refer the API reference.
251 
252 ## The event-based approach
253 
254 For `uvw` offers an event-based approach, resources are small event emitters to which listeners can be attached.<br/>
255 Attaching a listener to a resource is the recommended way to be notified about changes.<br/>
256 Listeners must be callable objects of type `void(EventType &, ResourceType &)`, where:
257 
258 * `EventType` is the type of the event for which they have been designed.
259 * `ResourceType` is the type of the resource that has originated the event.
260 
261 It means that the following function types are all valid:
262 
263 * `void(EventType &, ResourceType &)`
264 * `void(const EventType &, ResourceType &)`
265 * `void(EventType &, const ResourceType &)`
266 * `void(const EventType &, const ResourceType &)`
267 
268 Once more, please note that there is no need to keep around references to the resources: they will pass themselves as an argument whenever an event is published.
269 
270 There exist two methods to attach an event to a resource:
271 
272 * `resource.once<EventType>(listener)`: the listener will be automatically removed after the first event of the given type.
273 * `resource.on<EventType>(listener)`: to be used for long-running listeners.
274 
275 Both of them return an object of type `ResourceType::Connection` (as an example, `TCPHandle::Connection`).<br/>
276 A connection object can be used later as an argument to the `erase` member function of the resource to remove the listener.<br/>
277 There exists also the `clear` member function to drop all the listeners at once.
278 
279 Almost all the resources use to emit `ErrorEvent` events in case of errors.<br/>
280 All the other events are specific for the given resource and documented in the API reference.
281 
282 The code below shows how to create a simple tcp server using `uvw`:
283 
284 ```cpp
285 auto loop = uvw::Loop::getDefault();
286 auto tcp = loop.resource<uvw::TCPHandle>();
287 
288 tcp->on<uvw::ErrorEvent>([](const uvw::ErrorEvent &, uvw::TCPHandle &) { /* something went wrong */ });
289 
290 tcp->on<uvw::ListenEvent>([](const uvw::ListenEvent &, uvw::TCPHandle &srv) {
291  std::shared_ptr<uvw::TCPHandle> client = srv.loop().resource<uvw::TCPHandle>();
292  client->once<uvw::EndEvent>([](const uvw::EndEvent &, uvw::TCPHandle &client) { client.close(); });
293  client->on<uvw::DataEvent>([](const uvw::DataEvent &, uvw::TCPHandle &) { /* data received */ });
294  srv.accept(*client);
295  client->read();
296 });
297 
298 tcp->bind("127.0.0.1", 4242);
299 tcp->listen();
300 ```
301 
302 Note also that `uvw::TCPHandle` already supports _IPv6_ out-of-the-box. The statement above is equivalent to `tcp->bind<uvw::IPv4>("127.0.0.1", 4242)`.<br/>
303 It's suffice to explicitly specify `uvw::IPv6` as the underlying protocol to use it.
304 
305 The API reference is the recommended documentation for further details about resources and their methods.
306 
307 ## Going raw
308 
309 In case users need to use functionalities not wrapped yet by `uvw` or if they
310 want to get the underlying data structures as defined by `libuv` for some other
311 reasons, almost all the classes in `uvw` give direct access to them.<br/>
312 Please, note that this functions should not be used directly unless users know
313 exactly what they are doing and what are the risks. Going raw is dangerous,
314 mainly because the lifetime management of a loop, a handle or a request is
315 completely in charge to the library and working around it could quickly break
316 things.
317 
318 That being said, _going raw_ is a matter of using the `raw` member functions:
319 
320 ```cpp
321 auto loop = uvw::Loop::getDefault();
322 auto tcp = loop.resource<uvw::TCPHandle>();
323 
324 uv_loop_t *raw = loop->raw();
325 uv_tcp_t *handle = tcp->raw();
326 ```
327 
328 Go the raw way at your own risk, but do not expect any support in case of bugs.
329 
330 # Contributors
331 
332 If you want to contribute, please send patches as pull requests against the branch master.<br/>
333 Check the [contributors list](https://github.com/skypjack/uvw/blob/master/AUTHORS) to see who has partecipated so far.
334 
335 # License
336 
337 Code and documentation Copyright (c) 2016-2019 Michele Caini.<br/>
338 Logo Copyright (c) 2018-2019 Richard Caseres.
339 
340 Code released under
341 [the MIT license](https://github.com/skypjack/uvw/blob/master/LICENSE).
342 Documentation released under
343 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).<br/>
344 Logo released under
345 [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
346 
347 <!--
348 @cond TURN_OFF_DOXYGEN
349 -->
350 # Support
351 
352 ## Patreon
353 
354 Become a [patron](https://www.patreon.com/bePatron?c=1772573) and get access to
355 extra content, help me spend more time on the projects you love and create new
356 ones for you. Your support will help me to continue the work done so far and
357 make it more professional and feature-rich every day.<br/>
358 It takes very little to
359 [become a patron](https://www.patreon.com/bePatron?c=1772573) and thus help the
360 software you use every day. Don't miss the chance.
361 
362 ## Donation
363 
364 Developing and maintaining `uvw` takes some time and lots of coffee. It still lacks a proper test suite, documentation is partially incomplete and not all functionalities have been fully implemented yet.<br/>
365 If you want to support this project, you can offer me an espresso. I'm from Italy, we're used to turning the best coffee ever in code. If you find that it's not enough, feel free to support me the way you prefer.<br/>
366 Take a look at the donation button at the top of the page for more details or just click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=W2HF9FESD5LJY&lc=IT&item_name=Michele%20Caini&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted).
367 
368 ## Hire me
369 
370 If you start using `uvw` and need help, if you want a new feature and want me
371 to give it the highest priority, if you have any other reason to contact me:
372 do not hesitate. I'm available for hiring.<br/>
373 Feel free to take a look at my [profile](https://github.com/skypjack) and
374 contact me by mail.
375 <!--
376 @endcond TURN_OFF_DOXYGEN
377 -->