hl7parse
search.h
Go to the documentation of this file.
1 
4 #ifndef SEARCH_H
5 #define SEARCH_H
6 
7 #include "address.h"
8 #include "meta.h"
9 
10 #ifdef _WIN32
11  #include "getline.h"
12 #endif
13 
17 const char *version_search();
18 
24 typedef struct flags_t {
26  int verbose;
30  int greedy;
38  int address;
40  unsigned char *search_term_value;
44  int quiet;
46  int decode64;
52  FILE *output_fd;
55 } flags_t;
56 
60 typedef enum search_mode_t {
63 
66 
70 
77 typedef struct result_item_t {
79  char *file;
81  int line_num;
83  int pos;
87  char *str;
89  int length;
91 
98 typedef struct search_res_t {
100  char *file;
104  int addr_l;
106  int greedy;
108  unsigned char *search_term;
110  int length;
113 } search_res_t;
114 
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
118 
123 
131 
139 void free_search_res(search_res_t *sr);
140 
141 /*
142  * @brief append result to result container
143 int append_result(char *file, int line_num, int pos, hl7_addr_t *addr, search_res_t **res, char *str, int length);
144  */
145 
157 hl7_addr_t **parse_address(char *addrstr, int *length);
158 
166 void free_addr_arr(hl7_addr_t **addr);
167 
185 int search_file(char *filename, flags_t flags);
186 
196 int search_substring(FILE* fd, search_res_t *sr);
197 
224 int search_segment(FILE* fd, search_res_t *sr);
225 
243 int search_subnodes(node_t *fieldlist, search_res_t *sr, int line_num,
244  hl7_meta_t *meta, int segment_rep);
245 
259 int search_node(FILE* fd, search_res_t *sr);
260 
270 void print_json_value(result_item_t *item, flags_t flags);
271 
289 void print_xml_value(result_item_t *item, flags_t flags);
290 
298 void output_json(result_item_t *item, flags_t flags, int last);
299 
306 void output_xml(result_item_t *item, flags_t flags);
307 
314 void output_csv(result_item_t *item, flags_t flags);
315 
322 void output_string(result_item_t *item, flags_t flags);
323 
324 #ifdef __cplusplus
325 }
326 #endif
327 
328 #endif // SEARCH_H
void free_addr_arr(hl7_addr_t **addr)
free address array
Definition: search.c:126
int search_substring(FILE *fd, search_res_t *sr)
search substring
Definition: search.c:218
hl7 meta data structures for message_t
primary storage type of a delimited element
Definition: node.h:188
char * file
Definition: search.h:79
int decode64
Definition: search.h:46
int quiet
Definition: search.h:44
int pos
Definition: search.h:83
int search_segment(FILE *fd, search_res_t *sr)
this search variant is a line based search
Definition: search.c:223
unsigned char * search_term
Definition: search.h:108
Definition: search.h:68
void output_string(result_item_t *item, flags_t flags)
printf a result
Definition: search.c:806
int greedy
Definition: search.h:106
int line_num
Definition: search.h:81
void print_xml_value(result_item_t *item, flags_t flags)
XML value, entities escaped.
Definition: search.c:876
int search_subnodes(node_t *fieldlist, search_res_t *sr, int line_num, hl7_meta_t *meta, int segment_rep)
Definition: search.c:441
int length
Definition: search.h:89
int search_term
Definition: search.h:28
Definition: search.h:65
int greedy
Definition: search.h:30
HL7 Seperator configuration.
Definition: meta.h:33
int case_insensitive
Definition: search.h:54
struct search_res_t search_res_t
holds 0-N result items
int search_file(char *filename, flags_t flags)
search for files
Definition: search.c:684
flags_t * create_flags_t()
create default values for flags_t
Definition: search.c:34
search result
Definition: search.h:77
int output_file
Definition: search.h:48
hl7 element address
Definition: address.h:49
int output_xml
Definition: search.h:34
hl7 address structures and utilities
result_item_t ** items
Definition: search.h:112
struct result_item_t result_item_t
search result
FILE * output_fd
Definition: search.h:52
char * str
Definition: search.h:87
search_mode_t
search modes
Definition: search.h:60
int address
Definition: search.h:38
int output_json
Definition: search.h:32
char * file
Definition: search.h:100
unsigned char * search_term_value
Definition: search.h:40
void print_json_value(result_item_t *item, flags_t flags)
JSON value, entities escaped.
Definition: search.c:844
struct flags_t flags_t
command line parameters
command line parameters
Definition: search.h:24
int verbose
Definition: search.h:26
Definition: search.h:62
void free_search_res(search_res_t *sr)
frees all data associated with search result
Definition: search.c:157
hl7_addr_t * addr
Definition: search.h:85
char * address_value
Definition: search.h:42
int output_csv
Definition: search.h:36
int search_node(FILE *fd, search_res_t *sr)
parse line and find in sub elements
Definition: search.c:508
hl7_addr_t ** addr
Definition: search.h:102
int length
Definition: search.h:110
search_res_t * create_search_res(unsigned char *search_term)
initiaizes a result container
Definition: search.c:134
const char * version_search()
search version information
Definition: search.c:28
hl7_addr_t ** parse_address(char *addrstr, int *length)
parse address string
Definition: search.c:55
char * output_file_value
Definition: search.h:50
holds 0-N result items
Definition: search.h:98
int addr_l
Definition: search.h:104