Add <string> fragment

Removes <string> include specifically for clang
Cuts down on duplicate #include <string> in general
This commit is contained in:
William S Fulton 2014-02-15 23:30:14 +00:00
commit bd5c340062
9 changed files with 17 additions and 32 deletions

View file

@ -8,9 +8,8 @@
%apply size_t { std::size_t }; %apply size_t { std::size_t };
%fragment("<string>");
%{ %{
#include <string>
double SwigSvToNumber(SV* sv) { double SwigSvToNumber(SV* sv) {
return SvIOK(sv) ? double(SvIVX(sv)) : SvNVX(sv); return SvIOK(sv) ? double(SvIVX(sv)) : SvNVX(sv);
} }

View file

@ -195,9 +195,8 @@ namespace swig {
// //
#ifdef SWIG_PYTHON_BACKWARD_COMP #ifdef SWIG_PYTHON_BACKWARD_COMP
%fragment("<string>");
%{ %{
#include <string>
PyObject* SwigInt_FromBool(bool b) { PyObject* SwigInt_FromBool(bool b) {
return PyInt_FromLong(b ? 1L : 0L); return PyInt_FromLong(b ? 1L : 0L);
} }

View file

@ -3,10 +3,7 @@
%include <std_alloc.i> %include <std_alloc.i>
%include <std_char_traits.i> %include <std_char_traits.i>
%fragment("<string>");
%{
#include <string>
%}
namespace std namespace std
{ {

View file

@ -23,8 +23,8 @@
// Common code for supporting the C++ std namespace // Common code for supporting the C++ std namespace
// //
%fragment("<string>");
%{ %{
#include <string>
#include <stdexcept> #include <stdexcept>
#include <stddef.h> #include <stddef.h>
%} %}
@ -73,13 +73,7 @@ namespace std {
#endif #endif
%} %}
%fragment("StdStringInclude","header") %{ %fragment("StdTraitsCommon","header",fragment="<string>") %{
#ifdef __clang__
#include <string>
#endif
%}
%fragment("StdTraitsCommon","header",fragment="StdStringInclude") %{
namespace swig { namespace swig {
template <class Type> template <class Type>
struct noconst_traits { struct noconst_traits {

View file

@ -28,11 +28,11 @@
// is returned // is returned
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
%fragment("<string>");
%{ %{
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <string>
Tcl_Obj* SwigString_FromString(const std::string &s) { Tcl_Obj* SwigString_FromString(const std::string &s) {
return Tcl_NewStringObj(s.data(), (int)s.length()); return Tcl_NewStringObj(s.data(), (int)s.length());

View file

@ -149,8 +149,12 @@
#endif #endif
%} %}
%fragment("<stddef.h>", "header") %{ %fragment("<stddef.h>", "header") %{
#include <stddef.h> #include <stddef.h>
%}
%fragment("<string>", "header") %{
#include <string>
%} %}
%fragment("SWIG_isfinite","header",fragment="<math.h>,<float.h>") %{ %fragment("SWIG_isfinite","header",fragment="<math.h>,<float.h>") %{

View file

@ -8,9 +8,7 @@
%include <typemaps/std_strings.swg> %include <typemaps/std_strings.swg>
%{ %fragment("<string>");
#include <string>
%}
namespace std namespace std
{ {

View file

@ -7,8 +7,8 @@
%{ %{
#include <cwchar> #include <cwchar>
#include <string>
%} %}
%fragment("<string>");
namespace std namespace std
{ {

View file

@ -21,18 +21,12 @@
// Common code for supporting the STD C++ namespace // Common code for supporting the STD C++ namespace
// //
%fragment("<string>");
%{ %{
#include <string>
#include <stdexcept> #include <stdexcept>
%} %}
%fragment("StdStringInclude","header") %{ %fragment("Traits","header",fragment="<string>")
#ifdef __clang__
#include <string>
#endif
%}
%fragment("Traits","header",fragment="StdStringInclude")
{ {
namespace swig { namespace swig {
/* /*