PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/cssed-0.4.0/libcroco/parser/cr-simple-sel.h

#
C Header | 130 lines | 46 code | 24 blank | 60 comment | 0 complexity | ceb09355a784cee8ebe5b5bf36ff7ee0 MD5 | raw file
Possible License(s): GPL-2.0
  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. #ifndef __CR_SEL_H__
  23. #define __CR_SEL_H__
  24. #include <stdio.h>
  25. #include <glib.h>
  26. #include "cr-additional-sel.h"
  27. #include "cr-parsing-location.h"
  28. G_BEGIN_DECLS
  29. /**
  30. *@file
  31. *the declaration of the #CRSimpleSel class.
  32. *
  33. */
  34. enum Combinator
  35. {
  36. NO_COMBINATOR,
  37. COMB_WS,/*whitesape*/
  38. COMB_PLUS,
  39. COMB_GT/*greater than*/
  40. } ;
  41. enum SimpleSelectorType
  42. {
  43. NO_SELECTOR_TYPE = 0,
  44. UNIVERSAL_SELECTOR = 1,
  45. TYPE_SELECTOR = 1 << 1
  46. } ;
  47. typedef struct _CRSimpleSel CRSimpleSel ;
  48. /**
  49. *The abstraction of a css2 simple selection list
  50. *as defined by the right part of the "selector" production in the
  51. *appendix D.1 of the css2 spec.
  52. *It is basically a list of simple selector, each
  53. *simple selector being separated by a combinator.
  54. *
  55. *In the libcroco's implementation, each simple selector
  56. *is made of at most two parts:
  57. *
  58. *1/An element name or 'type selector' (which can hold a '*' and
  59. *then been called 'universal selector')
  60. *
  61. *2/An additional selector that "specializes" the preceding type or
  62. *universal selector. The additionnal selector can be either
  63. *an id selector, or a class selector, or an attribute selector.
  64. */
  65. struct _CRSimpleSel
  66. {
  67. enum SimpleSelectorType type_mask ;
  68. gboolean is_case_sentive ;
  69. CRString * name ;
  70. /**
  71. *The combinator that separates
  72. *this simple selector from the previous
  73. *one.
  74. */
  75. enum Combinator combinator ;
  76. /**
  77. *The additional selector list of the
  78. *current simple selector.
  79. *An additional selector may
  80. *be a class selector, an id selector,
  81. *or an attribute selector.
  82. *Note that this field is a linked list.
  83. */
  84. CRAdditionalSel *add_sel ;
  85. /*
  86. *the specificity as specified by
  87. *chapter 6.4.3 of the spec.
  88. */
  89. gulong specificity ;
  90. CRSimpleSel *next ;
  91. CRSimpleSel *prev ;
  92. CRParsingLocation location ;
  93. } ;
  94. CRSimpleSel * cr_simple_sel_new (void) ;
  95. CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel *a_this,
  96. CRSimpleSel *a_sel) ;
  97. CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this,
  98. CRSimpleSel *a_sel) ;
  99. guchar * cr_simple_sel_to_string (CRSimpleSel *a_this) ;
  100. guchar * cr_simple_sel_one_to_string (CRSimpleSel * a_this) ;
  101. enum CRStatus cr_simple_sel_dump (CRSimpleSel *a_this, FILE *a_fp) ;
  102. enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel *a_this) ;
  103. enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ;
  104. void cr_simple_sel_destroy (CRSimpleSel *a_this) ;
  105. G_END_DECLS
  106. #endif /*__CR_SIMPLE_SEL_H__*/