00001 /* 00002 * This file is part of browser. 00003 * 00004 * browser is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * browser is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00026 /* browser - A mozilla based browser application on the eReader platform 00027 * Copyright (C) 2005-2008 iRex Technologies B.V. 00028 * 00029 */ 00030 #ifndef __INDEXFILEHANDLER_H__ 00031 #define __INDEXFILEHANDLER_H__ 00032 00033 #define INVALID_PAGE_COUNT (-1) 00034 #define INVALID_PAGE_NMBR (-1) 00035 #define DEFAULT_PAGE_COUNT 1 00036 #define DEFAULT_PAGE 1 00037 #define DEFAULT_PAGE_OFFSET 100 00038 #define INVALID_PAGE_TYPE "unknown" 00039 #define INIT_PAGE_TYPE "init" 00040 #define ONE_PAGE_TYPE "one_page" 00041 00042 typedef struct _PageTypeInfo { 00043 int searchedCount; 00044 int currentCount; 00045 char* searchedType; 00046 char* currentType; 00047 } PageTypeInfo; 00048 00049 typedef struct _PageNmbrInfo { 00050 int searchedNmbr; 00051 int currentNmbr; 00052 char* searchedPage; 00053 char* currentPage; 00054 } PageNmbrInfo; 00055 00056 typedef struct _PageUrlInfo { 00057 char* searchedPage; 00058 char* currentPage; 00059 char* searchedType; 00060 char* currentType; 00061 int searchedNmbr; 00062 int currentNmbr; 00063 } PageUrlInfo; 00064 00065 /* 00066 Current manifest index file 00067 <pagelist type="paper" count="3"> 00068 <page number="1" url="001/index.html"/> 00069 <page number="2" url="002/index.html"/> 00070 <page number="3" url="003/index.html"/> 00071 </pagelist> 00072 00073 <pagelist type="layout" count="3"> 00074 <page number="1" url="001/overview.html"/> 00075 <page number="2" url="002/overview.html"/> 00076 <page number="3" url="003/overview.html"/> 00077 </pagelist> 00078 00079 <pagelist type="articles" count="3"> 00080 <page number="1" url="001/summary.html"/> 00081 <page number="2" url="002/summary.html"/> 00082 <page number="3" url="003/summary.html"/> 00083 </pagelist> 00084 */ 00085 00086 typedef struct _PageInfo { 00087 int number; 00088 char * url; 00089 }PageInfo; 00090 00091 typedef struct _pagelistItem { 00092 char * type; 00093 int count; 00094 PageInfo ** page; 00095 } PageListItem; 00096 00097 typedef struct _IndexInfo { 00098 PageListItem ** pagelist; 00099 int length; 00100 }IndexInfo; 00101 00102 00110 void index_file_close(IndexInfo *index); 00111 00119 int index_file_init(const char* file, IndexInfo* index); 00120 00129 int index_file_get_page_count(IndexInfo * index, const char* type); 00130 00140 int index_file_get_page_number(IndexInfo * index, const char* type, const char* url); 00141 00151 char* index_file_get_page_location(IndexInfo * index, const char* type, const int number); 00152 00160 void dump(IndexInfo *index); 00161 00162 #endif //__INDEXFILEHANDLER_H__ 00163 00164 00165
1.5.6