Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
svg-bool.cpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
/*
3
* Authors:
4
* Martin Owens <doctormo@geek-2.com>
5
*
6
* Copyright (C) 2021 Martin Owens
7
*
8
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
9
*/
10
11
#include <cstring>
12
#include <string>
13
#include <glib.h>
14
15
#include "
svg/svg-bool.h
"
16
21
SVGBool::SVGBool
(
bool
default_value)
22
: _default(default_value)
23
{}
24
25
bool
SVGBool::read
(gchar
const
*str)
26
{
27
if
(!str)
return
false
;
28
29
_is_set
=
true
;
30
_value
= !g_ascii_strcasecmp(str,
"true"
) ||
31
!g_ascii_strcasecmp(str,
"yes"
) ||
32
!g_ascii_strcasecmp(str,
"y"
) ||
33
(atoi(str) != 0);
34
35
return
true
;
36
}
37
38
void
SVGBool::unset
() {
39
_is_set
=
false
;
40
}
41
42
void
SVGBool::readOrUnset
(gchar
const
*str) {
43
if
(!
read
(str)) {
44
unset
();
45
}
46
}
47
48
/*
49
Local Variables:
50
mode:c++
51
c-file-style:"stroustrup"
52
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
53
indent-tabs-mode:nil
54
fill-column:99
55
End:
56
*/
57
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SVGBool::SVGBool
SVGBool(bool default_value)
This boolean is not an SVG specification type, but it is something Inkscape uses for many of it's int...
Definition
svg-bool.cpp:21
SVGBool::_is_set
bool _is_set
Definition
svg-bool.h:26
SVGBool::_value
bool _value
Definition
svg-bool.h:27
SVGBool::unset
void unset()
Definition
svg-bool.cpp:38
SVGBool::readOrUnset
void readOrUnset(gchar const *str)
Definition
svg-bool.cpp:42
SVGBool::read
bool read(gchar const *str)
Definition
svg-bool.cpp:25
svg-bool.h
src
svg
svg-bool.cpp
Generated on Sun Jun 22 2025 04:02:03 for Inkscape by
1.9.8