This repository was archived by the owner on Oct 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbibtexmanager.h
More file actions
270 lines (256 loc) · 6.42 KB
/
Copy pathbibtexmanager.h
File metadata and controls
270 lines (256 loc) · 6.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
Bibtex Project - bibtexmanager.h
Maxime B. & Nathan O. (TC03)
maxime.bourgeois@utbm.fr nathan.olff@utbm.fr
bibtexmanager.h : cointains the prototypes of our fonctions which manage the bibtex.
*/
#ifndef __SORT_H__
#define __SORT_H__
#include <printLibrary.h>
/*
* longestLine : search the lengh of the longuest line of a file
*
* fileName : the file's name
*
* return the lengh of the longuest line of the file
*/
int longestLine(char* fileName);
/*
* parseBibtexFile : parse a bibtex file
*
* fileName : the file's name
*
* return a library from the parsing of the file
*/
AbstractList parseBibtexFile(char* fileName);
/*
* stringToUpper : upper a string
*
* string : a given string
*
* return the string uppered
*/
char* stringToUpper(char* string);
/*
* stringToLower : lower a string
*
* string : a given string
*
* return the string lowered
*/
char* stringToLower(char* string);
/*
* findEntryYear : find the entry's year
*
* entry : a given entry
*
* return a string corresponding to the entry's year
*/
char* findEntryYear(void* entry);
/*
* compareYear : compare two years (string)
*
* year1, year2 : two given years
*
* - return an integer < 0 if year1 < year2
* - return 0 if year1 = year2
* - return an integer > 0 if year1 > year2
*/
int compareYear(void* year1, void* year2);
/*
* compareEntryByYear : compare two entries by years (string)
*
* year1, year2 : two given entries
*
* - return an integer < 0 if year1 < year2
* - return 0 if year1 = year2
* - return an integer > 0 if year1 > year2
*/
int compareEntryByYear(void* entry1, void* entry2);
/*
* compareAuthor : compare two authors
*
* author1, author2 : two given authors
*
* - return an integer < 0 if author1 < author2
* - return 0 if author1 = author2
* - return an integer > 0 if author1 > author2
*/
int compareAuthor(void* author1, void* author2);
/*
* compareEntryByAuthor : compare two entries by author
*
* entry1, entry2 : two given entries
*
* - return an integer < 0 if author1 < author2
* - return 0 if author1 = author2
* - return an integer > 0 if author1 > author2
*/
int compareEntryByAuthor(void* entry1, void* entry2);
/*
* randomIndex : compute a random integer with min <= int < max
*
* min, max : two given integers witch are the limit of the random generation
*
* return an integer with min <= int < max
*/
int randomIndex(int min, int max);
/*
* swapValues : swap the values of two elements
*
* Elem1, Elem2 : the generic element
*
* return nothing
*/
void swapValues(AbstractElement* Elem1, AbstractElement* Elem2);
/*
* partition : put the elements lesser than an index at his left, and the greater ones at his right
*
* list : a generic list
* left : the "left" border of the partionning
* right : the "right" border of the partionning
* pivotIndex : the initial index of the pivot
* storeIndex : the final index of the pivot
*
* return the list partionned
*/
int partition(AbstractList list, int left, int right, int pivotIndex, int(*ptrFCompare)(void*,void*));
/*
* quicksort : quicksort a list
*
* list : a generic list
* left : the "left" border of the partionning
* right : the "right" border of the partionning
* ptrFCompare : a pointer of a comparison function
*
* return nothing
*/
void quicksort(AbstractList list, int left, int right, int(*ptrFCompare)(void*,void*));
/*
* sortLibraryAuthorDate : sort a library by author and sort each author's publication by date
*
* library : the library we want to sort
*
* return the library sorted
*/
AbstractList sortLibraryAuthorDate(AbstractList library);
/*
* sortLibraryDateAuthor : sort a library by date and sort each date's publications by author
*
* library : the library we want to sort
*
* return the library sorted
*/
AbstractList sortLibraryDateAuthor(AbstractList library);
/*
* exportAuthorListToHtml : export a list of author
*
* authorList : a list of author
* filePtr : a file's pointer
*
* return nothing
*/
void exportAuthorListToHtml(AbstractList *authorList, FILE* filePtr);
/*
* exportEntryToHtml : export an entry
*
* entry : a given entry
* filePtr : a file's pointer
*
* return nothing
*/
void exportEntryToHtml(Entry* entry, FILE* filePtr);
/*
* exportAuthorsPublications : export the list of all author's publication from a library
*
* libraryAuthorDate : the list of all author's publication
* fileName : the name of the file that will be created by the export
*
* return nothing
*/
void exportAuthorsPublications(ListAuthorPublications libraryAuthorDate, char* fileName);
/*
* exportDatePublications : export the list of all date's publication from a library
*
* libraryDateAuthor : the list of all date's publication
* fileName : the name of the file that will be created by the export
*
* return nothing
*/
void exportDatePublications(ListDatePublications libraryDateAuthor, char* fileName);
/*
* exportDatePublications : export a library
*
* library : the library we want to export
* fileName : the name of the file that will be created by the export
*
* return nothing
*/
void exportToHTML(AbstractList library, char* fileName);
/*
* freeAuthorList : free a list of authors
*
* authorList : the list of authors we want to free
*
* return nothing
*/
void freeAuthorList(AbstractList *authorlist);
/*
* freeEntry : free a entry
*
* entry : the entry we want to free
*
* return nothing
*/
void freeEntry(Entry *entry);
/*
* removeEntry : remove a entry in the library
*
* library : the library in which we remove the entry
* keyToBeRemoved : the key of the entry we want to free
*
* return nothing
*/
AbstractList removeEntry(AbstractList library, char* keyToBeRemoved);
/*
* freeLibrary : free a entry
*
* library : the library we want to free
* freeValue : a boolean which indicate if we need to free the value of the entries
*
* return nothing
*/
void freeLibrary(AbstractList library, BOOL freeValue);
/*
* freeAuthorsPublications : free the list of all AuthorsPublications
*
* libraryDateAuthor : the list of all author's publication
*
* return nothing
*/
void freeAuthorsPublications(ListAuthorPublications libraryAuthorDate);
/*
* freeDatePublications : free the list of all DatePublications
*
* libraryDateAuthor : the list of all date's publication
*
* return nothing
*/
void freeDatePublications(ListDatePublications libraryDateAuthor);
/*
* freeSimpleList : free a list
*
* list : the list we want to free
*
* return nothing
*/
void freeSimpleList(AbstractList list);
/*
* deleteList : delete a list
*
* list : the list we want to delete
*
* return nothing
*/
void deleteList(AbstractList list);
#endif