From: Martin Ling Date: Sun, 25 Oct 2015 01:57:26 +0000 (+0000) Subject: C++: Declare namespace in enums.hpp so it can be used independently. X-Git-Tag: libsigrok-0.4.0~162 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ace872d5296ab7352e94f09746c574db256c07d6;p=libsigrok.git C++: Declare namespace in enums.hpp so it can be used independently. --- diff --git a/bindings/cxx/enums.py b/bindings/cxx/enums.py index 4e6be7ba..3ce73bc4 100644 --- a/bindings/cxx/enums.py +++ b/bindings/cxx/enums.py @@ -75,6 +75,8 @@ swig = open(os.path.join(outdirname, 'swig/enums.i'), 'w') for file in (header, code): print("/* Generated file - edit enums.py instead! */", file=file) +print("namespace sigrok {", file=header) + # Template for beginning of class declaration and public members. header_public_template = """ /** {brief} */ @@ -176,3 +178,5 @@ for enum, (classname, classbrief) in classes.items(): filename = os.path.join(dirname, "%s_methods.i" % classname) if os.path.exists(filename): print(str.join('', open(filename).readlines()), file=swig) + +print("}", file=header) diff --git a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp index 620e45eb..48111b87 100644 --- a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp +++ b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp @@ -986,8 +986,8 @@ private: const string _name; }; -#include - } +#include + #endif diff --git a/bindings/swig/classes.i b/bindings/swig/classes.i index b87bbe1b..523995da 100644 --- a/bindings/swig/classes.i +++ b/bindings/swig/classes.i @@ -217,6 +217,4 @@ typedef std::map %include "swig/enums.i" -namespace sigrok { %include -}