Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

cr-num.h

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

Generated on Wed Oct 1 01:36:45 2003 for Libcroco by doxygen 1.3.3