1 /* ide-diagnostic.h 2 * 3 * Copyright 2018-2019 Christian Hergert <chergert@redhat.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * SPDX-License-Identifier: GPL-3.0-or-later 19 */ 20 21 #pragma once 22 23 #if !defined (IDE_CODE_INSIDE) && !defined (IDE_CODE_COMPILATION) 24 # error "Only <libide-code.h> can be included directly." 25 #endif 26 27 #include <libide-core.h> 28 29 #include "ide-code-types.h" 30 31 G_BEGIN_DECLS 32 33 #define IDE_TYPE_DIAGNOSTIC (ide_diagnostic_get_type()) 34 35 typedef enum 36 { 37 IDE_DIAGNOSTIC_IGNORED = 0, 38 IDE_DIAGNOSTIC_NOTE = 1, 39 IDE_DIAGNOSTIC_UNUSED = 2, 40 IDE_DIAGNOSTIC_DEPRECATED = 3, 41 IDE_DIAGNOSTIC_WARNING = 4, 42 IDE_DIAGNOSTIC_ERROR = 5, 43 IDE_DIAGNOSTIC_FATAL = 6, 44 } IdeDiagnosticSeverity; 45 46 IDE_AVAILABLE_IN_3_32 47 G_DECLARE_DERIVABLE_TYPE (IdeDiagnostic, ide_diagnostic, IDE, DIAGNOSTIC, IdeObject) 48 49 struct _IdeDiagnosticClass 50 { 51 IdeObjectClass parent_class; 52 53 /*< private >*/ 54 gpointer _reserved[16]; 55 }; 56 57 IDE_AVAILABLE_IN_3_32 58 IdeDiagnostic *ide_diagnostic_new (IdeDiagnosticSeverity severity, 59 const gchar *message, 60 IdeLocation *location); 61 IDE_AVAILABLE_IN_3_32 62 IdeDiagnostic *ide_diagnostic_new_from_variant (GVariant *variant); 63 IDE_AVAILABLE_IN_3_32 64 guint ide_diagnostic_hash (IdeDiagnostic *self); 65 IDE_AVAILABLE_IN_3_32 66 IdeLocation *ide_diagnostic_get_location (IdeDiagnostic *self); 67 IDE_AVAILABLE_IN_3_32 68 const gchar *ide_diagnostic_get_text (IdeDiagnostic *self); 69 IDE_AVAILABLE_IN_3_32 70 IdeDiagnosticSeverity ide_diagnostic_get_severity (IdeDiagnostic *self); 71 IDE_AVAILABLE_IN_3_32 72 GFile *ide_diagnostic_get_file (IdeDiagnostic *self); 73 IDE_AVAILABLE_IN_3_32 74 gchar *ide_diagnostic_get_text_for_display (IdeDiagnostic *self); 75 IDE_AVAILABLE_IN_3_32 76 const gchar *ide_diagnostic_severity_to_string (IdeDiagnosticSeverity severity); 77 IDE_AVAILABLE_IN_3_32 78 guint ide_diagnostic_get_n_ranges (IdeDiagnostic *self); 79 IDE_AVAILABLE_IN_3_32 80 IdeRange *ide_diagnostic_get_range (IdeDiagnostic *self, 81 guint index); 82 IDE_AVAILABLE_IN_3_32 83 guint ide_diagnostic_get_n_fixits (IdeDiagnostic *self); 84 IDE_AVAILABLE_IN_3_32 85 IdeTextEdit *ide_diagnostic_get_fixit (IdeDiagnostic *self, 86 guint index); 87 IDE_AVAILABLE_IN_3_32 88 void ide_diagnostic_add_range (IdeDiagnostic *self, 89 IdeRange *range); 90 IDE_AVAILABLE_IN_3_32 91 void ide_diagnostic_take_range (IdeDiagnostic *self, 92 IdeRange *range); 93 IDE_AVAILABLE_IN_3_32 94 void ide_diagnostic_add_fixit (IdeDiagnostic *self, 95 IdeTextEdit *fixit); 96 IDE_AVAILABLE_IN_3_32 97 void ide_diagnostic_take_fixit (IdeDiagnostic *self, 98 IdeTextEdit *fixit); 99 IDE_AVAILABLE_IN_3_32 100 gboolean ide_diagnostic_compare (IdeDiagnostic *a, 101 IdeDiagnostic *b); 102 IDE_AVAILABLE_IN_3_32 103 GVariant *ide_diagnostic_to_variant (IdeDiagnostic *self); 104 105 G_END_DECLS 106