fix gen_fwd.py to correctly put declarations in the dht namespace that belong there

This commit is contained in:
arvidn 2017-09-03 12:28:34 +02:00
parent 621da10e60
commit 37ffe99a19
2 changed files with 21 additions and 7 deletions

View File

@ -179,10 +179,6 @@ class hasher;
struct ip_filter;
class port_filter;
// include/libtorrent/kademlia/dht_storage.hpp
struct dht_storage_counters;
struct dht_storage_interface;
// include/libtorrent/peer_connection_handle.hpp
struct peer_connection_handle;
struct bt_peer_connection_handle;
@ -244,6 +240,14 @@ class torrent_info;
// include/libtorrent/torrent_status.hpp
struct torrent_status;
namespace dht {
// include/libtorrent/kademlia/dht_storage.hpp
struct dht_storage_counters;
struct dht_storage_interface;
}
#ifndef TORRENT_NO_DEPRECATE
// include/libtorrent/alert_types.hpp

View File

@ -57,6 +57,7 @@ deprecated_classes = os.popen('git grep TORRENT_DEPRECATED_EXPORT').read().split
def filter_classes(classes, keyword):
current_file = ''
ret = ''
dht_ret = ''
for c in classes:
line = c.split(':', 1)
if not line[0].endswith('.hpp'): continue
@ -71,13 +72,22 @@ def filter_classes(classes, keyword):
# TODO: support TORRENT_DEPRECATED_EXPORT
if decl[1].strip() != keyword: continue
content = ''
if this_file != current_file:
ret += '\n// ' + this_file + '\n'
content += '\n// ' + this_file + '\n'
current_file = this_file;
decl = decl[0] + ' ' + decl[2]
if not decl.endswith(';'): decl += ';'
ret += decl + '\n'
content += decl + '\n'
if 'kademlia' in this_file:
dht_ret += content
else:
ret += content
if dht_ret == '':
return ret
else:
return ret + '\nnamespace dht {\n' + dht_ret + '\n}\n'
os.remove('include/libtorrent/fwd.hpp')
with open('include/libtorrent/fwd.hpp', 'w+') as f: