-
Notifications
You must be signed in to change notification settings - Fork 0
/
json_writer.h
60 lines (49 loc) · 1.75 KB
/
json_writer.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
48
49
50
51
52
53
54
55
56
57
58
59
60
/***************************************************************
Copyright (C) 2019 Siemens AG
Author: Gaurav Mishra <mishra.gaurav@siemens.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
***************************************************************/
/**
* \file
* \brief Handle JSON outputs
*/
#ifndef _JSON_WRITER_H_
#define _JSON_WRITER_H_
/**
* \brief Write the scan output to a temp file
*
* The function writes the output of a scan result to a temp file in append
* mode which is read by parseTempJson() to create a single JSON output.
*/
void writeToTemp();
/**
* \brief Write the scan result as JSON to STDOUT
*/
void writeToStdOut();
/**
* \brief Read temp file and print a JSON to STDOUT
*
* Reads the temp file created by writeToTemp(), parse it and create a JSON.
* Then writes this JSON to STDOUT.
*/
void parseTempJson();
/**
* \brief Unescape the path separator from JSON
*
* Unescape the path separator from JSON string to make it readable.
*
* `"\/folder\/folder2\/file" => "/folder/folder2/file"
* @param json String to unescape
* @return The JSON with unescaped path separator.
*/
char *unescapePathSeparator(char* json);
#endif /* _JSON_WRITER_H_ */