Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
helpers.h
Go to the documentation of this file.
1
/*
2
* Copyright 2006, 2007 Aaron Spike <aaron@ekips.org>
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it either under the terms of the GNU Lesser General Public
6
* License version 2.1 as published by the Free Software Foundation
7
* (the "LGPL") or, at your option, under the terms of the Mozilla
8
* Public License Version 1.1 (the "MPL"). If you do not alter this
9
* notice, a recipient may use your version of this file under either
10
* the MPL or the LGPL.
11
*
12
* You should have received a copy of the LGPL along with this library
13
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
* You should have received a copy of the MPL along with this library
16
* in the file COPYING-MPL-1.1
17
*
18
* The contents of this file are subject to the Mozilla Public License
19
* Version 1.1 (the "License"); you may not use this file except in
20
* compliance with the License. You may obtain a copy of the License at
21
* http://www.mozilla.org/MPL/
22
*
23
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
24
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
25
* the specific language governing rights and limitations.
26
*
27
*/
28
29
#ifndef SEEN_PY2GEOM_HELPERS_H
30
#define SEEN_PY2GEOM_HELPERS_H
31
32
#include <boost/python.hpp>
33
34
template
<
typename
T,
typename
R,
unsigned
D>
35
R
python_getitem
(T
const
& p,
int
index
)
36
{
37
unsigned
i =
index
;
38
if
(
index
< 0)
39
{
40
i =
index
=
D
+
index
;
41
}
42
if
((
index
< 0) || (i > (
D
- 1))) {
43
PyErr_SetString(PyExc_IndexError,
"index out of range"
);
44
boost::python::throw_error_already_set();
45
}
46
return
p[i];
47
}
48
49
#endif
50
/*
51
Local Variables:
52
mode:c++
53
c-file-style:"stroustrup"
54
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
55
indent-tabs-mode:nil
56
fill-column:99
57
End:
58
*/
59
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SPAttr::R
@ R
SPAttr::D
@ D
python_getitem
R python_getitem(T const &p, int index)
Definition
helpers.h:35
index
int index
Definition
tab-strip.cpp:875
src
3rdparty
2geom
src
py2geom
helpers.h
Generated on Sun Jun 22 2025 04:01:53 for Inkscape by
1.9.8