cr-num.h 2.5 KB

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