summaryrefslogtreecommitdiff
path: root/src/analysis/scan/match.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/match.c')
-rw-r--r--src/analysis/scan/match.c92
1 files changed, 89 insertions, 3 deletions
diff --git a/src/analysis/scan/match.c b/src/analysis/scan/match.c
index c7e2a78..b0b4320 100644
--- a/src/analysis/scan/match.c
+++ b/src/analysis/scan/match.c
@@ -157,8 +157,9 @@ GSearchPattern *g_scan_match_get_source(const GScanMatch *match)
/******************************************************************************
* *
* Paramètres : match = définition de correspondance à manipuler. *
+* fd = canal d'écriture. *
* *
-* Description : Affiche une correspondance sur la sortie standard. *
+* Description : Affiche une correspondance au format texte. *
* *
* Retour : - *
* *
@@ -166,12 +167,97 @@ GSearchPattern *g_scan_match_get_source(const GScanMatch *match)
* *
******************************************************************************/
-void g_scan_match_display(const GScanMatch *match)
+void g_scan_match_output_to_text(const GScanMatch *match, int fd)
{
GScanMatchClass *class; /* Classe à activer */
class = G_SCAN_MATCH_GET_CLASS(match);
- class->display(match);
+ class->to_text(match, fd);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : match = définition de correspondance à manipuler. *
+* *
+* Description : Convertit une correspondance en texte. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_scan_match_convert_as_text(const GScanMatch *match)
+{
+ /* TODO */
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : match = définition de correspondance à manipuler. *
+* padding = éventuel bourrage initial à placer ou NULL. *
+* level = profondeur actuelle. *
+* fd = canal d'écriture. *
+* trailing = impose une virgule finale ? *
+* *
+* Description : Affiche une correspondance au format JSON. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_scan_match_output_to_json(const GScanMatch *match, const sized_string_t *padding, unsigned int level, int fd, bool trailing)
+{
+ unsigned int i; /* Boucle de parcours */
+ GScanMatchClass *class; /* Classe à activer */
+
+ /* Introduction */
+
+ for (i = 0; i < level; i++)
+ write(fd, padding->data, padding->len);
+
+ write(fd, "{\n", 2);
+
+ /* Affichage du contenu */
+
+ class = G_SCAN_MATCH_GET_CLASS(match);
+
+ class->to_json(match, padding, level + 1, fd);
+
+ /* Conclusion */
+
+ for (i = 0; i < level; i++)
+ write(fd, padding->data, padding->len);
+
+ if (trailing)
+ write(fd, "},\n", 3);
+ else
+ write(fd, "}\n", 2);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : match = définition de correspondance à manipuler. *
+* *
+* Description : Convertit une correspondance en JSON. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_scan_match_convert_as_json(const GScanMatch *match)
+{
+ /* TODO */
}