From 69a28d50f68afc7a1bdf6f25f665ee39fd11d46f Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 12 Dec 2019 12:50:45 -0500 Subject: [PATCH] Fix #287 --- httplib.h | 4 ++++ split.py | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 split.py diff --git a/httplib.h b/httplib.h index dfdc8d3..b176814 100644 --- a/httplib.h +++ b/httplib.h @@ -912,6 +912,8 @@ private: }; #endif +// ---------------------------------------------------------------------------- + /* * Implementation */ @@ -4435,6 +4437,8 @@ inline bool SSLClient::check_host_name(const char *pattern, } #endif +// ---------------------------------------------------------------------------- + } // namespace httplib #endif // CPPHTTPLIB_HTTPLIB_H diff --git a/split.py b/split.py new file mode 100644 index 0000000..da97b37 --- /dev/null +++ b/split.py @@ -0,0 +1,24 @@ +import os + +border = '// ----------------------------------------------------------------------------' + +with open('httplib.h') as f: + lines = f.readlines() + inImplementation = False + os.makedirs('out', exist_ok=True) + with open('out/httplib.h', 'w') as fh: + with open('out/httplib.cc', 'w') as fc: + fc.write('#include "httplib.h"\n') + fc.write('namespace httplib {\n') + for line in lines: + isBorderLine = border in line + if isBorderLine: + inImplementation = not inImplementation + else: + if inImplementation: + fc.write(line.replace('inline ', '')) + pass + else: + fh.write(line) + pass + fc.write('} // namespace httplib\n')