cr-declaration.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. * See the COPYRIGHTS file for copyright information.
  20. */
  21. #ifndef __CR_DECLARATION_H__
  22. #define __CR_DECLARATION_H__
  23. #include <stdio.h>
  24. #include "cr-utils.h"
  25. #include "cr-term.h"
  26. #include "cr-parsing-location.h"
  27. G_BEGIN_DECLS
  28. /**
  29. *@file
  30. *The declaration of the #CRDeclaration class.
  31. */
  32. /*forward declaration of what is defined in cr-statement.h*/
  33. typedef struct _CRStatement CRStatement ;
  34. /**
  35. *The abstraction of a css declaration defined by the
  36. *css2 spec in chapter 4.
  37. *It is actually a chained list of property/value pairs.
  38. */
  39. typedef struct _CRDeclaration CRDeclaration ;
  40. struct _CRDeclaration
  41. {
  42. /**The property.*/
  43. CRString *property ;
  44. /**The value of the property.*/
  45. CRTerm *value ;
  46. /*the ruleset that contains this declaration*/
  47. CRStatement *parent_statement ;
  48. /*the next declaration*/
  49. CRDeclaration *next ;
  50. /*the previous one declaration*/
  51. CRDeclaration *prev ;
  52. /*does the declaration have the important keyword ?*/
  53. gboolean important ;
  54. glong ref_count ;
  55. CRParsingLocation location ;
  56. /*reserved for future usage*/
  57. gpointer rfu0 ;
  58. gpointer rfu1 ;
  59. gpointer rfu2 ;
  60. gpointer rfu3 ;
  61. } ;
  62. CRDeclaration * cr_declaration_new (CRStatement *a_statement,
  63. CRString *a_property,
  64. CRTerm *a_value) ;
  65. CRDeclaration * cr_declaration_parse_from_buf (CRStatement *a_statement,
  66. const guchar *a_str,
  67. enum CREncoding a_enc) ;
  68. CRDeclaration * cr_declaration_parse_list_from_buf (const guchar *a_str,
  69. enum CREncoding a_enc) ;
  70. CRDeclaration * cr_declaration_append (CRDeclaration *a_this,
  71. CRDeclaration *a_new) ;
  72. CRDeclaration * cr_declaration_append2 (CRDeclaration *a_this,
  73. CRString *a_prop,
  74. CRTerm *a_value) ;
  75. CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this,
  76. CRDeclaration *a_new) ;
  77. CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ;
  78. void
  79. cr_declaration_dump (CRDeclaration const *a_this,
  80. FILE *a_fp, glong a_indent,
  81. gboolean a_one_per_line) ;
  82. void cr_declaration_dump_one (CRDeclaration const *a_this,
  83. FILE *a_fp, glong a_indent) ;
  84. gint cr_declaration_nr_props (CRDeclaration const *a_this) ;
  85. CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this,
  86. int itemnr) ;
  87. CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this,
  88. const guchar *a_str) ;
  89. gchar * cr_declaration_to_string (CRDeclaration const *a_this,
  90. gulong a_indent) ;
  91. guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,
  92. gulong a_indent) ;
  93. guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this,
  94. gulong a_indent,
  95. gboolean a_one_decl_per_line) ;
  96. void cr_declaration_ref (CRDeclaration *a_this) ;
  97. gboolean cr_declaration_unref (CRDeclaration *a_this) ;
  98. void cr_declaration_destroy (CRDeclaration *a_this) ;
  99. G_END_DECLS
  100. #endif /*__CR_DECLARATION_H__*/