Skip to content

Commit 4cc8656

Browse files
Slightly simplify enum fragments
1 parent 5ed1f06 commit 4cc8656

29 files changed

Lines changed: 3 additions & 149 deletions

src/interface/shared/enum.i

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// python-exiv2 - Python interface to libexiv2
1+
// // python-exiv2 - Python interface to libexiv2
22
// http://github.com/jim-easterbrook/python-exiv2
33
// Copyright (C) 2023-25 Jim Easterbrook jim@jim-easterbrook.me.uk
44
//
@@ -83,7 +83,7 @@ static PyObject* _create_enum_%mangle(pattern)(
8383
$1 = static_cast< $1_type >(PyLong_AsLong($input));
8484
}
8585

86-
%fragment("py_from_enum_ex"{pattern}, "header",
86+
%fragment("py_from_enum"{pattern}, "header",
8787
fragment="get_enum_typeobject"{pattern}) {
8888
static PyObject* py_from_enum_%mangle(pattern)(long value) {
8989
PyObject* py_int = PyLong_FromLong(value);
@@ -100,13 +100,7 @@ static PyObject* py_from_enum_%mangle(pattern)(long value) {
100100
return result;
101101
};
102102
}
103-
%fragment("py_from_enum"{pattern}, "header",
104-
fragment="py_from_enum_ex"{pattern}) {
105-
static PyObject* py_from_enum(pattern value) {
106-
return py_from_enum_%mangle(pattern)(static_cast<long>(value));
107-
};
108-
}
109-
%typemap(out, fragment="py_from_enum_ex"{pattern}) pattern {
103+
%typemap(out, fragment="py_from_enum"{pattern}) pattern {
110104
$result = py_from_enum_%mangle(pattern)(static_cast<long>($1));
111105
if (!$result)
112106
SWIG_fail;

src/swig-0_27_7/basicio_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4241,11 +4241,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42414241
};
42424242

42434243

4244-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4245-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4246-
};
4247-
4248-
42494244
#ifdef _WIN32
42504245
#include <windows.h>
42514246
#endif

src/swig-0_27_7/datasets_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,11 +4263,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42634263
};
42644264

42654265

4266-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4267-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4268-
};
4269-
4270-
42714266
#ifdef _WIN32
42724267
#include <windows.h>
42734268
#endif

src/swig-0_27_7/easyaccess_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4219,11 +4219,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42194219
};
42204220

42214221

4222-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4223-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4224-
};
4225-
4226-
42274222
#ifdef _WIN32
42284223
#include <windows.h>
42294224
#endif

src/swig-0_27_7/exif_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4279,11 +4279,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42794279
};
42804280

42814281

4282-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4283-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4284-
};
4285-
4286-
42874282
#ifdef _WIN32
42884283
#include <windows.h>
42894284
#endif

src/swig-0_27_7/image_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,11 +4292,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42924292
};
42934293

42944294

4295-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4296-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4297-
};
4298-
4299-
43004295
#ifdef _WIN32
43014296
#include <windows.h>
43024297
#endif

src/swig-0_27_7/iptc_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,11 +4277,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42774277
};
42784278

42794279

4280-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4281-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4282-
};
4283-
4284-
42854280
#ifdef _WIN32
42864281
#include <windows.h>
42874282
#endif

src/swig-0_27_7/metadatum_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,11 +4263,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42634263
};
42644264

42654265

4266-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4267-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4268-
};
4269-
4270-
42714266
#ifdef _WIN32
42724267
#include <windows.h>
42734268
#endif

src/swig-0_27_7/preview_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4442,11 +4442,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
44424442
};
44434443

44444444

4445-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4446-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4447-
};
4448-
4449-
44504445
#ifdef _WIN32
44514446
#include <windows.h>
44524447
#endif

src/swig-0_27_7/properties_wrap.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,11 +4265,6 @@ static PyObject* py_from_enum_Exiv2_ErrorCode(long value) {
42654265
};
42664266

42674267

4268-
static PyObject* py_from_enum(Exiv2::ErrorCode value) {
4269-
return py_from_enum_Exiv2_ErrorCode(static_cast<long>(value));
4270-
};
4271-
4272-
42734268
#ifdef _WIN32
42744269
#include <windows.h>
42754270
#endif

0 commit comments

Comments
 (0)