|
1 | 1 | // python-exiv2 - Python interface to libexiv2 |
2 | 2 | // http://github.com/jim-easterbrook/python-exiv2 |
3 | | -// Copyright (C) 2021-24 Jim Easterbrook [email protected] |
| 3 | +// Copyright (C) 2021-25 Jim Easterbrook [email protected] |
4 | 4 | // |
5 | 5 | // This program is free software: you can redistribute it and/or modify |
6 | 6 | // it under the terms of the GNU General Public License as published by |
@@ -265,44 +265,9 @@ DEPRECATED_ENUM(XmpValue, XmpStruct, "XMP structure indicator.", |
265 | 265 | %noexception type_name::append; |
266 | 266 | %noexception type_name::count; |
267 | 267 | %noexception type_name::size; |
268 | | -%extend type_name { |
269 | | - part_name(const Exiv2::Value& value) { |
270 | | - // deprecated since 2022-12-28 |
271 | | - PyErr_WarnEx(PyExc_DeprecationWarning, |
272 | | - "Use '" #type_name ".clone()' to copy value", 1); |
273 | | - type_name* pv = dynamic_cast< type_name* >(value.clone().release()); |
274 | | - if (pv == 0) { |
275 | | - std::string msg = "Cannot cast type '"; |
276 | | - msg += Exiv2::TypeInfo::typeName(value.typeId()); |
277 | | - msg += "' to type '"; |
278 | | - msg += Exiv2::TypeInfo::typeName(type_name().typeId()); |
279 | | - msg += "'."; |
280 | | -#if EXIV2_VERSION_HEX < 0x001c0000 |
281 | | - throw Exiv2::Error(Exiv2::kerErrorMessage, msg); |
282 | | -#else |
283 | | - throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, msg); |
284 | | -#endif |
285 | | - } |
286 | | - return pv; |
287 | | - } |
288 | | -} |
289 | 268 | UNIQUE_PTR(type_name) |
290 | 269 | %enddef // VALUE_SUBCLASS |
291 | 270 |
|
292 | | -// Subscript macro for classes that can only hold one value |
293 | | -%define SUBSCRIPT_SINGLE(type_name, item_type, method) |
294 | | -%feature("python:slot", "sq_item", functype="ssizeargfunc") |
295 | | - type_name::__getitem__; |
296 | | -%extend type_name { |
297 | | - item_type __getitem__(long single_idx) { |
298 | | - // deprecated since 2022-12-15 |
299 | | - PyErr_WarnEx(PyExc_DeprecationWarning, |
300 | | - "Use 'value = " #type_name "." #method "()'", 1); |
301 | | - return $self->method(); |
302 | | - } |
303 | | -} |
304 | | -%enddef // SUBSCRIPT_SINGLE |
305 | | - |
306 | 271 | // Macro for Exiv2::ValueType classes |
307 | 272 | %define VALUETYPE(type_name, item_type, type_id) |
308 | 273 | VALUE_SUBCLASS(Exiv2::ValueType<item_type>, type_name) |
@@ -529,11 +494,6 @@ VALUE_SUBCLASS(Exiv2::LangAltValue, LangAltValue) |
529 | 494 | VALUE_SUBCLASS(Exiv2::XmpArrayValue, XmpArrayValue) |
530 | 495 | VALUE_SUBCLASS(Exiv2::XmpTextValue, XmpTextValue) |
531 | 496 |
|
532 | | -SUBSCRIPT_SINGLE(Exiv2::DateValue, Exiv2::DateValue::Date, getDate) |
533 | | -SUBSCRIPT_SINGLE(Exiv2::TimeValue, Exiv2::TimeValue::Time, getTime) |
534 | | -SUBSCRIPT_SINGLE(Exiv2::StringValueBase, std::string, toString) |
535 | | -SUBSCRIPT_SINGLE(Exiv2::XmpTextValue, std::string, toString) |
536 | | - |
537 | 497 | // Allow access to Exiv2::StringValueBase and Exiv2::XmpTextValue raw data |
538 | 498 | %define RAW_STRING_DATA(class) |
539 | 499 | RETURN_VIEW(const char* data, arg1->value_.size(), PyBUF_READ, |
|
0 commit comments