]> git.cworth.org Git - obsolete/notmuch-old/blob - bindings/python/notmuch/globals.py
Merge tag '0.13.2'
[obsolete/notmuch-old] / bindings / python / notmuch / globals.py
1 """
2 This file is part of notmuch.
3
4 Notmuch is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation, either version 3 of the License, or (at your
7 option) any later version.
8
9 Notmuch is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with notmuch.  If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
18 """
19
20 from ctypes import CDLL, Structure, POINTER
21
22 #-----------------------------------------------------------------------------
23 #package-global instance of the notmuch library
24 try:
25     nmlib = CDLL("libnotmuch.so.3")
26 except:
27     raise ImportError("Could not find shared 'notmuch' library.")
28
29 from .compat import Python3StringMixIn, encode_utf8 as _str
30
31 class Enum(object):
32     """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
33     def __init__(self, names):
34         for number, name in enumerate(names):
35             setattr(self, name, number)
36
37
38 class NotmuchDatabaseS(Structure):
39     pass
40 NotmuchDatabaseP = POINTER(NotmuchDatabaseS)
41
42
43 class NotmuchQueryS(Structure):
44     pass
45 NotmuchQueryP = POINTER(NotmuchQueryS)
46
47
48 class NotmuchThreadsS(Structure):
49     pass
50 NotmuchThreadsP = POINTER(NotmuchThreadsS)
51
52
53 class NotmuchThreadS(Structure):
54     pass
55 NotmuchThreadP = POINTER(NotmuchThreadS)
56
57
58 class NotmuchMessagesS(Structure):
59     pass
60 NotmuchMessagesP = POINTER(NotmuchMessagesS)
61
62
63 class NotmuchMessageS(Structure):
64     pass
65 NotmuchMessageP = POINTER(NotmuchMessageS)
66
67
68 class NotmuchTagsS(Structure):
69     pass
70 NotmuchTagsP = POINTER(NotmuchTagsS)
71
72
73 class NotmuchDirectoryS(Structure):
74     pass
75 NotmuchDirectoryP = POINTER(NotmuchDirectoryS)
76
77
78 class NotmuchFilenamesS(Structure):
79     pass
80 NotmuchFilenamesP = POINTER(NotmuchFilenamesS)