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