Last active
August 21, 2016 12:12
-
-
Save schwehr/f16520a0c55d17444da6f0fe68d2a5e8 to your computer and use it in GitHub Desktop.
Find constructor implementations in GDAL. Does not find ctors embedded in the actual class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Look for ClassName::ClassName matches. | |
import glob | |
import re | |
import sys | |
files = sorted(glob.glob('*/*.cpp')) | |
CTOR_RE = re.compile('(?P<name>[a-zA-Z][_a-zA-Z0-9]+)::(?P=name)') | |
skips = ( | |
'arcobjects', | |
'carto/', | |
'cloudant', | |
'db2', | |
'mongodb', | |
'dwg', | |
'filegdb/' | |
'fme/', | |
'grass/', | |
'idb', | |
'ingress', | |
'mdb/', | |
'mssqlspatial', | |
'oci', | |
'sde', | |
'sosi', | |
) | |
for filename in files: | |
do_skip = False | |
for skip in skips: | |
if skip in filename: | |
do_skip = True | |
break | |
if do_skip: | |
continue | |
for line_num, line in enumerate(open(filename)): | |
search = CTOR_RE.search(line) | |
if search is None: | |
continue | |
print '%s:%s:%s' % (filename, line_num + 1, line.rstrip() ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment