1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
3 /*
4 * This file is part of The Croco Library
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2.1 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 *
20 * Author: Dodji Seketeli
21 * See COPYRIGHTS file for copyright information
22 */
25 /**
26 *@file
27 *The declaration
28 *of the #CRNum class.
29 */
31 #ifndef __CR_NUM_H__
32 #define __CR_NUM_H__
34 #include <glib.h>
35 #include "cr-utils.h"
36 #include "cr-parsing-location.h"
38 G_BEGIN_DECLS
40 /**
41 *@file
42 *The declaration of the #CRNum class.
43 *
44 */
46 /**
47 *The different types
48 *of numbers.
49 *Please, do not modify
50 *the declaration order of the enum
51 *members, unless you know
52 *what you are doing.
53 */
54 enum CRNumType
55 {
56 NUM_AUTO = 0,
57 NUM_GENERIC,
58 NUM_LENGTH_EM,
59 NUM_LENGTH_EX,
60 NUM_LENGTH_PX,
61 NUM_LENGTH_IN,
62 NUM_LENGTH_CM,
63 NUM_LENGTH_MM,
64 NUM_LENGTH_PT,
65 NUM_LENGTH_PC,
66 NUM_ANGLE_DEG,
67 NUM_ANGLE_RAD,
68 NUM_ANGLE_GRAD,
69 NUM_TIME_MS,
70 NUM_TIME_S,
71 NUM_FREQ_HZ,
72 NUM_FREQ_KHZ,
73 NUM_PERCENTAGE,
74 NUM_INHERIT,
75 NUM_UNKNOWN_TYPE,
76 NB_NUM_TYPE
77 } ;
80 /**
81 *An abstraction of a number (num)
82 *as defined in the css2 spec.
83 */
84 typedef struct _CRNum CRNum ;
86 /**
87 *An abstraction of a number (num)
88 *as defined in the css2 spec.
89 */
90 struct _CRNum
91 {
92 enum CRNumType type ;
93 gdouble val ;
94 CRParsingLocation location ;
95 } ;
97 CRNum *
98 cr_num_new (void) ;
100 CRNum *
101 cr_num_new_with_val (gdouble a_val,
102 enum CRNumType a_type) ;
104 CRNum *
105 cr_num_dup (CRNum *a_this) ;
107 guchar *
108 cr_num_to_string (CRNum *a_this) ;
110 enum CRStatus
111 cr_num_copy (CRNum *a_dest, CRNum *a_src) ;
113 enum CRStatus
114 cr_num_set (CRNum *a_this, gdouble a_val,
115 enum CRNumType a_type) ;
117 gboolean
118 cr_num_is_fixed_length (CRNum *a_this) ;
120 void
121 cr_num_destroy (CRNum *a_this) ;
124 G_END_DECLS
127 #endif /*__CR_NUM_H__*/