20#include <glibmm/miscutils.h>
33 , _owner_document(nullptr)
37 g_assert(
_owner !=
nullptr);
43 , _owner_document(owner_document)
74 std::set<SPObject *> done;
77 auto lpobj = cast<LivePathEffectObject>(obj);
95 std::list<SPObject *> todo(owner->
hrefList);
96 todo.push_front(owner->
parent);
97 while (!todo.empty()) {
102 if (done.insert(e).second) {
106 todo.push_front(e->
parent);
128 if (g_str_has_suffix(filename,
".jpg") || g_str_has_suffix(filename,
".JPG") ||
129 g_str_has_suffix(filename,
".png") || g_str_has_suffix(filename,
".PNG")) {
134 if (document && uri.
getPath() && !skip) {
140 path = absuri.toNativeFilename();
141 }
catch (
const Glib::Error &e) {
142 g_warning(
"%s", e.what());
152 g_warning(
"Can't get document for referenced URI: %s", filename);
166 if (!strncmp(
fragment,
"xpointer(", 9)) {
171 if (!strncmp(
fragment,
"xpointer(id(", 12)) {
173 size_t const len = strlen(
id);
174 if (
len < 3 || strcmp(
id +
len - 2,
"))")) {
203 g_warning(
"%s", e.what());
248 g_assert(
_obj == obj);
260 if (document && uri && (strncmp(uri,
"url(", 4) == 0)) {
262 if (!trimmed.empty()) {
274 if (uri && (*uri ==
'#')) {
TODO: insert short description here.
sigc::connection _release_connection
virtual ~URIReference()
Destructor.
sigc::signal< void(SPObject *, SPObject *)> _changed_signal
void detach()
Detaches from the currently attached URI target, if any; the current referrent is signaled as NULL.
bool try_attach(char const *uri)
Try to attach to a URI.
void _setObject(SPObject *object)
URIReference(SPObject *owner)
Constructor.
void _release(SPObject *object)
SPObject * getOwner() const
Returns a pointer to the URIReference's owner.
virtual bool _acceptObject(SPObject *obj) const
SPDocument * _owner_document
void attach(URI const &uri)
Attaches to a URI, relative to the specified document.
sigc::connection _connection
Represents an URI as per RFC 2396.
const char * getQuery() const
Return the query, which is the part between "?" and the optional fragment hash ("#")
static URI from_href_and_basedir(char const *href, char const *basedir)
Convenience function for the common use case given a xlink:href attribute and a local directory as th...
std::string str(char const *baseuri=nullptr) const
Return the string representation of this URI.
const char * getPath() const
Return the path.
const char * getFragment() const
Return the fragment, which is everything after "#".
Typed SVG document implementation.
char const * getDocumentBase() const
SPObject * getObjectById(std::string const &id) const
SPDocument * createChildDoc(std::string const &filename)
Fetches a document and attaches it to the current document as a child href.
sigc::connection connectIdChanged(const char *id, IDChangedSignal::slot_type slot)
SPObject is an abstract base class of all of the document nodes at the SVG document level.
SPObject * clone_original
sigc::connection connectRelease(sigc::slot< void(SPObject *)> slot)
Connects to the release request signal.
void unhrefObject(SPObject *owner=nullptr)
Decrease weak refcount.
void hrefObject(SPObject *owner=nullptr)
Increase weak refcount.
std::list< SPObject * > hrefList
Helper class to stream background task notifications as a series of messages.
SPObject * sp_css_uri_reference_resolve(SPDocument *document, const gchar *uri)
SPObject * sp_uri_reference_resolve(SPDocument *document, const gchar *uri)
std::string extract_uri(char const *s, char const **endptr)
Parse functional URI notation, as per 4.3.4 of CSS 2.1.
URI functions as per 4.3.4 of CSS 2.1 http://www.w3.org/TR/CSS21/syndata.html#uri.