1 #ifndef __SP_SVG_LENGTH_H__
2 #define __SP_SVG_LENGTH_H__
4 /**
5 * \file src/svg/svg-length.h
6 * \brief SVG length type
7 *
8 * Authors:
9 * Lauris Kaplinski <lauris@kaplinski.com>
10 * Carl Hetherington <inkscape@carlh.net>
11 *
12 * Copyright (C) 1999-2002 Lauris Kaplinski
13 * Copyright (C) 2000-2001 Ximian, Inc.
14 *
15 * Released under GNU GPL, read the file 'COPYING' for more information
16 */
18 class SVGLength
19 {
20 public:
22 enum Unit {
23 NONE,
24 PX,
25 PT,
26 PC,
27 MM,
28 CM,
29 INCH,
30 FOOT,
31 EM,
32 EX,
33 PERCENT
34 };
36 bool _set;
37 Unit unit;
38 float value;
39 float computed;
41 float operator=(float v) {
42 _set = true;
43 unit = NONE;
44 value = computed = v;
45 return v;
46 }
48 bool read(gchar const *str);
49 void readOrUnset(gchar const *str, Unit u = NONE, float v = 0, float c = 0);
50 bool readAbsolute(gchar const *str);
51 void set(Unit u, float v, float c);
52 void unset(Unit u = NONE, float v = 0, float c = 0);
53 void update(double em, double ex, double scale);
54 };
56 #endif
58 /*
59 Local Variables:
60 mode:c++
61 c-file-style:"stroustrup"
62 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
63 indent-tabs-mode:nil
64 fill-column:99
65 End:
66 */
67 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :