Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Side by Side Diff: fpdfsdk/include/fpdf_dataavail.h

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef _FPDF_DATAAVAIL_H_ 7 #ifndef _FPDF_DATAAVAIL_H_
8 #define _FPDF_DATAAVAIL_H_ 8 #define _FPDF_DATAAVAIL_H_
9 9
10 #ifndef _FPDFVIEW_H_ 10 #ifndef _FPDFVIEW_H_
11 #include "fpdfview.h" 11 #include "fpdfview.h"
12 #endif 12 #endif
13 13
14
15 /** The result of the process which check linearized PDF. */ 14 /** The result of the process which check linearized PDF. */
16 #define FSDK_IS_LINEARIZED» » » 1 15 #define FSDK_IS_LINEARIZED 1
17 #define FSDK_NOT_LINEARIZED» » » 0 16 #define FSDK_NOT_LINEARIZED 0
18 #define FSDK_UNKNOW_LINEARIZED» » -1 17 #define FSDK_UNKNOW_LINEARIZED -1
19
20 18
21 #ifdef __cplusplus 19 #ifdef __cplusplus
22 extern "C" { 20 extern "C" {
23 #endif 21 #endif
24 22
25 /** 23 /**
26 * Interface: FX_FILEAVAIL 24 * Interface: FX_FILEAVAIL
27 *» » » Interface for checking whether the section of the file i s available. 25 *» » » Interface for checking whether the section of the file i s
26 *available.
28 */ 27 */
29 typedef struct _FX_FILEAVAIL { 28 typedef struct _FX_FILEAVAIL {
30 » /** 29 /**
31 » * Version number of the interface. Currently must be 1. 30 * Version number of the interface. Currently must be 1.
32 » */ 31 */
33 » int version; 32 int version;
34 33
35 » /** 34 /**
36 » * Method: IsDataAvail 35 * Method: IsDataAvail
37 » *» » Report whether the specified data section is available. A section is available only if all bytes in the section is available. 36 *» » Report whether the specified data section is available. A sectio n is
38 » * Interface Version: 37 *available only if all bytes in the section is available.
39 » *» » 1 38 * Interface Version:
40 » * Implementation Required: 39 *» » 1
41 » *» » Yes 40 * Implementation Required:
42 » * Parameters: 41 *» » Yes
43 » *» » pThis» » -» Pointer to the interface structu re itself. 42 * Parameters:
44 » *» » offset» » -» The offset of the data section i n the file. 43 *» » pThis» » -» Pointer to the interface structure
45 » *» » size» » -» The size of the data section 44 *itself.
46 » * Return Value: 45 *» » offset» » -» The offset of the data section in the
47 » *» » true means the specified data section is available. 46 *file.
48 » * Comments: 47 *» » size» » -» The size of the data section
49 » *» » Called by Foxit SDK to check whether the data section is ready. 48 * Return Value:
50 » */ 49 *» » true means the specified data section is available.
51 » bool (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t s ize); 50 * Comments:
51 *» » Called by Foxit SDK to check whether the data section is ready.
52 */
53 bool (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size);
52 } FX_FILEAVAIL; 54 } FX_FILEAVAIL;
53 55
54 typedef void* FPDF_AVAIL; 56 typedef void* FPDF_AVAIL;
55 57
56 /** 58 /**
57 * Function: FPDFAvail_Create 59 * Function: FPDFAvail_Create
58 * Create a document availability provider. 60 * Create a document availability provider.
59 * 61 *
60 * Parameters: 62 * Parameters:
61 *» » » file_avail» -» Pointer to file availability int erface to check availability of file data. 63 *» » » file_avail» -» Pointer to file availability
62 *» » » file» » -» Pointer to a file access interfa ce for reading data from file. 64 *interface to check availability of file data.
65 *» » » file» » -» Pointer to a file access
66 *interface for reading data from file.
63 * Return value: 67 * Return value:
64 *» » » A handle to the document availability provider. NULL for error. 68 *» » » A handle to the document availability provider. NULL for
69 *error.
65 * Comments: 70 * Comments:
66 *» » » Application must call FPDFAvail_Destroy when done with t he availability provider. 71 *» » » Application must call FPDFAvail_Destroy when done with t he
72 *availability provider.
67 */ 73 */
68 DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FIL EACCESS* file); 74 DLLEXPORT FPDF_AVAIL STDCALL
75 FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FILEACCESS* file);
69 76
70 /** 77 /**
71 * Function: FPDFAvail_Destroy 78 * Function: FPDFAvail_Destroy
72 * Destroy a document availibity provider. 79 * Destroy a document availibity provider.
73 * 80 *
74 * Parameters: 81 * Parameters:
75 *» » » avail» » -» Handle to document availability provider returned by FPDFAvail_Create 82 *» » » avail» » -» Handle to document availability
83 *provider returned by FPDFAvail_Create
76 * Return Value: 84 * Return Value:
77 * None. 85 * None.
78 */ 86 */
79 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail); 87 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail);
80 88
81 /** 89 /**
82 * Interface: FX_DOWNLOADHINTS 90 * Interface: FX_DOWNLOADHINTS
83 *» » » Download hints interface. Used to receive hints for furt her downloading. 91 *» » » Download hints interface. Used to receive hints for furt her
92 *downloading.
84 */ 93 */
85 typedef struct _FX_DOWNLOADHINTS { 94 typedef struct _FX_DOWNLOADHINTS {
86 » /** 95 /**
87 » * Version number of the interface. Currently must be 1. 96 * Version number of the interface. Currently must be 1.
88 » */ 97 */
89 » int version; 98 int version;
90 99
91 » /** 100 /**
92 » * Method: AddSegment 101 * Method: AddSegment
93 » *» » Add a section to be downloaded. 102 *» » Add a section to be downloaded.
94 » * Interface Version: 103 * Interface Version:
95 » *» » 1 104 *» » 1
96 » * Implementation Required: 105 * Implementation Required:
97 » *» » Yes 106 *» » Yes
98 » * Parameters: 107 * Parameters:
99 » *» » pThis» » -» Pointer to the interface structu re itself. 108 *» » pThis» » -» Pointer to the interface structure
100 » *» » offset» » -» The offset of the hint reported to be downloaded. 109 *itself.
101 » *» » size» » -» The size of the hint reported to be downloaded. 110 *» » offset» » -» The offset of the hint reported to be
102 » * Return Value: 111 *downloaded.
103 » *» » None. 112 *» » size» » -» The size of the hint reported to be
104 » * Comments: 113 *downloaded.
105 » *» » Called by Foxit SDK to report some downloading hints for download manager. 114 * Return Value:
106 » *» » The position and size of section may be not accurate, pa rt of the section might be already available. 115 *» » None.
107 » *» » The download manager must deal with that to maximize dow nload efficiency. 116 * Comments:
108 » */ 117 *» » Called by Foxit SDK to report some downloading hints for downloa d
109 » void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, size_t offset, size_ t size); 118 *manager.
119 *» » The position and size of section may be not accurate, part of th e
120 *section might be already available.
121 *» » The download manager must deal with that to maximize download
122 *efficiency.
123 */
124 void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis,
125 size_t offset,
126 size_t size);
110 } FX_DOWNLOADHINTS; 127 } FX_DOWNLOADHINTS;
111 128
112 /** 129 /**
113 * Function: FPDFAvail_IsDocAvail 130 * Function: FPDFAvail_IsDocAvail
114 *» » » Check whether the document is ready for loading, if not, get download hints. 131 *» » » Check whether the document is ready for loading, if not,
132 *get download hints.
115 * 133 *
116 * Parameters: 134 * Parameters:
117 *» » » avail» » -» Handle to document availability provider returned by FPDFAvail_Create 135 *» » » avail» » -» Handle to document availability
118 *» » » hints» » -» Pointer to a download hints inte rface, receiving generated hints 136 *provider returned by FPDFAvail_Create
137 *» » » hints» » -» Pointer to a download hints
138 *interface, receiving generated hints
119 * Return value: 139 * Return value:
120 *» » » Non-zero for page is fully available, 0 for page not yet available. 140 *» » » Non-zero for page is fully available, 0 for page not yet
141 *available.
121 * Comments: 142 * Comments:
122 *» » » The application should call this function whenever new d ata arrived, and process all the 143 *» » » The application should call this function whenever new
123 *» » » generated download hints if any, until the function retu rns non-zero value. Then the 144 *data arrived, and process all the
124 *» » » application can call FPDFAvail_GetDocument() to get a do cument handle. 145 *» » » generated download hints if any, until the function
146 *returns non-zero value. Then the
147 *» » » application can call FPDFAvail_GetDocument() to get a
148 *document handle.
125 */ 149 */
126 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* h ints); 150 DLLEXPORT int STDCALL
151 FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
127 152
128 /** 153 /**
129 * Function: FPDFAvail_GetDocument 154 * Function: FPDFAvail_GetDocument
130 * Get document from the availability provider. 155 * Get document from the availability provider.
131 * 156 *
132 * Parameters: 157 * Parameters:
133 *» » » avail» » -» Handle to document availability provider returned by FPDFAvail_Create 158 *» » » avail» » -» Handle to document availability
159 *provider returned by FPDFAvail_Create
134 * password - Optional password for decrypting the PDF file. 160 * password - Optional password for decrypting the PDF file.
135 * Return value: 161 * Return value:
136 * Handle to the document. 162 * Handle to the document.
137 * Comments: 163 * Comments:
138 *» » » After FPDFAvail_IsDocAvail() returns TRUE, the applicati on should call this function to 164 *» » » After FPDFAvail_IsDocAvail() returns TRUE, the applicati on
139 *» » » get the document handle. To close the document, use FPDF _CloseDocument function. 165 *should call this function to
166 *» » » get the document handle. To close the document, use
167 *FPDF_CloseDocument function.
140 */ 168 */
141 DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, 169 DLLEXPORT FPDF_DOCUMENT STDCALL
142 FPDF_BYTESTRING password); 170 FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password);
143 171
144 /** 172 /**
145 * Function: FPDFAvail_GetFirstPageNum 173 * Function: FPDFAvail_GetFirstPageNum
146 *» » » Get page number for the first available page in a linear ized PDF 174 *» » » Get page number for the first available page in a
175 *linearized PDF
147 * 176 *
148 * Parameters: 177 * Parameters:
149 *» » » doc» » » -» A document handle return ed by FPDFAvail_GetDocument 178 *» » » doc» » » -» A document handle return ed
179 *by FPDFAvail_GetDocument
150 * Return Value: 180 * Return Value:
151 * Zero-based index for the first available page. 181 * Zero-based index for the first available page.
152 * Comments: 182 * Comments:
153 *» » » For most linearized PDFs, the first available page would be just the first page, however, 183 *» » » For most linearized PDFs, the first available page would
154 *» » » some PDFs might make other page to be the first availabl e page. 184 *be just the first page, however,
155 *» » » For non-linearized PDF, this function will always return zero. 185 *» » » some PDFs might make other page to be the first availabl e
186 *page.
187 *» » » For non-linearized PDF, this function will always return
188 *zero.
156 */ 189 */
157 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); 190 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
158 191
159 /** 192 /**
160 * Function: FPDFAvail_IsPageAvail 193 * Function: FPDFAvail_IsPageAvail
161 *» » » Check whether a page is ready for loading, if not, get d ownload hints. 194 *» » » Check whether a page is ready for loading, if not, get
195 *download hints.
162 * 196 *
163 * Parameters: 197 * Parameters:
164 *» » » avail» » -» Handle to document availability provider returned by FPDFAvail_Create 198 *» » » avail» » -» Handle to document availability
165 *» » » page_index» -» Index number of the page. 0 for the first page. 199 *provider returned by FPDFAvail_Create
166 *» » » hints» » -» Pointer to a download hints inte rface, receiving generated hints 200 *» » » page_index» -» Index number of the page. 0 for
201 *the first page.
202 *» » » hints» » -» Pointer to a download hints
203 *interface, receiving generated hints
167 * Return value: 204 * Return value:
168 *» » » Non-zero for page is fully available, 0 for page not yet available. 205 *» » » Non-zero for page is fully available, 0 for page not yet
206 *available.
169 * Comments: 207 * Comments:
170 *» » » This function call be called only after FPDFAvail_GetDoc ument if called. 208 *» » » This function call be called only after
171 *» » » The application should call this function whenever new d ata arrived, and process all the 209 *FPDFAvail_GetDocument if called.
172 *» » » generated download hints if any, until the function retu rns non-zero value. Then the 210 *» » » The application should call this function whenever new
211 *data arrived, and process all the
212 *» » » generated download hints if any, until the function
213 *returns non-zero value. Then the
173 * application can perform page loading. 214 * application can perform page loading.
174 */ 215 */
175 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, int page_index, FX _DOWNLOADHINTS* hints); 216 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
217 int page_index,
218 FX_DOWNLOADHINTS* hints);
176 219
177 /** 220 /**
178 * Function: FPDFAvail_ISFormAvail 221 * Function: FPDFAvail_ISFormAvail
179 *» » » Check whether Form data is ready for init, if not, get d ownload hints. 222 *» » » Check whether Form data is ready for init, if not, get
223 *download hints.
180 * 224 *
181 * Parameters: 225 * Parameters:
182 *» » » avail» » -» Handle to document availability provider returned by FPDFAvail_Create 226 *» » » avail» » -» Handle to document availability
183 *» » » hints» » -» Pointer to a download hints inte rface, receiving generated hints 227 *provider returned by FPDFAvail_Create
228 *» » » hints» » -» Pointer to a download hints
229 *interface, receiving generated hints
184 * Return value: 230 * Return value:
185 *» » » Non-zero for Form data is fully available, 0 for Form da ta not yet available. 231 *» » » Non-zero for Form data is fully available, 0 for Form da ta
186 *» » » Details: -1 - error, the input parameter not correct, su ch as hints is null. 232 *not yet available.
233 *» » » Details: -1 - error, the input parameter not correct, su ch
234 *as hints is null.
187 * 0 - data not available 235 * 0 - data not available
188 * 1 - data available 236 * 1 - data available
189 *» » » » » 2 - no form data.» » » » 237 *» » » » » 2 - no form data.
190 * Comments: 238 * Comments:
191 *» » » This function call be called only after FPDFAvail_GetDoc ument if called. 239 *» » » This function call be called only after
192 *» » » The application should call this function whenever new d ata arrived, and process all the 240 *FPDFAvail_GetDocument if called.
193 *» » » generated download hints if any, until the function retu rns non-zero value. Then the 241 *» » » The application should call this function whenever new
194 *» » » application can perform page loading. Recommend to call FPDFDOC_InitFormFillEnviroument 242 *data arrived, and process all the
243 *» » » generated download hints if any, until the function
244 *returns non-zero value. Then the
245 *» » » application can perform page loading. Recommend to call
246 *FPDFDOC_InitFormFillEnviroument
195 * after the function returns non-zero value. 247 * after the function returns non-zero value.
196 */ 248 */
197 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); 249 DLLEXPORT int STDCALL
250 FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
198 251
199 /** 252 /**
200 * Function: FPDFAvail_IsLinearized 253 * Function: FPDFAvail_IsLinearized
201 * To check whether a document is Linearized PDF file. 254 * To check whether a document is Linearized PDF file.
202 * 255 *
203 * Parameters: 256 * Parameters:
204 *» » » avail» » -» Handle to document availability provider returned by FPDFAvail_Create 257 *» » » avail» » -» Handle to document availability
258 *provider returned by FPDFAvail_Create
205 * Return value: 259 * Return value:
206 *» » » return TRUE means the document is linearized PDF else no t. 260 *» » » return TRUE means the document is linearized PDF else
261 *not.
207 * FSDK_IS_LINEARIZED is a linearize file. 262 * FSDK_IS_LINEARIZED is a linearize file.
208 * FSDK_NOT_LINEARIZED is not a linearize file. 263 * FSDK_NOT_LINEARIZED is not a linearize file.
209 *» » » FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize file. 264 *» » » FSDK_UNKNOW_LINEARIZED don't know whether the file is a
265 *linearize file.
210 * Comments: 266 * Comments:
211 *» » » It return TRUE/FALSE as soon as we have first 1K data. » If the file's size less than 267 *» » » It return TRUE/FALSE as soon as we have first 1K data.
268 *If the file's size less than
212 * 1K,we don't known whether the PDF is a linearized file. 269 * 1K,we don't known whether the PDF is a linearized file.
213 * 270 *
214 */ 271 */
215 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); 272 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
216 273
217 #ifdef __cplusplus 274 #ifdef __cplusplus
218 }; 275 };
219 #endif 276 #endif
220 277
221 #endif 278 #endif
222
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698