cr-selector.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. *
  20. * Author: Dodji Seketeli
  21. * See COPYRIGHTS file for copyright information.
  22. */
  23. #ifndef __CR_SELECTOR_H__
  24. #define __CR_SELECTOR_H__
  25. #include <stdio.h>
  26. #include "cr-utils.h"
  27. #include "cr-simple-sel.h"
  28. #include "cr-parsing-location.h"
  29. /**
  30. *@file
  31. *The declaration file of the #CRSelector file.
  32. */
  33. G_BEGIN_DECLS
  34. typedef struct _CRSelector CRSelector ;
  35. /**
  36. *Abstracts a CSS2 selector as defined in the right part
  37. *of the 'ruleset" production in the appendix D.1 of the
  38. *css2 spec.
  39. *It is actually the abstraction of a comma separated list
  40. *of simple selectors list.
  41. *In a css2 file, a selector is a list of simple selectors
  42. *separated by a comma.
  43. *e.g: sel0, sel1, sel2 ...
  44. *Each seln is a simple selector
  45. */
  46. struct _CRSelector
  47. {
  48. /**
  49. *A Selection expression.
  50. *It is a list of basic selectors.
  51. *Each basic selector can be either an element
  52. *selector, an id selector, a class selector, an
  53. *attribute selector, an universal selector etc ...
  54. */
  55. CRSimpleSel *simple_sel ;
  56. /**The next selector list element*/
  57. CRSelector *next ;
  58. CRSelector *prev ;
  59. CRParsingLocation location ;
  60. glong ref_count ;
  61. };
  62. CRSelector* cr_selector_new (CRSimpleSel *a_sel_expr) ;
  63. CRSelector * cr_selector_parse_from_buf (const guchar * a_char_buf,
  64. enum CREncoding a_enc) ;
  65. CRSelector* cr_selector_append (CRSelector *a_this, CRSelector *a_new) ;
  66. CRSelector* cr_selector_append_simple_sel (CRSelector *a_this,
  67. CRSimpleSel *a_simple_sel) ;
  68. CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ;
  69. guchar * cr_selector_to_string (CRSelector const *a_this) ;
  70. void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ;
  71. void cr_selector_ref (CRSelector *a_this) ;
  72. gboolean cr_selector_unref (CRSelector *a_this) ;
  73. void cr_selector_destroy (CRSelector *a_this) ;
  74. G_END_DECLS
  75. #endif /*__CR_SELECTOR_H__*/