use std::os::raw::c_char;
use std::ptr;
use super::conversions::{cast_report, rust_str_to_c};
use super::types::{CQualityBand, CReport};
#[no_mangle]
pub extern "C" fn wqa_report_get_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe {
match cast_report(report) {
Some(r) => r,
None => return 0.0,
}
};
internal.report.score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_verdict(report: *const CReport) -> CQualityBand {
if report.is_null() {
return CQualityBand::VeryPoor;
}
let internal = unsafe {
match cast_report(report) {
Some(r) => r,
None => return CQualityBand::VeryPoor,
}
};
CQualityBand::from(internal.report.verdict.clone())
}
#[no_mangle]
pub extern "C" fn wqa_report_get_url(report: *const CReport) -> *const c_char {
if report.is_null() {
return ptr::null();
}
let internal = unsafe {
match cast_report(report) {
Some(r) => r,
None => return ptr::null(),
}
};
internal.url_cstring.as_ptr()
}
#[no_mangle]
pub extern "C" fn wqa_report_get_version(report: *const CReport) -> *const c_char {
if report.is_null() {
return ptr::null();
}
let internal = unsafe {
match cast_report(report) {
Some(r) => r,
None => return ptr::null(),
}
};
internal.version_cstring.as_ptr()
}
#[no_mangle]
pub extern "C" fn wqa_report_get_word_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.content.word_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_avg_word_length(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.main_text_ratio
}
#[no_mangle]
pub extern "C" fn wqa_report_get_main_text_ratio(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.main_text_ratio
}
#[no_mangle]
pub extern "C" fn wqa_report_get_avg_sentence_length(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.avg_sentence_len
}
#[no_mangle]
pub extern "C" fn wqa_report_get_readability_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.readability_fk
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_stopword_ratio(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.stopword_ratio
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_unique_word_ratio(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.unique_word_ratio
}
#[no_mangle]
pub extern "C" fn wqa_report_get_sentence_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.content.sentence_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_reading_time_minutes(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.reading_time_minutes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_content_density(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.content_density
}
#[no_mangle]
pub extern "C" fn wqa_report_get_content_to_html_ratio(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.content_to_html_ratio
}
#[no_mangle]
pub extern "C" fn wqa_report_get_content_structure_penalty(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.content
.content_structure_penalty
}
#[no_mangle]
pub extern "C" fn wqa_report_get_heading_depth(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.heading_depth
}
#[no_mangle]
pub extern "C" fn wqa_report_get_heading_order_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.heading_order_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_headings_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.headings_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_paragraph_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.paragraph_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_heading_structure_valid(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.heading_structure_valid
}
#[no_mangle]
pub extern "C" fn wqa_report_get_images_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.media.images_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_images_with_alt(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
let total = internal.report.metrics.html_analysis.media.images_count;
let coverage = internal
.report
.metrics
.html_analysis
.media
.image_alt_coverage;
((total as f32) * coverage) as usize
}
#[no_mangle]
pub extern "C" fn wqa_report_get_image_alt_coverage(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.media
.image_alt_coverage
}
#[no_mangle]
pub extern "C" fn wqa_report_get_missing_alt_text_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.media
.missing_alt_text_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_video_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.media.video_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_audio_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.media.audio_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_avg_video_duration(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.media
.avg_video_duration_seconds
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_avg_audio_duration(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.media
.avg_audio_duration_seconds
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_images_to_text_ratio(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.media
.images_to_text_ratio
}
#[no_mangle]
pub extern "C" fn wqa_report_get_title_length(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.seo.title_len
}
#[no_mangle]
pub extern "C" fn wqa_report_get_meta_description_length(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.seo
.meta_desc_len
.unwrap_or(0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_h1_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.heading_depth
}
#[no_mangle]
pub extern "C" fn wqa_report_get_heading_structure_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.heading_order_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_has_schema_org(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
let sd = &internal.report.metrics.html_analysis.structured_data;
sd.json_ld_count > 0 || sd.microdata_count > 0 || sd.rdfa_count > 0
}
#[no_mangle]
pub extern "C" fn wqa_report_get_has_canonical(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.seo.has_canonical
}
#[no_mangle]
pub extern "C" fn wqa_report_get_has_h1(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structure
.headings_count
> 0
}
#[no_mangle]
pub extern "C" fn wqa_report_get_og_tags_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.seo.og_tags
}
#[no_mangle]
pub extern "C" fn wqa_report_get_twitter_tags_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.seo.twitter_tags
}
#[no_mangle]
pub extern "C" fn wqa_report_get_robots_noindex(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.seo.robots_noindex
}
#[no_mangle]
pub extern "C" fn wqa_report_get_seo_penalty(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.seo.seo_penalty
}
#[no_mangle]
pub extern "C" fn wqa_report_get_has_viewport(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.seo
.viewport_tag_present
}
#[no_mangle]
pub extern "C" fn wqa_report_get_favicon_present(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.seo.favicon_present
}
#[no_mangle]
pub extern "C" fn wqa_report_get_total_links(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.links.total_links
}
#[no_mangle]
pub extern "C" fn wqa_report_get_internal_links(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.links.internal_links
}
#[no_mangle]
pub extern "C" fn wqa_report_get_external_links(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.links.external_links
}
#[no_mangle]
pub extern "C" fn wqa_report_get_broken_link_rate(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.links
.broken_link_rate
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_anchor_text_diversity(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.links
.anchor_text_diversity
}
#[no_mangle]
pub extern "C" fn wqa_report_get_nofollow_links(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.links.nofollow_links
}
#[no_mangle]
pub extern "C" fn wqa_report_get_links_to_content_ratio(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.links
.links_to_content_ratio
}
#[no_mangle]
pub extern "C" fn wqa_report_get_sponsored_links(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.links
.rel_attribute_counts
.get("sponsored")
.copied()
.unwrap_or(0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_html_size(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.technical.html_bytes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_dom_size(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.technical.html_bytes
+ internal.report.metrics.html_analysis.technical.script_bytes
+ internal.report.metrics.html_analysis.technical.style_bytes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_html_bytes(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.technical.html_bytes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_script_bytes(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.technical.script_bytes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_style_bytes(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.technical.style_bytes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_inline_script_bytes(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.technical
.inline_script_bytes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_inline_style_bytes(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.technical
.inline_style_bytes
}
#[no_mangle]
pub extern "C" fn wqa_report_get_technical_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.technical
.technical_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_color_contrast_violations(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.accessibility
.color_contrast_violations
}
#[no_mangle]
pub extern "C" fn wqa_report_get_aria_labels_missing(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.accessibility
.aria_labels_missing
}
#[no_mangle]
pub extern "C" fn wqa_report_get_keyboard_navigation_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.accessibility
.keyboard_navigation_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_wcag_aa_compliance_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.accessibility
.wcag_aa_compliance_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_wcag_aaa_compliance_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.accessibility
.wcag_aaa_compliance_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_screen_reader_compatibility(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.accessibility
.screen_reader_compatibility
}
#[no_mangle]
pub extern "C" fn wqa_report_get_accessibility_landmarks_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.accessibility
.accessibility_landmarks_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_mobile_friendly_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.mobile
.mobile_friendly_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_viewport_configured(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.mobile
.viewport_configured
}
#[no_mangle]
pub extern "C" fn wqa_report_get_touch_target_violations(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.mobile
.touch_target_violations
}
#[no_mangle]
pub extern "C" fn wqa_report_get_mobile_usability_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.mobile
.mobile_usability_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_has_author(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.authority.has_author
}
#[no_mangle]
pub extern "C" fn wqa_report_get_has_publish_date(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.authority
.has_publish_date
}
#[no_mangle]
pub extern "C" fn wqa_report_get_references_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.authority
.references_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_language_confidence(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.language
.language_confidence
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_forms_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.forms.forms_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_form_fields_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.forms
.form_fields_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_required_fields_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.forms
.required_fields_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_form_validation_present(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.forms
.form_validation_present
}
#[no_mangle]
pub extern "C" fn wqa_report_get_form_accessibility_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.forms
.form_accessibility_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_captcha_implementation(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.forms
.captcha_implementation
}
#[no_mangle]
pub extern "C" fn wqa_report_get_json_ld_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structured_data
.json_ld_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_microdata_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structured_data
.microdata_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_rdfa_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structured_data
.rdfa_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_structured_data_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structured_data
.structured_data_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_brand_color_consistency(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.branding
.brand_color_consistency
}
#[no_mangle]
pub extern "C" fn wqa_report_get_font_consistency_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.branding
.font_consistency_score
}
#[no_mangle]
pub extern "C" fn wqa_report_get_logo_present(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.html_analysis.branding.logo_present
}
#[no_mangle]
pub extern "C" fn wqa_report_get_design_system_compliance(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.branding
.design_system_compliance
}
#[no_mangle]
pub extern "C" fn wqa_report_get_interactive_elements_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.user_experience
.interactive_elements_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_social_sharing_buttons(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.user_experience
.social_sharing_buttons
}
#[no_mangle]
pub extern "C" fn wqa_report_get_search_functionality_present(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.user_experience
.search_functionality_present
}
#[no_mangle]
pub extern "C" fn wqa_report_get_contact_info_accessible(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.user_experience
.contact_info_accessible
}
#[no_mangle]
pub extern "C" fn wqa_report_get_conversion_elements_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.user_experience
.conversion_elements_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_contact_methods_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.business
.contact_methods_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_business_hours_displayed(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.business
.business_hours_displayed
}
#[no_mangle]
pub extern "C" fn wqa_report_get_location_information_present(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.business
.location_information_present
}
#[no_mangle]
pub extern "C" fn wqa_report_get_hreflang_tags_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.internationalization
.hreflang_tags_count
}
#[no_mangle]
pub extern "C" fn wqa_report_get_language_variants_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.internationalization
.language_variants_count
}
#[no_mangle]
pub extern "C" fn wqa_report_has_network_metrics(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal.report.metrics.network_analysis.is_some()
}
#[no_mangle]
pub extern "C" fn wqa_report_get_largest_contentful_paint(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.largest_contentful_paint)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_interaction_to_next_paint(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.interaction_to_next_paint)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_cumulative_layout_shift(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.cumulative_layout_shift)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_time_to_first_byte(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.time_to_first_byte)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_dom_content_loaded_time(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.dom_content_loaded_time)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_first_contentful_paint(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.first_contentful_paint)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_time_to_interactive(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.time_to_interactive)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_total_blocking_time(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.total_blocking_time)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_speed_index(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.and_then(|n| n.speed_index)
.unwrap_or(0.0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_total_page_size_kb(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.total_page_size_kb)
.unwrap_or(0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_number_of_http_requests(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.number_of_http_requests)
.unwrap_or(0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_https_enabled(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.https_enabled)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_csp_header_present(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.csp_header_present)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_hsts_enabled(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.hsts_enabled)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_xss_protection_enabled(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.xss_protection_enabled)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_content_type_nosniff(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.content_type_nosniff)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_referrer_policy_set(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.referrer_policy_set)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_google_analytics_present(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.google_analytics_present)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_conversion_tracking_setup(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.conversion_tracking_setup)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_tag_manager_implemented(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.tag_manager_implemented)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_robots_txt_referenced(report: *const CReport) -> bool {
if report.is_null() {
return false;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.robots_txt_referenced)
.unwrap_or(false)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_error_pages_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.error_pages_count)
.unwrap_or(0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_redirects_count(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.network_analysis
.as_ref()
.map(|n| n.redirects_count)
.unwrap_or(0)
}
#[no_mangle]
pub extern "C" fn wqa_report_get_nav_elements(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
0 }
#[no_mangle]
pub extern "C" fn wqa_report_get_main_elements(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
0
}
#[no_mangle]
pub extern "C" fn wqa_report_get_article_elements(report: *const CReport) -> usize {
if report.is_null() {
return 0;
}
0
}
#[no_mangle]
pub extern "C" fn wqa_report_get_semantic_score(report: *const CReport) -> f32 {
if report.is_null() {
return 0.0;
}
let internal = unsafe { cast_report(report).unwrap() };
internal
.report
.metrics
.html_analysis
.structured_data
.structured_data_score
}