Inkscape
Vector Graphics Editor
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
extract-uri.h File Reference

TODO: insert short description here. More...

Go to the source code of this file.

Functions

std::string extract_uri (char const *s, char const **endptr=nullptr)
 Parse functional URI notation, as per 4.3.4 of CSS 2.1.
 
std::optional< std::string > try_extract_uri (const char *url)
 Try extracting URI from "url(xyz)" string using extract_uri.
 
std::optional< std::string > try_extract_uri_id (const char *url)
 Try extracting the object id from "url(#obj_id)" string using extract_uri.
 

Detailed Description

TODO: insert short description here.

Definition in file extract-uri.h.

Function Documentation

◆ extract_uri()

std::string extract_uri ( char const *  s,
char const **  endptr = nullptr 
)

Parse functional URI notation, as per 4.3.4 of CSS 2.1.

http://www.w3.org/TR/CSS21/syndata.html#uri

‍The format of a URI value is 'url(' followed by optional white space followed by an optional single quote (') or double quote (") character followed by the URI itself, followed by an optional single quote (') or double quote (") character followed by optional white space followed by ')'. The two quote characters must be the same.

Example:

url = extract_uri("url('foo')bar", &out);
-> url == "foo"
-> out == "bar"
Parameters
sString which starts with "url("
[out]endptrpoints to s + N, where N is the number of characters parsed or to a nullptr when an invalid URL is found
Returns
URL string, or empty string on failure

Definition at line 20 of file extract-uri.cpp.

References result.

Referenced by Inkscape::LivePathEffect::LPEPowerMask::doBeforeEffect(), find_references(), SPIShapes::read(), SPIPaint::read(), SPIFilter::read(), SPItem::set(), sp_css_uri_reference_resolve(), and try_extract_uri().

◆ try_extract_uri()

std::optional< std::string > try_extract_uri ( const char *  url)

Try extracting URI from "url(xyz)" string using extract_uri.

Parameters
urlstring input that may or may not be a link
Returns
Extracted non-empty link or no value if provided input is not an URI

Definition at line 103 of file extract-uri.cpp.

References extract_uri().

Referenced by copy_style_links(), and try_extract_uri_id().

◆ try_extract_uri_id()

std::optional< std::string > try_extract_uri_id ( const char *  url)

Try extracting the object id from "url(#obj_id)" string using extract_uri.

Parameters
urlstring input that may or may not be a link
Returns
Extracted non-empty objectid or no value if provided input is not an URI or not an id

Definition at line 108 of file extract-uri.cpp.

References try_extract_uri().

Referenced by Inkscape::Extension::Internal::SvgBuilder::_getGradientNode(), and Inkscape::Extension::Internal::SvgBuilder::popGroup().