C++: Docs for sixtyfps::interpreter::Diagnostic and DiagnosticLevel

This commit is contained in:
Simon Hausmann 2021-06-22 08:34:33 +02:00
parent 2e4abc61e0
commit 59425b3f02
2 changed files with 29 additions and 1 deletions

View file

@ -772,8 +772,34 @@ public:
} }
}; };
using Diagnostic = sixtyfps::cbindgen_private::CDiagnostic; #if !defined(DOXYGEN)
using DiagnosticLevel = sixtyfps::cbindgen_private::CDiagnosticLevel; using DiagnosticLevel = sixtyfps::cbindgen_private::CDiagnosticLevel;
using Diagnostic = sixtyfps::cbindgen_private::CDiagnostic;
#else
/// DiagnosticLevel describes the severity of a diagnostic.
enum DiagnosticLevel {
/// The diagnostic belongs to an error.
Error,
/// The diagnostic belongs to a warning.
Warning,
};
/// Diagnostic describes the aspects of either a warning or an error, along
/// with its location and a description. Diagnostics are typically returned by
/// sixtyfps::interpreter::ComponentCompiler::diagnostics() in a vector.
struct Diagnostic
{
/// The message describing the warning or error.
SharedString message;
/// The path to the source file where the warning or error is located.
SharedString source_file;
/// The line within the source file. Line numbers start at 1.
uintptr_t line;
/// The column within the source file. Column numbers start at 1.
uintptr_t column;
/// The level of the diagnostic, such as a warning or an error.
DiagnosticLevel level;
};
#endif // else !defined(DOXYGEN)
/// ComponentCompiler is the entry point to the SixtyFPS interpreter that can be used /// ComponentCompiler is the entry point to the SixtyFPS interpreter that can be used
/// to load .60 files or compile them on-the-fly from a string /// to load .60 files or compile them on-the-fly from a string

View file

@ -526,6 +526,7 @@ pub unsafe extern "C" fn sixtyfps_interpreter_model_notify_row_removed(
} }
// FIXME: Figure out how to re-export the one from compilerlib // FIXME: Figure out how to re-export the one from compilerlib
// Note: Documented in sixtyfps.h - keep in sync!
#[derive(Clone)] #[derive(Clone)]
#[repr(C)] #[repr(C)]
pub enum CDiagnosticLevel { pub enum CDiagnosticLevel {
@ -533,6 +534,7 @@ pub enum CDiagnosticLevel {
Warning, Warning,
} }
// Note: Documented in sixtyfps.h - keep in sync!
#[derive(Clone)] #[derive(Clone)]
#[repr(C)] #[repr(C)]
pub struct CDiagnostic { pub struct CDiagnostic {