33 if (
auto const value = source_node->
attribute(
key.data())) {
34 if (*value || !remove_if_empty) {
40 if (remove_if_empty) {
56 if (!g_ascii_strcasecmp(v,
"true") ||
57 !g_ascii_strcasecmp(v,
"yes") ||
58 !g_ascii_strcasecmp(v,
"y") ||
83 return g_ascii_strtod(v,
nullptr);
96 g_snprintf(
c, 32,
"%d", val);
113 g_return_val_if_fail(val == val,
false);
124 if (val == default_value) {
150 return default_value;
153 char **strarray = g_strsplit(v,
",", 2);
155 if (strarray && strarray[0] && strarray[1]) {
157 newx = g_ascii_strtod(strarray[0],
nullptr);
158 newy = g_ascii_strtod(strarray[1],
nullptr);
159 g_strfreev(strarray);
163 g_strfreev(strarray);
164 return default_value;
Cartesian point / 2D vector and related operations.
Two-dimensional point that doubles as a vector.
A thin wrapper around std::ostringstream, but writing floating point numbers in the format required b...
Non-owning reference to 'const char*' Main-purpose: avoid overloads of type f(char*,...
const char * data() const noexcept
Interface for refcounted XML nodes.
bool setAttributeSvgLength(Util::const_char_ptr key, SVGLength const &val)
bool copyAttribute(Util::const_char_ptr key, Node const *source_node, bool remove_if_empty=false)
Copy attribute value from another node to this node.
double getAttributeDouble(Util::const_char_ptr key, double default_value=0.0) const
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Change an attribute of this node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
bool setAttributeInt(Util::const_char_ptr key, int val)
bool setAttributeSvgNonDefaultDouble(Util::const_char_ptr key, double val, double default_value)
Geom::Point getAttributePoint(Util::const_char_ptr key, Geom::Point default_value={}) const
virtual void setAttributeImpl(char const *key, char const *value)=0
bool setAttributePoint(Util::const_char_ptr key, Geom::Point const &val)
bool setAttributeCssDouble(Util::const_char_ptr key, double val)
Set a property attribute to val [slightly rounded], in the format required for CSS properties: in par...
virtual char const * attribute(char const *key) const =0
Get the string representation of a node's attribute.
void removeAttribute(Inkscape::Util::const_char_ptr key)
Remove an attribute of this node.
int getAttributeInt(Util::const_char_ptr key, int default_value=0) const
bool setAttributeBoolean(Util::const_char_ptr key, bool val)
bool setAttributeSvgDouble(Util::const_char_ptr key, double val)
For attributes where an exponent is allowed.
bool getAttributeBoolean(Util::const_char_ptr key, bool default_value=false) const
Parses the boolean value of an attribute "key" in repr and sets val accordingly, or to false if the a...
std::string write() const
TODO: insert short description here.
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key
TODO: insert short description here.