-
Notifications
You must be signed in to change notification settings - Fork 1
/
search_answer.h
47 lines (32 loc) · 1.44 KB
/
search_answer.h
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
#ifndef SEARCH_ANSWER_H
#define SEARCH_ANSWER_H
class search_answer
{
public:
search_answer(unsigned int dir_index, unsigned int text_file_index, char * text_file_path, char * text_file_name);
~search_answer();
void print();
bool cmp_doc_id(unsigned int dir_index, unsigned text_file_index);
void update(unsigned int line_index, char * line);
unsigned int get_n_lines();
char * get_full_file_name_path();
unsigned int get_line_id(unsigned int line_index);
char * get_line(unsigned int line_index);
private:
unsigned int dir_index;
unsigned int text_file_index;
char * text_file_path;
char * text_file_name;
unsigned int * lines_indexes;
char ** lines;
unsigned int lines_size;
bool line_exists(unsigned int line_index);
void add_line(unsigned int line_index, char * line);
};
search_answer ** update_search_answers(search_answer ** sa_array, unsigned int & sa_array_size,
unsigned int dir_index, unsigned int text_file_index, unsigned int line_index, char * line,
char * text_file_path, char * text_file_name);
void print_search_answers(search_answer ** sa_array, unsigned int sa_array_size);
void delete_search_answers(search_answer ** sa_array, unsigned int sa_array_size);
unsigned int get_total_n_lines(search_answer ** sa_array, unsigned int sa_array_size);
#endif // SEARCH_ANSWER_H