FreeCAD

Форк
0
/
PythonTypeExt.cpp 
52 строки · 2.3 Кб
1
// SPDX-License-Identifier: LGPL-2.1-or-later
2

3
/***************************************************************************
4
 *   Copyright (c) 2023 Werner Mayer <wmayer[at]users.sourceforge.net>     *
5
 *   Copyright (c) 2023 Mario Passaglia <mpassaglia[at]cbc.uba.ar>         *
6
 *                                                                         *
7
 *   This file is part of FreeCAD.                                         *
8
 *                                                                         *
9
 *   FreeCAD is free software: you can redistribute it and/or modify it    *
10
 *   under the terms of the GNU Lesser General Public License as           *
11
 *   published by the Free Software Foundation, either version 2.1 of the  *
12
 *   License, or (at your option) any later version.                       *
13
 *                                                                         *
14
 *   FreeCAD is distributed in the hope that it will be useful, but        *
15
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
16
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
17
 *   Lesser General Public License for more details.                       *
18
 *                                                                         *
19
 *   You should have received a copy of the GNU Lesser General Public      *
20
 *   License along with FreeCAD. If not, see                               *
21
 *   <https://www.gnu.org/licenses/>.                                      *
22
 *                                                                         *
23
 **************************************************************************/
24

25
#include "PreCompiled.h"
26
#include <CXX/Extensions.hxx>
27

28
#include <Base/PythonTypeExt.h>
29

30

31
using namespace Base;
32

33
PythonTypeExt::PythonTypeExt(Py::PythonType& type)
34
    : pytype(type)
35
{}
36

37
Py::PythonType& PythonTypeExt::set_tp_descr_get(PyObject* (*tp_descr_get)(PyObject* self,
38
                                                                          PyObject* obj,
39
                                                                          PyObject* type))
40
{
41
    pytype.type_object()->tp_descr_get = tp_descr_get;
42

43
    return pytype;
44
}
45

46
Py::PythonType&
47
PythonTypeExt::set_tp_descr_set(int (*tp_descr_set)(PyObject* self, PyObject* obj, PyObject* value))
48
{
49
    pytype.type_object()->tp_descr_set = tp_descr_set;
50

51
    return pytype;
52
}
53

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.