@@ -21,11 +21,16 @@ from cpython.ref cimport PyObject
21
21
22
22
from libc.stdint cimport uint32_t, uint64_t
23
23
from libcpp cimport bool
24
- from libcpp.memory cimport shared_ptr
24
+ from libcpp.memory cimport shared_ptr, unique_ptr
25
25
from libcpp.string cimport string
26
26
from libcpp.vector cimport vector
27
27
28
28
29
+ cdef extern from " zim/zim.h" namespace " zim" :
30
+ ctypedef uint64_t size_type
31
+ ctypedef uint64_t offset_type
32
+
33
+
29
34
cdef extern from " zim/blob.h" namespace " zim" :
30
35
cdef cppclass Blob:
31
36
Blob() except +
@@ -34,19 +39,20 @@ cdef extern from "zim/blob.h" namespace "zim":
34
39
const char * end() except +
35
40
uint64_t size() except +
36
41
42
+
37
43
cdef extern from " zim/writer/url.h" namespace " zim::writer" :
38
44
cdef cppclass Url:
39
45
string getLongUrl() except +
40
46
41
47
42
48
cdef extern from " zim/writer/article.h" namespace " zim::writer" :
43
- cdef cppclass Article:
44
- const string getTitle() except +
45
-
49
+ cdef cppclass WriterArticle:
50
+ pass
46
51
47
52
cdef extern from " lib.h" :
48
- cdef cppclass ZimArticleWrapper(Article ):
53
+ cdef cppclass ZimArticleWrapper(WriterArticle ):
49
54
ZimArticleWrapper(PyObject * obj) except +
55
+ const string getTitle() except +
50
56
const Url getUrl() except +
51
57
const string getTitle() except +
52
58
const bool isRedirect() except +
@@ -64,3 +70,72 @@ cdef extern from "lib.h":
64
70
void finalize() nogil except +
65
71
Url getMainUrl() except +
66
72
void setMainUrl(string) except +
73
+
74
+
75
+ cdef extern from " zim/article.h" namespace " zim" :
76
+ cdef cppclass Article:
77
+ Article() except +
78
+
79
+ string getTitle() except +
80
+ string getUrl() except +
81
+ string getLongUrl() except +
82
+ string getMimeType() except +
83
+ char getNamespace() except +
84
+ bint good() except +
85
+
86
+ const Blob getData(size_type offset) except +
87
+
88
+ bint isRedirect() except +
89
+ bint isLinktarget() except +
90
+ bint isDeleted() except +
91
+
92
+ Article getRedirectArticle() except +
93
+
94
+
95
+ cdef extern from " zim/fileheader.h" namespace " zim" :
96
+ cdef cppclass Fileheader:
97
+ bint hasMainPage() except +
98
+ size_type getMainPage() except +
99
+
100
+
101
+ cdef extern from " zim/search_iterator.h" namespace " zim" :
102
+ cdef cppclass search_iterator:
103
+ search_iterator()
104
+ search_iterator operator++ ()
105
+ bint operator== (search_iterator)
106
+ bint operator!= (search_iterator)
107
+ string get_url()
108
+ string get_title()
109
+
110
+
111
+ cdef extern from " zim/search.h" namespace " zim" :
112
+ cdef cppclass Search:
113
+ Search(const File* zimfile)
114
+ Search(vector[const File] zimfiles)
115
+ search_iterator begin()
116
+ search_iterator end()
117
+ int get_matches_estimated()
118
+
119
+
120
+ cdef extern from " zim/file.h" namespace " zim" :
121
+ cdef cppclass File:
122
+ File() except +
123
+ File(string filename) except +
124
+
125
+ Article getArticle(size_type idx) except +
126
+ Article getArticle(char ns, string url) except +
127
+ Article getArticleByUrl(string url) except +
128
+
129
+ string getMetadata(string name) except +
130
+
131
+ Fileheader getFileheader() except +
132
+
133
+ size_type getCountArticles() except +
134
+ size_type getNamespaceCount(char ns) except +
135
+
136
+ string getNamespaces() except +
137
+ string getChecksum() except +
138
+ string getFilename() except +
139
+
140
+ unique_ptr[Search] search(const string query, int start, int end);
141
+ unique_ptr[Search] suggestions(const string query, int start, int end);
0 commit comments