From: Olaf Wintermann Date: Mon, 22 Jun 2026 19:44:59 +0000 (+0200) Subject: add DavContext add_namespace method X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmain;p=note.git add DavContext add_namespace method --- diff --git a/dav-rs/src/dav/context.rs b/dav-rs/src/dav/context.rs index 5090278..0e00bde 100644 --- a/dav-rs/src/dav/context.rs +++ b/dav-rs/src/dav/context.rs @@ -27,6 +27,7 @@ */ #![allow(dead_code)] +use std::ffi::{c_char, CString}; use crate::dav::ffi; pub struct DavContext { @@ -39,6 +40,14 @@ impl DavContext { DavContext { ptr: dav_context_new() } } } + + pub fn add_namespace(&self, prefix: &str, namespace: &str) { + let prefix_cstr = CString::new(prefix).unwrap(); + let ns_cstr = CString::new(namespace).unwrap(); + unsafe { + dav_add_namespace(self.ptr, prefix_cstr.as_ptr(), ns_cstr.as_ptr()); + } + } } impl Drop for DavContext { @@ -65,4 +74,6 @@ unsafe extern "C" { fn dav_context_ref(ctx: *mut ffi::DavContext); fn dav_context_unref(ctx: *mut ffi::DavContext); + + fn dav_add_namespace(ctx: *mut ffi::DavContext, prefix: *const c_char, ns: *const c_char); } \ No newline at end of file