IElementOps.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. #region Copyright and License
  2. //
  3. // Fizzler - CSS Selector Engine for Microsoft .NET Framework
  4. // Copyright (c) 2009 Atif Aziz, Colin Ramsay. All rights reserved.
  5. //
  6. // This library is free software; you can redistribute it and/or modify it under
  7. // the terms of the GNU Lesser General Public License as published by the Free
  8. // Software Foundation; either version 3 of the License, or (at your option)
  9. // any later version.
  10. //
  11. // This library is distributed in the hope that it will be useful, but WITHOUT
  12. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  14. // details.
  15. //
  16. // You should have received a copy of the GNU Lesser General Public License
  17. // along with this library; if not, write to the Free Software Foundation, Inc.,
  18. // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. //
  20. #endregion
  21. #pragma warning disable
  22. namespace Fizzler
  23. {
  24. /// <summary>
  25. /// Represents a selectors implementation for an arbitrary document/node system.
  26. /// </summary>
  27. public interface IElementOps<TElement>
  28. {
  29. //
  30. // Selectors
  31. //
  32. /// <summary>
  33. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#type-selectors">type selector</a>,
  34. /// which represents an instance of the element type in the document tree.
  35. /// </summary>
  36. Selector<TElement> Type(NamespacePrefix prefix, string name);
  37. /// <summary>
  38. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#universal-selector">universal selector</a>,
  39. /// any single element in the document tree in any namespace
  40. /// (including those without a namespace) if no default namespace
  41. /// has been specified for selectors.
  42. /// </summary>
  43. Selector<TElement> Universal(NamespacePrefix prefix);
  44. /// <summary>
  45. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#Id-selectors">ID selector</a>,
  46. /// which represents an element instance that has an identifier that
  47. /// matches the identifier in the ID selector.
  48. /// </summary>
  49. Selector<TElement> Id(string id);
  50. /// <summary>
  51. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#class-html">class selector</a>,
  52. /// which is an alternative <see cref="AttributeIncludes"/> when
  53. /// representing the <c>class</c> attribute.
  54. /// </summary>
  55. Selector<TElement> Class(string clazz);
  56. //
  57. // Attribute selectors
  58. //
  59. /// <summary>
  60. /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a>
  61. /// that represents an element with the given attribute <paramref name="name"/>
  62. /// whatever the values of the attribute.
  63. /// </summary>
  64. Selector<TElement> AttributeExists(NamespacePrefix prefix, string name);
  65. /// <summary>
  66. /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a>
  67. /// that represents an element with the given attribute <paramref name="name"/>
  68. /// and whose value is exactly <paramref name="value"/>.
  69. /// </summary>
  70. Selector<TElement> AttributeExact(NamespacePrefix prefix, string name, string value);
  71. /// <summary>
  72. /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a>
  73. /// that represents an element with the given attribute <paramref name="name"/>
  74. /// and whose value is a whitespace-separated list of words, one of
  75. /// which is exactly <paramref name="value"/>.
  76. /// </summary>
  77. Selector<TElement> AttributeIncludes(NamespacePrefix prefix, string name, string value);
  78. /// <summary>
  79. /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a>
  80. /// that represents an element with the given attribute <paramref name="name"/>,
  81. /// its value either being exactly <paramref name="value"/> or beginning
  82. /// with <paramref name="value"/> immediately followed by "-" (U+002D).
  83. /// </summary>
  84. Selector<TElement> AttributeDashMatch(NamespacePrefix prefix, string name, string value);
  85. /// <summary>
  86. /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a>
  87. /// that represents an element with the attribute <paramref name="name"/>
  88. /// whose value begins with the prefix <paramref name="value"/>.
  89. /// </summary>
  90. Selector<TElement> AttributePrefixMatch(NamespacePrefix prefix, string name, string value);
  91. /// <summary>
  92. /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a>
  93. /// that represents an element with the attribute <paramref name="name"/>
  94. /// whose value ends with the suffix <paramref name="value"/>.
  95. /// </summary>
  96. Selector<TElement> AttributeSuffixMatch(NamespacePrefix prefix, string name, string value);
  97. /// <summary>
  98. /// Generates an <a href="http://www.w3.org/TR/css3-selectors/#attribute-selectors">attribute selector</a>
  99. /// that represents an element with the attribute <paramref name="name"/>
  100. /// whose value contains at least one instance of the substring <paramref name="value"/>.
  101. /// </summary>
  102. Selector<TElement> AttributeSubstring(NamespacePrefix prefix, string name, string value);
  103. //
  104. // Pseudo-class selectors
  105. //
  106. /// <summary>
  107. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#pseudo-classes">pseudo-class selector</a>,
  108. /// which represents an element that is the first child of some other element.
  109. /// </summary>
  110. Selector<TElement> FirstChild();
  111. /// <summary>
  112. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#pseudo-classes">pseudo-class selector</a>,
  113. /// which represents an element that is the last child of some other element.
  114. /// </summary>
  115. Selector<TElement> LastChild();
  116. /// <summary>
  117. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#pseudo-classes">pseudo-class selector</a>,
  118. /// which represents an element that is the N-th child of some other element.
  119. /// </summary>
  120. Selector<TElement> NthChild(int a, int b);
  121. /// <summary>
  122. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#pseudo-classes">pseudo-class selector</a>,
  123. /// which represents an element that has a parent element and whose parent
  124. /// element has no other element children.
  125. /// </summary>
  126. Selector<TElement> OnlyChild();
  127. /// <summary>
  128. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#pseudo-classes">pseudo-class selector</a>,
  129. /// which represents an element that has no children at all.
  130. /// </summary>
  131. Selector<TElement> Empty();
  132. //
  133. // Combinators
  134. //
  135. /// <summary>
  136. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#combinators">combinator</a>,
  137. /// which represents a childhood relationship between two elements.
  138. /// </summary>
  139. Selector<TElement> Child();
  140. /// <summary>
  141. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#combinators">combinator</a>,
  142. /// which represents a relationship between two elements where one element is an
  143. /// arbitrary descendant of some ancestor element.
  144. /// </summary>
  145. Selector<TElement> Descendant();
  146. /// <summary>
  147. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#combinators">combinator</a>,
  148. /// which represents elements that share the same parent in the document tree and
  149. /// where the first element immediately precedes the second element.
  150. /// </summary>
  151. Selector<TElement> Adjacent();
  152. /// <summary>
  153. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#combinators">combinator</a>,
  154. /// which separates two sequences of simple selectors. The elements represented
  155. /// by the two sequences share the same parent in the document tree and the
  156. /// element represented by the first sequence precedes (not necessarily
  157. /// immediately) the element represented by the second one.
  158. /// </summary>
  159. Selector<TElement> GeneralSibling();
  160. /// <summary>
  161. /// Generates a <a href="http://www.w3.org/TR/css3-selectors/#pseudo-classes">pseudo-class selector</a>,
  162. /// which represents an element that is the N-th child from bottom up of some other element.
  163. /// </summary>
  164. Selector<TElement> NthLastChild(int a, int b);
  165. }
  166. }
  167. #pragma warning restore