Initial import package dbus-python: D-Bus Python Bindings
[profile/ivi/dbus-python.git] / _dbus_bindings / types-internal.h
1 /* D-Bus types: implementation internals
2  *
3  * Copyright (C) 2006-2007 Collabora Ltd. <http://www.collabora.co.uk/>
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without
8  * restriction, including without limitation the rights to use, copy,
9  * modify, merge, publish, distribute, sublicense, and/or sell copies
10  * of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  */
25
26 #include <Python.h>
27 #include <stdint.h>
28
29 #include "dbus_bindings-internal.h"
30
31 #ifndef DBUS_BINDINGS_TYPES_INTERNAL_H
32 #define DBUS_BINDINGS_TYPES_INTERNAL_H
33
34 extern PyTypeObject DBusPyIntBase_Type;
35 DEFINE_CHECK(DBusPyIntBase)
36
37 typedef struct {
38     PyIntObject base;
39     long variant_level;
40 } DBusPyIntBase;
41
42 extern PyTypeObject DBusPyLongBase_Type;
43 DEFINE_CHECK(DBusPyLongBase)
44
45 extern PyTypeObject DBusPyFloatBase_Type;
46 DEFINE_CHECK(DBusPyFloatBase)
47
48 typedef struct {
49     PyFloatObject base;
50     long variant_level;
51 } DBusPyFloatBase;
52
53 typedef struct {
54     PyUnicodeObject unicode;
55     long variant_level;
56 } DBusPyString;
57
58 extern PyTypeObject DBusPyStrBase_Type;
59 DEFINE_CHECK(DBusPyStrBase)
60
61 dbus_int16_t dbus_py_int16_range_check(PyObject *);
62 dbus_uint16_t dbus_py_uint16_range_check(PyObject *);
63 dbus_int32_t dbus_py_int32_range_check(PyObject *);
64 dbus_uint32_t dbus_py_uint32_range_check(PyObject *);
65
66 #if defined(DBUS_HAVE_INT64) && defined(HAVE_LONG_LONG)
67 #   define DBUS_PYTHON_64_BIT_WORKS 1
68 dbus_int64_t dbus_py_int64_range_check(PyObject *);
69 dbus_uint64_t dbus_py_uint64_range_check(PyObject *);
70 #else
71 #   undef DBUS_PYTHON_64_BIT_WORKS
72 #endif /* defined(DBUS_HAVE_INT64) && defined(HAVE_LONG_LONG) */
73
74 extern PyObject *dbus_py_variant_level_const;
75 extern PyObject *dbus_py_signature_const;
76 extern PyObject *dbus_py__dbus_object_path__const;
77
78 typedef struct {
79     PyListObject super;
80     PyObject *signature;
81     long variant_level;
82 } DBusPyArray;
83
84 typedef struct {
85     PyDictObject super;
86     PyObject *signature;
87     long variant_level;
88 } DBusPyDict;
89
90 PyObject *dbus_py_variant_level_getattro(PyObject *obj, PyObject *name);
91 dbus_bool_t dbus_py_variant_level_set(PyObject *obj, long variant_level);
92 void dbus_py_variant_level_clear(PyObject *obj);
93 long dbus_py_variant_level_get(PyObject *obj);
94
95 #endif