Libcroco
|
00001 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ 00002 00003 /* 00004 * This file is part of The Croco Library 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of version 2.1 of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00018 * USA 00019 * 00020 * Author: Dodji Seketeli 00021 * See COPYRIGHTS file for copyright information 00022 */ 00023 00024 00025 /** 00026 *@file 00027 *The declaration 00028 *of the #CRNum class. 00029 */ 00030 00031 #ifndef __CR_NUM_H__ 00032 #define __CR_NUM_H__ 00033 00034 #include <glib.h> 00035 #include "cr-utils.h" 00036 #include "cr-parsing-location.h" 00037 00038 G_BEGIN_DECLS 00039 00040 /** 00041 *@file 00042 *The declaration of the #CRNum class. 00043 * 00044 */ 00045 00046 /** 00047 *The different types 00048 *of numbers. 00049 *Please, do not modify 00050 *the declaration order of the enum 00051 *members, unless you know 00052 *what you are doing. 00053 */ 00054 enum CRNumType 00055 { 00056 NUM_AUTO = 0, 00057 NUM_GENERIC, 00058 NUM_LENGTH_EM, 00059 NUM_LENGTH_EX, 00060 NUM_LENGTH_PX, 00061 NUM_LENGTH_IN, 00062 NUM_LENGTH_CM, 00063 NUM_LENGTH_MM, 00064 NUM_LENGTH_PT, 00065 NUM_LENGTH_PC, 00066 NUM_ANGLE_DEG, 00067 NUM_ANGLE_RAD, 00068 NUM_ANGLE_GRAD, 00069 NUM_TIME_MS, 00070 NUM_TIME_S, 00071 NUM_FREQ_HZ, 00072 NUM_FREQ_KHZ, 00073 NUM_PERCENTAGE, 00074 NUM_INHERIT, 00075 NUM_UNKNOWN_TYPE, 00076 NB_NUM_TYPE 00077 } ; 00078 00079 00080 /** 00081 *An abstraction of a number (num) 00082 *as defined in the css2 spec. 00083 */ 00084 typedef struct _CRNum CRNum ; 00085 00086 /** 00087 *An abstraction of a number (num) 00088 *as defined in the css2 spec. 00089 */ 00090 struct _CRNum 00091 { 00092 enum CRNumType type ; 00093 gdouble val ; 00094 CRParsingLocation location ; 00095 } ; 00096 00097 CRNum * 00098 cr_num_new (void) ; 00099 00100 CRNum * 00101 cr_num_new_with_val (gdouble a_val, 00102 enum CRNumType a_type) ; 00103 00104 CRNum * 00105 cr_num_dup (CRNum const *a_this) ; 00106 00107 guchar * 00108 cr_num_to_string (CRNum const *a_this) ; 00109 00110 enum CRStatus 00111 cr_num_copy (CRNum *a_dest, CRNum const *a_src) ; 00112 00113 enum CRStatus 00114 cr_num_set (CRNum *a_this, gdouble a_val, 00115 enum CRNumType a_type) ; 00116 00117 gboolean 00118 cr_num_is_fixed_length (CRNum const *a_this) ; 00119 00120 void 00121 cr_num_destroy (CRNum *a_this) ; 00122 00123 00124 G_END_DECLS 00125 00126 00127 #endif /*__CR_NUM_H__*/