From 078f7b956ef0d992948852a801e626b1118a1fc5 Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 19 Dec 2019 02:18:56 +0100 Subject: [PATCH] fix parsing of enum classes in doc generation tool --- docs/gen_reference_doc.py | 4 +-- docs/hunspell/libtorrent.dic | 4 +++ include/libtorrent/error_code.hpp | 2 +- include/libtorrent/operations.hpp | 41 +++++++++++++++++++++++++++---- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py index 95bb545bb..2afd5a906 100644 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -567,7 +567,7 @@ def parse_enum(lno, lines, filename): global anon_index line = lines[lno].strip() - name = line.replace('enum ', '').split('{')[0].strip() + name = line.replace('enum ', '').replace('class ', '').split(':')[0].split('{')[0].strip() if len(name) == 0: if not internal: print('WARNING: anonymous enum at: \x1b[34m%s:%d\x1b[0m' % (filename, lno)) @@ -888,7 +888,7 @@ for filename in files: blanks = 0 continue - if ('class ' in line or 'struct ' in line) and ';' not in line: + if ('enum class ' not in line and 'class ' in line or 'struct ' in line) and ';' not in line: lno = consume_block(lno - 1, lines) context = '' blanks += 1 diff --git a/docs/hunspell/libtorrent.dic b/docs/hunspell/libtorrent.dic index fee80d5a7..f84145ac1 100644 --- a/docs/hunspell/libtorrent.dic +++ b/docs/hunspell/libtorrent.dic @@ -547,3 +547,7 @@ tos BP qB LT1230 +iocontrol +getname +getpeername +fastresume diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index 901baff55..a45ac8bac 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -534,7 +534,7 @@ namespace libtorrent { // internal std::int32_t file_idx:24; - // A code from file_operation_t enum, indicating what + // A code from operation_t enum, indicating what // kind of operation failed. operation_t operation; diff --git a/include/libtorrent/operations.hpp b/include/libtorrent/operations.hpp index 027e401bb..42f291f82 100644 --- a/include/libtorrent/operations.hpp +++ b/include/libtorrent/operations.hpp @@ -52,7 +52,7 @@ namespace libtorrent { // a call to iocontrol failed iocontrol, - // a call to getpeername failed (querying the remote IP of a + // a call to ``getpeername()`` failed (querying the remote IP of a // connection) getpeername, @@ -107,7 +107,7 @@ namespace libtorrent { sock_listen, // a call to the ioctl to bind a socket to a specific network device or - // adaptor + // adapter sock_bind_to_device, // a call to accept() on a socket @@ -119,21 +119,52 @@ namespace libtorrent { // enumeration network devices or adapters enum_if, + // invoking stat() on a file file_stat, + + // copying a file file_copy, + + // allocating storage for a file file_fallocate, + + // creating a hard link file_hard_link, + + // removing a file file_remove, + + // renaming a file file_rename, + + // opening a file file_open, + + // creating a directory mkdir, + + // check fast resume data against files on disk check_resume, + + // an unknown exception exception, + + // allocate space for a piece in the cache alloc_cache_piece, + + // move a part-file partfile_move, + + // read from a part file partfile_read, + + // write to a part-file partfile_write, + + // a hostname lookup hostname_lookup, + + // create or read a symlink symlink, }; @@ -151,14 +182,14 @@ namespace libtorrent { // determines to disconnect op_bittorrent TORRENT_DEPRECATED_ENUM , - // a call to iocontrol failed + // a call to ``iocontrol()`` failed op_iocontrol TORRENT_DEPRECATED_ENUM, - // a call to getpeername failed (querying the remote IP of a + // a call to ``getpeername()`` failed (querying the remote IP of a // connection) op_getpeername TORRENT_DEPRECATED_ENUM, - // a call to getname failed (querying the local IP of a + // a call to ``getsockname()`` failed (querying the local IP of a // connection) op_getname TORRENT_DEPRECATED_ENUM,