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