From b9bd270538e30ae02553036bdf269d39f1b0837f Mon Sep 17 00:00:00 2001 From: Lars Schmertmann Date: Thu, 16 Apr 2020 16:08:15 +0200 Subject: [PATCH] Extend the interface to set a loading policy. --- librsvg/rsvg.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/librsvg/rsvg.h b/librsvg/rsvg.h index 6432df67b..7227781d6 100644 --- a/librsvg/rsvg.h +++ b/librsvg/rsvg.h @@ -958,6 +958,42 @@ RsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags); RSVG_API void rsvg_handle_set_base_gfile (RsvgHandle *handle, GFile *base_file); + +/** + * RsvgLoadingPolicy: + * @base_only: Only allow to load content from the same base URL. By default + this restriction is enabled and requires to use rsvg_handle_set_base_uri(). + * @include_xml: Allows to use xi:include with XML. Enabled by default. + * @include_text: Allows to use xi:include with text. Enabled by default. + * @local_only: Only allow to load content from the local filesystem. + Enabled by default. + * + * A data structure used in rsvg_handle_set_loading_policy(). + * + * Since: 2.52 + */ +typedef struct { + gboolean base_only; + gboolean include_xml; + gboolean include_text; + gboolean local_only; +} RsvgLoadingPolicy; + +/** + * rsvg_handle_set_loading_policy: + * @handle: a #RsvgHandle + * @policy: a #RsvgLoadingPolicy + * + * Set the loading policy for @handle from @policy. + * + * Note: This function may only be called before + * rsvg_handle_read_stream_sync() have been called. + * + * Since: 2.52 + */ +RSVG_API +void rsvg_handle_set_loading_policy (RsvgHandle *handle, + RsvgLoadingPolicy *policy); /** * rsvg_handle_read_stream_sync: -- GitLab