1/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ 2 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 */ 23 24 25/** 26 *@file 27 *The declaration 28 *of the #CRNum class. 29 */ 30 31#ifndef __CR_NUM_H__ 32#define __CR_NUM_H__ 33 34#include <glib.h> 35#include "cr-utils.h" 36#include "cr-parsing-location.h" 37 38G_BEGIN_DECLS 39 40/** 41 *@file 42 *The declaration of the #CRNum class. 43 * 44 */ 45 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 */ 54enum 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} ; 78 79 80/** 81 *An abstraction of a number (num) 82 *as defined in the css2 spec. 83 */ 84typedef struct _CRNum CRNum ; 85 86/** 87 *An abstraction of a number (num) 88 *as defined in the css2 spec. 89 */ 90struct _CRNum 91{ 92 enum CRNumType type ; 93 gdouble val ; 94 CRParsingLocation location ; 95} ; 96 97CRNum * 98cr_num_new (void) ; 99 100CRNum * 101cr_num_new_with_val (gdouble a_val, 102 enum CRNumType a_type) ; 103 104CRNum * 105cr_num_dup (CRNum *a_this) ; 106 107guchar * 108cr_num_to_string (CRNum *a_this) ; 109 110enum CRStatus 111cr_num_copy (CRNum *a_dest, CRNum *a_src) ; 112 113enum CRStatus 114cr_num_set (CRNum *a_this, gdouble a_val, 115 enum CRNumType a_type) ; 116 117gboolean 118cr_num_is_fixed_length (CRNum *a_this) ; 119 120void 121cr_num_destroy (CRNum *a_this) ; 122 123 124G_END_DECLS 125 126 127#endif /*__CR_NUM_H__*/ 128