48 result = g_try_malloc (
sizeof (
CRNum));
55 memset (result, 0,
sizeof (
CRNum));
77 g_return_val_if_fail (result, NULL);
80 result->
type = a_type;
97 gdouble test_val = 0.0;
99 guchar *tmp_char1 = NULL,
103 g_return_val_if_fail (a_this, NULL);
105 test_val = a_this->
val - (glong) a_this->
val;
108 tmp_char1 = (guchar *) g_strdup_printf (
"%ld", (glong) a_this->
val);
110 tmp_char1 = (guchar *) g_new0 (
char, G_ASCII_DTOSTR_BUF_SIZE + 1);
111 if (tmp_char1 != NULL)
112 g_ascii_dtostr ((gchar *) tmp_char1, G_ASCII_DTOSTR_BUF_SIZE, a_this->
val);
115 g_return_val_if_fail (tmp_char1, NULL);
117 switch (a_this->
type) {
119 tmp_char2 = (guchar *)
"em";
123 tmp_char2 = (guchar *)
"ex";
127 tmp_char2 = (guchar *)
"px";
131 tmp_char2 = (guchar *)
"in";
135 tmp_char2 = (guchar *)
"cm";
139 tmp_char2 = (guchar *)
"mm";
143 tmp_char2 = (guchar *)
"pt";
147 tmp_char2 = (guchar *)
"pc";
151 tmp_char2 = (guchar *)
"deg";
155 tmp_char2 = (guchar *)
"rad";
159 tmp_char2 = (guchar *)
"grad";
163 tmp_char2 = (guchar *)
"ms";
167 tmp_char2 = (guchar *)
"s";
171 tmp_char2 = (guchar *)
"Hz";
175 tmp_char2 = (guchar *)
"KHz";
179 tmp_char2 = (guchar *)
"%";
182 tmp_char2 = (guchar *)
"inherit";
185 tmp_char2 = (guchar *)
"auto";
191 tmp_char2 = (guchar *)
"unknown";
196 result = (guchar *) g_strconcat ((gchar *) tmp_char1, tmp_char2, NULL);
222 memcpy (a_dest, a_src,
sizeof (
CRNum));
239 CRNum *result = NULL;
242 g_return_val_if_fail (a_this, NULL);
245 g_return_val_if_fail (result, NULL);
248 g_return_val_if_fail (status ==
CR_OK, NULL);
269 a_this->
type = a_type;
289 gboolean result = FALSE;
291 g_return_val_if_fail (a_this, FALSE);
310 g_return_if_fail (a_this);
guchar * cr_num_to_string(CRNum const *a_this)
cr_num_to_string: @a_this: the current instance of CRNum.
gboolean cr_num_is_fixed_length(CRNum const *a_this)
cr_num_is_fixed_length: @a_this: the current instance of CRNum .
enum CRStatus cr_num_set(CRNum *a_this, gdouble a_val, enum CRNumType a_type)
cr_num_set: Sets an instance of CRNum.
enum CRStatus cr_num_copy(CRNum *a_dest, CRNum const *a_src)
cr_num_copy: @a_src: the instance of CRNum to copy.
void cr_num_destroy(CRNum *a_this)
cr_num_destroy: @a_this: the this pointer of the current instance of CRNum.
CRNum * cr_num_dup(CRNum const *a_this)
cr_num_dup: @a_this: the instance of CRNum to duplicate.
CRStatus
The status type returned by the methods of the croco library.
The declaration of the CRNum class.
CRNumType
The different types of numbers.
An abstraction of a number (num) as defined in the css2 spec.
CRNum * cr_num_new_with_val(gdouble a_val, enum CRNumType a_type)
cr_num_new_with_val: @a_val: the numerical value of the number.
CRNum * cr_num_new(void)
@CRNum:
#define cr_utils_trace_info(a_msg)
Traces an info message.