Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some XML doc cleanup

  • Loading branch information...
commit a571ee8d039ef28f815a8f92da2e8a271c61d63d 1 parent c8fdeb6
@jamietre authored
View
657 distribution/CsQuery.XML
@@ -17,25 +17,45 @@
<returns></returns>
</member>
<member name="M:CsQuery.Objects.IsJson(System.Object)">
- <summary>
- Returns true if the string appears to be JSON.
- </summary>
- <param name="text"></param>
- <returns></returns>
+ <summary>
+ Returns true if the object is a string, and appears to be JSON, e.g. it starts with a single
+ curly brace.
+ </summary>
+
+ <param name="obj">
+ The object to test.
+ </param>
+
+ <returns>
+ true if json, false if not.
+ </returns>
</member>
<member name="M:CsQuery.Objects.IsImmutable(System.Object)">
- <summary>
- Only value types, strings, and null
- </summary>
- <param name="obj"></param>
- <returns></returns>
+ <summary>
+ Tests whether an object is a common immutable, specifically, value types, strings, and null.
+ KeyValuePairs are specifically excluded. (Why?)
+ </summary>
+
+ <param name="obj">
+ .
+ </param>
+
+ <returns>
+ true if immutable, false if not.
+ </returns>
</member>
<member name="M:CsQuery.Objects.IsExtendableType(System.Object)">
- <summary>
- Returns false if this is a value type, null string, or enumerable (but not Extendable)
- </summary>
- <param name="obj"></param>
- <returns></returns>
+ <summary>
+ Returns false if this is a value type, null string, or enumerable (but not Extendable)
+ </summary>
+
+ <param name="obj">
+ .
+ </param>
+
+ <returns>
+ true if extendable type, false if not.
+ </returns>
</member>
<member name="M:CsQuery.Objects.IsTruthy(System.Object)">
<summary>
@@ -49,34 +69,98 @@
<returns></returns>
</member>
<member name="M:CsQuery.Objects.IsNumericType(System.Type)">
- <summary>
- Returns true if the object is a primitive numeric type, e.g. exluding string &amp; char
- </summary>
- <param name="obj"></param>
- <returns></returns>
+ <summary>
+ Returns true if the object is a primitive numeric type, that is, any primtive except string
+ &amp; char.
+ </summary>
+
+ <param name="type">
+ The type to test.
+ </param>
+
+ <returns>
+ true if numeric type, false if not.
+ </returns>
</member>
<member name="M:CsQuery.Objects.IsNativeType(System.Type)">
- <summary>
- Returns true if the value is a JS native type (string, number, bool, datetime)
- </summary>
- <param name="t"></param>
- <returns></returns>
+ <summary>
+ Returns true if the value is a Javascript native type (string, number, bool, datetime)
+ </summary>
+
+ <param name="type">
+ The type to test
+ </param>
+
+ <returns>
+ true if a Javascript native type, false if not.
+ </returns>
+ </member>
+ <member name="M:CsQuery.Objects.Join(System.Array)">
+ <summary>
+ Combine elements of an array into a single string, separated by a comma.
+ </summary>
+
+ <param name="array">
+ The array to join.
+ </param>
+
+ <returns>
+ A string separated by a comma.
+ </returns>
+ </member>
+ <member name="M:CsQuery.Objects.Join(System.Collections.IEnumerable)">
+ <summary>
+ Combine elements of a sequenceinto a single string, separated by a comma.
+ </summary>
+
+ <param name="list">
+ A list of objects.
+ </param>
+
+ <returns>
+ A string containging the string representation of each object in the sequence separated by a
+ comma.
+ </returns>
</member>
<member name="M:CsQuery.Objects.IsExpando(System.Object)">
- <summary>
- Test if an object is "Expando-like", e.g. a an IDictionary-string,object-
- </summary>
- <param name="obj"></param>
- <returns></returns>
+ <summary>
+ Test if an object is "Expando-like", e.g. is an IDictionary&lt;string,object&gt;.
+ </summary>
+
+ <param name="obj">
+ The object to test.
+ </param>
+
+ <returns>
+ true if expando, false if not.
+ </returns>
</member>
<member name="M:CsQuery.Objects.IsEmptyExpando(System.Object)">
- <summary>
- Test if an object is a an IDictionary-string,object- that is empty
- </summary>
- <param name="obj"></param>
- <returns></returns>
+ <summary>
+ Test if an object is a an IDictionary&lt;string,object&gt; that is empty.
+ </summary>
+
+ <param name="obj">
+ The object to test
+ </param>
+
+ <returns>
+ true if empty expando, false if not.
+ </returns>
+ </member>
+ <member name="M:CsQuery.Objects.IsKeyValuePair(System.Object)">
+ <summary>
+ Test if an object is a KeyValuePair&lt;,&gt; (e.g. of any types)
+ </summary>
+
+ <param name="obj">
+ The object to test
+ </param>
+
+ <returns>
+ true if key value pair, false if not.
+ </returns>
</member>
- <!-- Badly formed XML comment ignored for member "M:CsQuery.Objects.IsKeyValuePair(System.Object)" -->
<member name="M:CsQuery.Objects.Coerce(System.Object)">
<summary>
Coerce a javascript object into a Javascript type (null, bool, int, double, datetime, or string). If you know what the
@@ -86,12 +170,24 @@
<returns></returns>
</member>
<member name="M:CsQuery.Objects.Convert``1(System.Object)">
- <summary>
- Convert an object of any value type to the specified type using any known means
- </summary>
- <param name="value"></param>
- <param name="type"></param>
- <returns></returns>
+ <summary>
+ Convert an object of any value type to the specified type using any known means.
+ </summary>
+
+ <exception cref="T:System.InvalidCastException">
+ Thrown when an object cannot be cast to a required type.
+ </exception>
+
+ <typeparam name="T">
+ Generic type parameter.
+ </typeparam>
+ <param name="value">
+ The object to convert
+ </param>
+
+ <returns>
+ An object of the target type
+ </returns>
</member>
<member name="M:CsQuery.Objects.Convert(System.Object,System.Type)">
<summary>
@@ -171,13 +267,37 @@
<param name="obj"></param>
<returns></returns>
</member>
- <!-- Badly formed XML comment ignored for member "M:CsQuery.Objects.Dict2Dynamic``1(System.Collections.Generic.IDictionary{System.String,System.Object})" -->
+ <member name="M:CsQuery.Objects.Dict2Dynamic``1(System.Collections.Generic.IDictionary{System.String,System.Object})">
+ <summary>
+ Convert (recursively) an IDictionary&lt;string,object&gt; to a dynamic object.
+ </summary>
+
+ <typeparam name="T">
+ Generic type parameter.
+ </typeparam>
+ <param name="obj">
+ The source dicationary
+ </param>
+
+ <returns>
+ A new dynamic object
+ </returns>
+ </member>
<member name="M:CsQuery.Objects.Join(System.Collections.Generic.IEnumerable{System.String},System.String)">
- <summary>
- Combine elements of a list into a single string, separated by separator
- </summary>
- <param name="list"></param>
- <returns></returns>
+ <summary>
+ Combine elements of a sequence into a single string, separated by separator.
+ </summary>
+
+ <param name="list">
+ The source sequence.
+ </param>
+ <param name="separator">
+ The separator.
+ </param>
+
+ <returns>
+ A string.
+ </returns>
</member>
<member name="M:CsQuery.Objects.ParseValue(System.Object)">
<summary>
@@ -202,17 +322,46 @@
<param name="type"></param>
<returns></returns>
</member>
- <!-- Badly formed XML comment ignored for member "M:CsQuery.Objects.Dict2Dynamic``1(System.Collections.Generic.IDictionary{System.String,System.Object},System.Boolean)" -->
+ <member name="M:CsQuery.Objects.Dict2Dynamic``1(System.Collections.Generic.IDictionary{System.String,System.Object},System.Boolean)">
+ <summary>
+ Convert any IDictionary&lt;string,object&gt; into an expandoobject recursively.
+ </summary>
+
+ <typeparam name="T">
+ The type of target to create. It must implementing IDynamicMetaObjectProvider; if it is
+ actually the interface IDynamicMetaObjectProvider, then the default dynamic object type will
+ be created.
+ </typeparam>
+ <param name="obj">
+ The source dictionary
+ </param>
+ <param name="convertDates">
+ .
+ </param>
+
+ <returns>
+ .
+ </returns>
+ </member>
<member name="M:CsQuery.Objects.Extend(System.Boolean,System.Object,System.Object[])">
- <summary>
- Map properties of inputObjects to target. If target is an expando object, it will be updated. If not,
- a new one will be created including the properties of target and inputObjects.
- </summary>
- <param name="parents"></param>
- <param name="deep"></param>
- <param name="target"></param>
- <param name="inputObjects"></param>
- <returns></returns>
+ <summary>
+ Map properties of inputObjects to target. If target is an expando object, it will be updated.
+ If not, a new one will be created including the properties of target and inputObjects.
+ </summary>
+
+ <param name="deep">
+ When true, will clone properties that are objects.
+ </param>
+ <param name="target">
+ The target of the mapping, or null to create a new target
+ </param>
+ <param name="inputObjects">
+ One or more objects that are the source of the mapping
+ </param>
+
+ <returns>
+ The target object itself, if non-null, or a new dynamic object, if the target is null
+ </returns>
</member>
<member name="M:CsQuery.Objects.ToExpando(System.Object)">
<summary>
@@ -436,12 +585,21 @@
<returns></returns>
</member>
<member name="M:CsQuery.HtmlParser.IterationData.TryGetLiteral(CsQuery.HtmlParser.HtmlElementFactory,CsQuery.IDomObject@)">
- <summary>
- Returns a literal object for the text between HtmlStart (the last position of the end of a tag) and the current position.
- If !AllowLiterals then it's wrapped in a span.
- </summary>
- <param name="current"></param>
- <returns></returns>
+ <summary>
+ Returns a literal object for the text between HtmlStart (the last position of the end of a
+ tag) and the current position. If !AllowLiterals then it's wrapped in a span.
+ </summary>
+
+ <param name="factory">
+ The HTML factory to operate against
+ </param>
+ <param name="literal">
+ [out] The literal.
+ </param>
+
+ <returns>
+ true if it succeeds, false if it fails.
+ </returns>
</member>
<member name="M:CsQuery.HtmlParser.IterationData.CloseElement(CsQuery.HtmlParser.HtmlElementFactory)">
<summary>
@@ -917,7 +1075,7 @@
use the ChildrenAllowed property.
</summary>
- <seealso cref="!:ChildrenAllowed"/>
+ <seealso cref="P:CsQuery.IDomObject.ChildrenAllowed"/>
</member>
<member name="P:CsQuery.IDomNode.ChildNodes">
<summary>
@@ -7605,28 +7763,40 @@
<returns>CSSStyleDeclaration</returns>
</member>
<member name="M:CsQuery.Implementation.CSSStyleDeclaration.SetStyles(System.String)">
- <summary>
- Sets all the styles from a single CSS style string. Any existing styles will be erased.
- Styles will be validated and an error thrown if an invalid style is attempted.
- </summary>
- <param name="styles">A legal HTML style string</param>
- <param name="strict">When true, the styles will be validated and an error thrown if any are not valid</param>
+ <summary>
+ Sets all the styles from a single CSS style string. Any existing styles will be erased.
+ Styles will be validated and an error thrown if an invalid style is attempted.
+ </summary>
+
+ <param name="styles">
+ A legal HTML style string.
+ </param>
</member>
<member name="M:CsQuery.Implementation.CSSStyleDeclaration.SetStyles(System.String,System.Boolean)">
- <summary>
- Sets all the styles from a single CSS style string. Any existing styles will be erased.
- This method is used by DomElementFactory (not in strict mode).
- </summary>
- <param name="styles">A legal HTML style string</param>
- <param name="strict">When true, the styles will be validated and an error thrown if any are not valid</param>
+ <summary>
+ Sets all the styles from a single CSS style string. Any existing styles will be erased. This
+ method is used by DomElementFactory (not in strict mode).
+ </summary>
+
+ <param name="styles">
+ A legal HTML style string.
+ </param>
+ <param name="strict">
+ When true, the styles will be validated and an error thrown if any are not valid.
+ </param>
</member>
<member name="M:CsQuery.Implementation.CSSStyleDeclaration.AddStyles(System.String,System.Boolean)">
- <summary>
- Add one or more styles to this element. Unlike SetStyle, existing styles are not affected, except
- for existing styles of the same name.
- </summary>
- <param name="styles"></param>
- <param name="strict"></param>
+ <summary>
+ Add one or more styles to this element. Unlike SetStyle, existing styles are not affected,
+ except for existing styles of the same name.
+ </summary>
+
+ <param name="styles">
+ The CSS style string
+ </param>
+ <param name="strict">
+ When true, the styles will be validated as CSS3 before adding.
+ </param>
</member>
<member name="M:CsQuery.Implementation.CSSStyleDeclaration.Remove(System.String)">
<summary>
@@ -7700,7 +7870,11 @@
<param name="strict"></param>
<returns></returns>
</member>
- <!-- Badly formed XML comment ignored for member "T:CsQuery.IDomInnerText" -->
+ <member name="T:CsQuery.IDomInnerText">
+ <summary>
+ Special element for the text contents of SCRIPT &amp; TEXTAREA objects.
+ </summary>
+ </member>
<member name="T:CsQuery.IDomDocument">
<summary>
An interface to a Document that represents an HTML document.
@@ -8890,10 +9064,13 @@
</value>
</member>
<member name="M:CsQuery.Implementation.NodeList.Add(CsQuery.IDomObject)">
- <summary>
- Add a child to this element
- </summary>
- <param name="element"></param>
+ <summary>
+ Add a child to this element.
+ </summary>
+
+ <param name="item">
+ The element to add
+ </param>
</member>
<member name="M:CsQuery.Implementation.NodeList.AddAlways(CsQuery.IDomObject)">
<summary>
@@ -8902,11 +9079,16 @@
<param name="item"></param>
</member>
<member name="M:CsQuery.Implementation.NodeList.Insert(System.Int32,CsQuery.IDomObject)">
- <summary>
- Adds a child element at a specific index
- </summary>
- <param name="index"></param>
- <param name="element"></param>
+ <summary>
+ Adds a child element at a specific index.
+ </summary>
+
+ <param name="index">
+ The index at which to insert the element
+ </param>
+ <param name="item">
+ The element to insert
+ </param>
</member>
<member name="M:CsQuery.Implementation.NodeList.RemoveAt(System.Int32)">
<summary>
@@ -8915,10 +9097,17 @@
<param name="index"></param>
</member>
<member name="M:CsQuery.Implementation.NodeList.Remove(CsQuery.IDomObject)">
- <summary>
- Remove an element from this element's children
- </summary>
- <param name="element"></param>
+ <summary>
+ Remove an element from this element's children.
+ </summary>
+
+ <param name="item">
+ The item to remove.
+ </param>
+
+ <returns>
+ true if it succeeds, false if the item was not found in the children.
+ </returns>
</member>
<member name="M:CsQuery.Implementation.NodeList.Clear">
<summary>
@@ -10013,19 +10202,144 @@
</member>
<member name="T:CsQuery.StringScanner.CharacterData">
<summary>
- A static class to provide attribute information about characters, e.g. determining whether or not it
- belongs to a number of predefined classes. This creates an array of every possible character with a
- uint that is a bitmap (of up to 32 possible values)
- This permits very fast access to this information since it only needs to be looked up
- via an index. Uses an array of 65536 uints = 256K of memory
-
+ A static class to provide attribute information about characters, e.g. determining whether or
+ not it belongs to a number of predefined classes. This creates an array of every possible
+ character with a uint that is a bitmap (of up to 32 possible values)
+ This permits very fast access to this information since it only needs to be looked up via an
+ index. Uses an array of 65536 uints = 256K of memory.
</summary>
</member>
<member name="M:CsQuery.StringScanner.CharacterData.#cctor">
<summary>
- Configuration of the xref of character info
+ Configuration of the xref of character info. This sets bitflags in the "characterFlags" array
+ for every unicode value that defines its attributes. This creates a lookup table allowing
+ very rapid access to metadata about a single character, useful during string-parsing and
+ scanning.
</summary>
</member>
+ <member name="F:CsQuery.StringScanner.CharacterData.charsHtmlSpaceArray">
+ <summary>
+ An array of all HTML "space" characters.
+ </summary>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.CreateCharacterInfo">
+ <summary>
+ Creates a new instance of the CharacterInfo class
+ </summary>
+
+ <returns>
+ The new character information.
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.CreateCharacterInfo(System.Char)">
+ <summary>
+ Creates a new instance of the CharacterInfo class.
+ </summary>
+
+ <param name="character">
+ The character to bind to the new instance.
+ </param>
+
+ <returns>
+ A new CharacterInfo instance.
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.CreateStringInfo">
+ <summary>
+ Creates a new StringInfo instance
+ </summary>
+
+ <returns>
+ The new StringInfo instance
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.CreateStringInfo(System.String)">
+ <summary>
+ Creates a new StringInfo instance bound to a string
+ </summary>
+
+ <param name="text">
+ The string to bind.
+ </param>
+
+ <returns>
+ The new StringInfo instance.
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.IsType(System.Char,CsQuery.StringScanner.CharacterType)">
+ <summary>
+ Test whether a character matches a set of flags defined by the paramter
+ </summary>
+
+ <param name="character">
+ The character to test
+ </param>
+ <param name="type">
+ The type to which to compare the character
+ </param>
+
+ <returns>
+ true if the character matches the flags in the test type, false if not
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.GetType(System.Char)">
+ <summary>
+ Gets a type with all flags set for the types implemented by this character
+ </summary>
+
+ <param name="character">
+ The character to test
+ </param>
+
+ <returns>
+ The type.
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.Closer(System.Char)">
+ <summary>
+ Return the closing character for a set of known opening enclosing characters (including
+ single and double quotes)
+ </summary>
+
+ <exception cref="T:System.InvalidOperationException">
+ Thrown when the character is not a known opening bound
+ </exception>
+
+ <param name="character">
+ The opening bound character
+ </param>
+
+ <returns>
+ The closing bound character
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.MatchingBound(System.Char)">
+ <summary>
+ Return the matching bound for known opening and closing bound characters (same as Closer, but
+ accepts closing tags and returns openers)
+ </summary>
+
+ <exception cref="T:System.InvalidOperationException">
+ Thrown when the requested operation is invalid.
+ </exception>
+
+ <param name="character">
+ The opening bound character
+ </param>
+
+ <returns>
+ The matching close character
+ </returns>
+ </member>
+ <member name="M:CsQuery.StringScanner.CharacterData.SetAlphaISO10646(System.UInt32)">
+ <summary>
+ Sets the bits for ISO 10646.
+ </summary>
+
+ <param name="hsb">
+ the target
+ </param>
+ </member>
<member name="M:CsQuery.StringScanner.CharacterData.SetHtmlIdNameExceptStart(System.UInt32)">
<summary>
Matches anything but the first character for a valid ID or name value. The first character is just alpha.
@@ -10055,22 +10369,6 @@
</summary>
<param name="hsb"></param>
</member>
- <member name="M:CsQuery.StringScanner.CharacterData.Closer(System.Char)">
- <summary>
- Return the closing character for a set of known opening enclosing characters
- (including single and double quotes)
- </summary>
- <param name="character"></param>
- <returns></returns>
- </member>
- <member name="M:CsQuery.StringScanner.CharacterData.MatchingBound(System.Char)">
- <summary>
- Return the matching bound for known opening and closing bound characters (same as Closer,
- but accepts closing tags and returns openers)
- </summary>
- <param name="character"></param>
- <returns></returns>
- </member>
<member name="T:CsQuery.Web.ServerConfig">
<summary>
Configuration opttions used when accessing remote resources
@@ -10607,19 +10905,25 @@
</summary>
</member>
<member name="M:CsQuery.IDomElement.ElementHtml">
+ <summary>
+ Returns the HTML for this element, but ignoring children/innerHTML.
+ </summary>
+
+ <returns>
+ A string of HTML.
+ </returns>
+ </member>
+ <member name="P:CsQuery.IDomElement.IsBlock">
<summary>
- Returns the HTML for this element, but ignoring children/innerHTML
+ The element is a block element.
</summary>
- <returns>A string of HTML</returns>
- <returntype>string</returntype>
</member>
- <member name="P:CsQuery.IDomElement.IsBlock">
+ <member name="P:CsQuery.IDomElement.ElementIndex">
<summary>
- The element is a block element
+ Get this element's index only among other elements (e.g. excluding text &amp; other non-
+ element node types)
</summary>
- <returntype>bool</returntype>
</member>
- <!-- Badly formed XML comment ignored for member "P:CsQuery.IDomElement.ElementIndex" -->
<member name="F:CsQuery.Implementation.DomElement._InnerAttributes">
<summary>
The dom attributes.
@@ -11252,20 +11556,9 @@
</param>
</member>
<member name="M:CsQuery.Implementation.DomElement.System#Collections#Generic#IEnumerable{System#Collections#Generic#KeyValuePair{System#String@System#String}}#GetEnumerator">
- <summary>
- Gets the enumerator.
- </summary>
-
- <typeparam name="string">
- Type of the string.
- </typeparam>
- <typeparam name="string">
- Type of the string.
- </typeparam>
-
- <returns>
- The enumerator.
- </returns>
+ <summary>
+ Gets the enumerator.
+ </summary>
</member>
<member name="M:CsQuery.Implementation.DomElement.System#Collections#IEnumerable#GetEnumerator">
<summary>
@@ -11754,14 +12047,70 @@
The character.
</param>
</member>
+ <member name="M:CsQuery.StringScanner.Implementation.CharacterInfo.op_Implicit(System.Char)~CsQuery.StringScanner.Implementation.CharacterInfo">
+ <summary>
+ CharacterInfo casting operator: creates a new instance from a single character
+ </summary>
+
+ <param name="character">
+ The character to bind to the new CharacterInfo class
+ </param>
+ </member>
+ <member name="M:CsQuery.StringScanner.Implementation.CharacterInfo.Create(System.Char)">
+ <summary>
+ Creates a new CharacterInfo instance from a character
+ </summary>
+
+ <param name="character">
+ The character to bind to this instance.
+ </param>
+
+ <returns>
+ A new CharacterInfo object
+ </returns>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Target">
+ <summary>
+ Gets or sets bound character for this instance. This is the character against which all tests
+ are performed.
+ </summary>
+ </member>
<member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Type">
<summary>
- Flags indicating the use of this character
+ Flags indicating the use of this character.
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Alpha">
+ <summary>
+ Gets a value indicating whether the character is alphabetic, e.g. a-z, A-Z
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Numeric">
+ <summary>
+ Gets a value indicating whether the bound character is numeric only, e.g. 0-9
</summary>
</member>
<member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.NumericExtended">
<summary>
- Returns true if numeric, dot or -
+ Test whether the character is numeric or part of a complete number, e.g. also includes '+', '-
+ ' and '.'.
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Lower">
+ <summary>
+ Test whether the character is lower-case
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Upper">
+ <summary>
+ Test whether the character is upper-case
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Whitespace">
+ <summary>
+ Test whether the character is whitespace. This is really HTML5 "space" and not ANSI
+ whitespace which. HTML5 space is much more restrictive; this is generally used to test
+ whether a character delimits an entity during HTML/CSS/HTML-related parsing.
</summary>
</member>
<member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Bound">
@@ -11769,7 +12118,27 @@
Enclosing, plus double and single quotes
</summary>
</member>
- <!-- Badly formed XML comment ignored for member "P:CsQuery.StringScanner.Implementation.CharacterInfo.Enclosing" -->
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Enclosing">
+ <summary>
+ Tests whether the character is an enclosing/bounding type, one of:
+ ()[]{}&lt;&gt;`´“”«».
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Quote">
+ <summary>
+ Tests whether the bound character is a single- or double-quote
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Parenthesis">
+ <summary>
+ Tests whether the bound character is an opening or closing parenthesis.
+ </summary>
+ </member>
+ <member name="P:CsQuery.StringScanner.Implementation.CharacterInfo.Separator">
+ <summary>
+ Tests
+ </summary>
+ </member>
<member name="T:CsQuery.Engine.PseudoClassSelectors.LastOfType">
<summary>
Matches the last element of the same type within its siblings
View
BIN  distribution/CsQuery.dll
Binary file not shown
View
BIN  distribution/CsQuery.pdb
Binary file not shown
View
2  source/CsQuery/Documentation/Changes.md
@@ -4,7 +4,7 @@ This is an informal log of changes to the project; major issues will be logged a
#####7/18/2012
-- Bugfix - Issue #20 - selector engine doesn't recognize hex escape sequences
+- Bugfix - Issue #20 - selector engine doesn't recognize hex escape sequences - from vitallium
#####7/17/2012
View
19 source/CsQuery/Dom/IDomElement.cs
@@ -10,24 +10,27 @@ namespace CsQuery
/// </summary>
public interface IDomElement : IDomContainer, IDomIndexedNode
{
-
/// <summary>
- /// The element is a block element
+ /// The element is a block element.
/// </summary>
- /// <returntype>bool</returntype>
+
bool IsBlock { get; }
/// <summary>
- /// Returns the HTML for this element, but ignoring children/innerHTML
+ /// Returns the HTML for this element, but ignoring children/innerHTML.
/// </summary>
- /// <returns>A string of HTML</returns>
- /// <returntype>string</returntype>
+ ///
+ /// <returns>
+ /// A string of HTML.
+ /// </returns>
+
string ElementHtml();
/// <summary>
- /// Get this element's index only among other elements (e.g. excluding text & other non-element node types)
+ /// Get this element's index only among other elements (e.g. excluding text &amp; other non-
+ /// element node types)
/// </summary>
- /// <returntype>int</returntype>
+
int ElementIndex { get; }
View
2  source/CsQuery/Dom/IDomInnerText.cs
@@ -6,7 +6,7 @@
namespace CsQuery
{
/// <summary>
- /// Special element for the text contents of SCRIPT & TEXTAREA objects
+ /// Special element for the text contents of SCRIPT &amp; TEXTAREA objects.
/// </summary>
public interface IDomInnerText : IDomText
View
2  source/CsQuery/Dom/IDomNode.cs
@@ -40,7 +40,7 @@ public interface IDomNode : ICloneable
/// use the ChildrenAllowed property.
/// </summary>
///
- /// <seealso cref="ChildrenAllowed"/>
+ /// <seealso cref="CsQuery.IDomObject.ChildrenAllowed"/>
bool HasChildren { get; }
View
36 source/CsQuery/Dom/Implementation/CSSStyleDeclaration.cs
@@ -186,19 +186,28 @@ public string Width
/// Sets all the styles from a single CSS style string. Any existing styles will be erased.
/// Styles will be validated and an error thrown if an invalid style is attempted.
/// </summary>
- /// <param name="styles">A legal HTML style string</param>
- /// <param name="strict">When true, the styles will be validated and an error thrown if any are not valid</param>
+ ///
+ /// <param name="styles">
+ /// A legal HTML style string.
+ /// </param>
+
public void SetStyles(string styles)
{
SetStyles(styles, true);
}
/// <summary>
- /// Sets all the styles from a single CSS style string. Any existing styles will be erased.
- /// This method is used by DomElementFactory (not in strict mode).
+ /// Sets all the styles from a single CSS style string. Any existing styles will be erased. This
+ /// method is used by DomElementFactory (not in strict mode).
/// </summary>
- /// <param name="styles">A legal HTML style string</param>
- /// <param name="strict">When true, the styles will be validated and an error thrown if any are not valid</param>
+ ///
+ /// <param name="styles">
+ /// A legal HTML style string.
+ /// </param>
+ /// <param name="strict">
+ /// When true, the styles will be validated and an error thrown if any are not valid.
+ /// </param>
+
public void SetStyles(string styles, bool strict)
{
_Styles = null;
@@ -212,12 +221,19 @@ public void SetStyles(string styles, bool strict)
AddStyles(styles, strict);
}
}
+
/// <summary>
- /// Add one or more styles to this element. Unlike SetStyle, existing styles are not affected, except
- /// for existing styles of the same name.
+ /// Add one or more styles to this element. Unlike SetStyle, existing styles are not affected,
+ /// except for existing styles of the same name.
/// </summary>
- /// <param name="styles"></param>
- /// <param name="strict"></param>
+ ///
+ /// <param name="styles">
+ /// The CSS style string
+ /// </param>
+ /// <param name="strict">
+ /// When true, the styles will be validated as CSS3 before adding.
+ /// </param>
+
public void AddStyles(string styles, bool strict)
{
foreach (string style in styles.SplitClean(';'))
View
11 source/CsQuery/Dom/Implementation/DomElement.cs
@@ -1904,17 +1904,6 @@ int IAttributeCollection.Length
/// <summary>
/// Gets the enumerator.
/// </summary>
- ///
- /// <typeparam name="string">
- /// Type of the string.
- /// </typeparam>
- /// <typeparam name="string">
- /// Type of the string.
- /// </typeparam>
- ///
- /// <returns>
- /// The enumerator.
- /// </returns>
IEnumerator<KeyValuePair<string, string>> IEnumerable<KeyValuePair<string, string>>.GetEnumerator()
{
View
34 source/CsQuery/Dom/Implementation/NodeList.cs
@@ -47,10 +47,15 @@ public int IndexOf(IDomObject item)
{
return _InnerList == null ? -1 : InnerList.IndexOf(item);
}
+
/// <summary>
- /// Add a child to this element
+ /// Add a child to this element.
/// </summary>
- /// <param name="element"></param>
+ ///
+ /// <param name="item">
+ /// The element to add
+ /// </param>
+
public void Add(IDomObject item)
{
@@ -83,11 +88,18 @@ public void AddAlways(IDomObject item)
InnerList.Add(item);
AddParent(item, InnerList.Count - 1);
}
+
/// <summary>
- /// Adds a child element at a specific index
+ /// Adds a child element at a specific index.
/// </summary>
- /// <param name="index"></param>
- /// <param name="element"></param>
+ ///
+ /// <param name="index">
+ /// The index at which to insert the element
+ /// </param>
+ /// <param name="item">
+ /// The element to insert
+ /// </param>
+
public void Insert(int index, IDomObject item)
{
//RemoveParent(item);
@@ -120,9 +132,17 @@ public void RemoveAt(int index)
}
/// <summary>
- /// Remove an element from this element's children
+ /// Remove an element from this element's children.
/// </summary>
- /// <param name="element"></param>
+ ///
+ /// <param name="item">
+ /// The item to remove.
+ /// </param>
+ ///
+ /// <returns>
+ /// true if it succeeds, false if the item was not found in the children.
+ /// </returns>
+
public bool Remove(IDomObject item)
{
if (item.ParentNode != this.Owner)
View
4 source/CsQuery/HtmlParser/HtmlData.cs
@@ -184,9 +184,9 @@ static HtmlData()
}
maxPathIndex = (int)Math.Pow(encodingLength, pathIdLength) - 1;
- MustBeQuotedAll = new char[CharacterData.charsHtmlSpace.Length + MustBeQuoted.Length];
+ MustBeQuotedAll = new char[CharacterData.charsHtmlSpaceArray.Length + MustBeQuoted.Length];
MustBeQuoted.CopyTo(MustBeQuotedAll, 0);
- CharacterData.charsHtmlSpace.ToCharArray().CopyTo(MustBeQuotedAll, MustBeQuoted.Length);
+ CharacterData.charsHtmlSpaceArray.CopyTo(MustBeQuotedAll, MustBeQuoted.Length);
// these elements can never have html children.
View
19 source/CsQuery/HtmlParser/IterationData.cs
@@ -94,13 +94,22 @@ public bool FindNextTag(char[] html)
}
}
-
/// <summary>
- /// Returns a literal object for the text between HtmlStart (the last position of the end of a tag) and the current position.
- /// If !AllowLiterals then it's wrapped in a span.
+ /// Returns a literal object for the text between HtmlStart (the last position of the end of a
+ /// tag) and the current position. If !AllowLiterals then it's wrapped in a span.
/// </summary>
- /// <param name="current"></param>
- /// <returns></returns>
+ ///
+ /// <param name="factory">
+ /// The HTML factory to operate against
+ /// </param>
+ /// <param name="literal">
+ /// [out] The literal.
+ /// </param>
+ ///
+ /// <returns>
+ /// true if it succeeds, false if it fails.
+ /// </returns>
+
public bool TryGetLiteral(HtmlElementFactory factory, out IDomObject literal)
{
View
361 source/CsQuery/StringScanner/CharacterData.cs
@@ -9,49 +9,27 @@
namespace CsQuery.StringScanner
{
/// <summary>
- /// A static class to provide attribute information about characters, e.g. determining whether or not it
- /// belongs to a number of predefined classes. This creates an array of every possible character with a
- /// uint that is a bitmap (of up to 32 possible values)
- /// This permits very fast access to this information since it only needs to be looked up
- /// via an index. Uses an array of 65536 uints = 256K of memory
- ///
+ /// A static class to provide attribute information about characters, e.g. determining whether or
+ /// not it belongs to a number of predefined classes. This creates an array of every possible
+ /// character with a uint that is a bitmap (of up to 32 possible values)
+ /// This permits very fast access to this information since it only needs to be looked up via an
+ /// index. Uses an array of 65536 uints = 256K of memory.
/// </summary>
+
public static class CharacterData
{
- // HTML spec for a space: http://www.w3.org/TR/html-markup/terminology.html#space
- //
- // U+0020 SPACE
- // U+0009 CHARACTER TABULATION (tab)
- // U+000A LINE FEED (LF)
- // U+000C FORM FEED (FF)
- // U+000D CARRIAGE RETURN (CR).
+ #region constructor
- public const string charsHtmlSpace = "\x0020\x0009\x000A\x000C\x000D";
- public static char[] charsHtmlSpaceArray = {
- '\x0020','\x0009','\x000A','\x000C','\x000D'
- };
-
- // Add a couple more for non-HTML spec whitespace
- public const string charsWhitespace = charsHtmlSpace + "\x00A0\x00C0";
-
- public const string charsNumeric = "0123456789";
- public const string charsNumericExtended = "0123456789.-+";
- public const string charsLower = "abcdefghijklmnopqrstuvwxyz";
- public const string charsUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- public const string charsAlpha = charsLower + charsUpper;
- public const string charsQuote = "\"'";
- public const string charsOperator = "!+-*/%<>^=~";
- public const string charsEnclosing = "()[]{}<>`´“”«»";
- public const string charsEscape = "\\";
- public const string charsSeparators = ", |";
-
-
- private static uint[] characterFlags;
/// <summary>
- /// Configuration of the xref of character info
+ /// Configuration of the xref of character info. This sets bitflags in the "characterFlags" array
+ /// for every unicode value that defines its attributes. This creates a lookup table allowing
+ /// very rapid access to metadata about a single character, useful during string-parsing and
+ /// scanning.
/// </summary>
+
static CharacterData()
{
+ charsHtmlSpaceArray = charsHtmlSpace.ToArray<char>();
characterFlags = new uint[65536];
setBit(charsWhitespace, (uint)CharacterType.Whitespace);
@@ -85,6 +63,232 @@ static CharacterData()
SetAlphaISO10646((uint)CharacterType.AlphaISO10646);
}
+
+ #endregion
+
+ #region private properties/constants
+
+ // HTML spec for a space: http://www.w3.org/TR/html-markup/terminology.html#space
+ //
+ // U+0020 SPACE
+ // U+0009 CHARACTER TABULATION (tab)
+ // U+000A LINE FEED (LF)
+ // U+000C FORM FEED (FF)
+ // U+000D CARRIAGE RETURN (CR).
+
+ const string charsHtmlSpace = "\x0020\x0009\x000A\x000C\x000D";
+
+ // Add a couple more for non-HTML spec whitespace
+ const string charsWhitespace = charsHtmlSpace + "\x00A0\x00C0";
+
+ const string charsNumeric = "0123456789";
+ const string charsNumericExtended = "0123456789.-+";
+ const string charsLower = "abcdefghijklmnopqrstuvwxyz";
+ const string charsUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ const string charsAlpha = charsLower + charsUpper;
+ const string charsQuote = "\"'";
+ const string charsOperator = "!+-*/%<>^=~";
+ const string charsEnclosing = "()[]{}<>`´“”«»";
+ const string charsEscape = "\\";
+ const string charsSeparators = ", |";
+
+
+ private static uint[] characterFlags;
+
+ #endregion
+
+
+
+ #region public properties/methods
+
+ /// <summary>
+ /// An array of all HTML "space" characters.
+ /// </summary>
+
+ public static readonly char[] charsHtmlSpaceArray;
+
+ /// <summary>
+ /// Creates a new instance of the CharacterInfo class
+ /// </summary>
+ ///
+ /// <returns>
+ /// The new character information.
+ /// </returns>
+
+ public static ICharacterInfo CreateCharacterInfo()
+ {
+ return new CharacterInfo();
+ }
+
+ /// <summary>
+ /// Creates a new instance of the CharacterInfo class.
+ /// </summary>
+ ///
+ /// <param name="character">
+ /// The character to bind to the new instance.
+ /// </param>
+ ///
+ /// <returns>
+ /// A new CharacterInfo instance.
+ /// </returns>
+
+ public static ICharacterInfo CreateCharacterInfo(char character)
+ {
+ return new CharacterInfo(character);
+ }
+
+ /// <summary>
+ /// Creates a new StringInfo instance
+ /// </summary>
+ ///
+ /// <returns>
+ /// The new StringInfo instance
+ /// </returns>
+
+ public static IStringInfo CreateStringInfo()
+ {
+ return new StringInfo();
+ }
+
+ /// <summary>
+ /// Creates a new StringInfo instance bound to a string
+ /// </summary>
+ ///
+ /// <param name="text">
+ /// The string to bind.
+ /// </param>
+ ///
+ /// <returns>
+ /// The new StringInfo instance.
+ /// </returns>
+
+ public static IStringInfo CreateStringInfo(string text)
+ {
+ return new StringInfo(text);
+ }
+
+ /// <summary>
+ /// Test whether a character matches a set of flags defined by the paramter
+ /// </summary>
+ ///
+ /// <param name="character">
+ /// The character to test
+ /// </param>
+ /// <param name="type">
+ /// The type to which to compare the character
+ /// </param>
+ ///
+ /// <returns>
+ /// true if the character matches the flags in the test type, false if not
+ /// </returns>
+
+ public static bool IsType(char character, CharacterType type)
+ {
+ return (characterFlags[character] & (uint)type) > 0;
+ }
+
+ /// <summary>
+ /// Gets a type with all flags set for the types implemented by this character
+ /// </summary>
+ ///
+ /// <param name="character">
+ /// The character to test
+ /// </param>
+ ///
+ /// <returns>
+ /// The type.
+ /// </returns>
+
+ public static CharacterType GetType(char character)
+ {
+ return (CharacterType)characterFlags[character];
+ }
+
+ /// <summary>
+ /// Return the closing character for a set of known opening enclosing characters (including
+ /// single and double quotes)
+ /// </summary>
+ ///
+ /// <exception cref="InvalidOperationException">
+ /// Thrown when the character is not a known opening bound
+ /// </exception>
+ ///
+ /// <param name="character">
+ /// The opening bound character
+ /// </param>
+ ///
+ /// <returns>
+ /// The closing bound character
+ /// </returns>
+
+ public static char Closer(char character)
+ {
+ char result = CloserImpl(character);
+ if (result == (char)0)
+ {
+ throw new InvalidOperationException("The character '" + character + "' is not a known opening bound.");
+ }
+ return result;
+ }
+
+ /// <summary>
+ /// Return the matching bound for known opening and closing bound characters (same as Closer, but
+ /// accepts closing tags and returns openers)
+ /// </summary>
+ ///
+ /// <exception cref="InvalidOperationException">
+ /// Thrown when the requested operation is invalid.
+ /// </exception>
+ ///
+ /// <param name="character">
+ /// The opening bound character
+ /// </param>
+ ///
+ /// <returns>
+ /// The matching close character
+ /// </returns>
+
+ public static char MatchingBound(char character)
+ {
+
+ switch (character)
+ {
+ case ']':
+ return '[';
+ case ')':
+ return '(';
+ case '}':
+ return '{';
+ case '>':
+ return '<';
+ case '´':
+ return '`';
+ case '':
+ return '';
+ case '»':
+ return '«';
+ default:
+ char result = CloserImpl(character);
+ if (result == (char)0)
+ {
+ throw new InvalidOperationException("The character '" + character + "' is not a bound.");
+ };
+ return result;
+ }
+ }
+
+ #endregion
+
+ #region private methods
+
+ /// <summary>
+ /// Sets the bits for ISO 10646.
+ /// </summary>
+ ///
+ /// <param name="hsb">
+ /// the target
+ /// </param>
+
private static void SetAlphaISO10646(uint hsb)
{
@@ -116,7 +320,7 @@ private static void SetHtmlTagSelectorStart(uint hsb)
setBit(charsAlpha, hsb);
setBit("_", hsb);
- SetRange(hsb,0xC0,0xD6);
+ SetRange(hsb, 0xC0, 0xD6);
SetRange(hsb, 0xD8, 0xF6);
SetRange(hsb, 0xF8, 0x2FF);
SetRange(hsb, 0x370, 0x37D);
@@ -139,7 +343,7 @@ private static void SetHtmlTagSelectorExceptStart(uint hsb)
SetHtmlTagSelectorStart(hsb);
setBit(charsNumeric, hsb);
setBit("-", hsb);
- setBit((char)0xB7,hsb);
+ setBit((char)0xB7, hsb);
SetRange(hsb, 0x0300, 0x036F);
SetRange(hsb, 0x203F, 0x2040);
}
@@ -147,7 +351,8 @@ private static void SetHtmlTagSelectorExceptStart(uint hsb)
/// Add the : back in when actually parsing html
/// </summary>
/// <param name="hsb"></param>
- private static void SetHtmlTagNameStart(uint hsb) {
+ private static void SetHtmlTagNameStart(uint hsb)
+ {
SetHtmlTagSelectorStart(hsb);
setBit(":", hsb);
}
@@ -171,7 +376,8 @@ private static void SetRange(uint flag, ushort start, ushort end)
}
private static void setBit(string forCharacters, uint bit)
{
- for (int i=0;i<forCharacters.Length;i++) {
+ for (int i = 0; i < forCharacters.Length; i++)
+ {
setBit(forCharacters[i], bit);
}
}
@@ -180,46 +386,8 @@ private static void setBit(char character, uint bit)
characterFlags[(ushort)character] |= bit;
}
- public static ICharacterInfo CreateCharacterInfo()
- {
- return new CharacterInfo();
- }
- public static ICharacterInfo CreateCharacterInfo(char character)
- {
- return new CharacterInfo(character);
- }
- public static IStringInfo CreateStringInfo()
- {
- return new StringInfo();
- }
- public static IStringInfo CreateStringInfo(string text)
- {
- return new StringInfo(text);
- }
- public static bool IsType(char character, CharacterType type)
- {
- return (characterFlags[character] & (uint)type) > 0;
- }
- public static CharacterType GetType(char character)
- {
- return (CharacterType)characterFlags[character];
- }
- /// <summary>
- /// Return the closing character for a set of known opening enclosing characters
- /// (including single and double quotes)
- /// </summary>
- /// <param name="character"></param>
- /// <returns></returns>
- public static char Closer(char character)
+ private static char CloserImpl(char character)
{
- char result = CloserImpl(character);
- if (result == (char)0)
- {
- throw new InvalidOperationException("The character '" + character + "' is not a known opening bound.");
- }
- return result;
- }
- private static char CloserImpl(char character) {
switch (character)
{
case '"':
@@ -243,42 +411,9 @@ public static char Closer(char character)
case '»':
return '«';
default:
- return (char)0;
- }
- }
- /// <summary>
- /// Return the matching bound for known opening and closing bound characters (same as Closer,
- /// but accepts closing tags and returns openers)
- /// </summary>
- /// <param name="character"></param>
- /// <returns></returns>
- public static char MatchingBound(char character)
- {
-
- switch (character)
- {
- case ']':
- return '[';
- case ')':
- return '(';
- case '}':
- return '{';
- case '>':
- return '<';
- case '´':
- return '`';
- case '':
- return '';
- case '»':
- return '«';
- default:
- char result = CloserImpl(character);
- if (result == (char)0)
- {
- throw new InvalidOperationException("The character '" + character + "' is not a bound.");
- };
- return result;
+ return (char)0;
}
}
+ #endregion
}
}
View
84 source/CsQuery/StringScanner/Implementation/CharacterInfo.cs
@@ -33,14 +33,41 @@ public CharacterInfo(char character)
{
Target = character;
}
+
+ /// <summary>
+ /// CharacterInfo casting operator: creates a new instance from a single character
+ /// </summary>
+ ///
+ /// <param name="character">
+ /// The character to bind to the new CharacterInfo class
+ /// </param>
+
public static implicit operator CharacterInfo(char character) {
return new CharacterInfo(character);
}
+
+ /// <summary>
+ /// Creates a new CharacterInfo instance from a character
+ /// </summary>
+ ///
+ /// <param name="character">
+ /// The character to bind to this instance.
+ /// </param>
+ ///
+ /// <returns>
+ /// A new CharacterInfo object
+ /// </returns>
+
public static ICharacterInfo Create(char character)
{
return new CharacterInfo(character);
}
-
+
+ /// <summary>
+ /// Gets or sets bound character for this instance. This is the character against which all tests
+ /// are performed.
+ /// </summary>
+
public char Target { get; set; }
IConvertible IValueInfo.Target
@@ -54,9 +81,11 @@ IConvertible IValueInfo.Target
Target = (char)value;
}
}
+
/// <summary>
- /// Flags indicating the use of this character
+ /// Flags indicating the use of this character.
/// </summary>
+
public CharacterType Type
{
get
@@ -64,6 +93,11 @@ public CharacterType Type
return CharacterData.GetType(Target);
}
}
+
+ /// <summary>
+ /// Gets a value indicating whether the character is alphabetic, e.g. a-z, A-Z
+ /// </summary>
+
public bool Alpha
{
get
@@ -71,6 +105,11 @@ public bool Alpha
return CharacterData.IsType(Target,CharacterType.Alpha);
}
}
+
+ /// <summary>
+ /// Gets a value indicating whether the bound character is numeric only, e.g. 0-9
+ /// </summary>
+
public bool Numeric
{
get
@@ -78,9 +117,12 @@ public bool Numeric
return CharacterData.IsType(Target,CharacterType.Number);
}
}
+
/// <summary>
- /// Returns true if numeric, dot or -
+ /// Test whether the character is numeric or part of a complete number, e.g. also includes '+', '-
+ /// ' and '.'.
/// </summary>
+
public bool NumericExtended
{
get
@@ -88,6 +130,11 @@ public bool NumericExtended
return CharacterData.IsType(Target, CharacterType.NumberPart);
}
}
+
+ /// <summary>
+ /// Test whether the character is lower-case
+ /// </summary>
+
public bool Lower
{
get
@@ -95,6 +142,11 @@ public bool Lower
return CharacterData.IsType(Target, CharacterType.Lower);
}
}
+
+ /// <summary>
+ /// Test whether the character is upper-case
+ /// </summary>
+
public bool Upper
{
get
@@ -102,6 +154,13 @@ public bool Upper
return CharacterData.IsType(Target, CharacterType.Upper);
}
}
+
+ /// <summary>
+ /// Test whether the character is whitespace. This is really HTML5 "space" and not ANSI
+ /// whitespace which. HTML5 space is much more restrictive; this is generally used to test
+ /// whether a character delimits an entity during HTML/CSS/HTML-related parsing.
+ /// </summary>
+
public bool Whitespace
{
get
@@ -134,9 +193,12 @@ public bool Bound
return CharacterData.IsType(Target, CharacterType.Enclosing | CharacterType.Quote);
}
}
+
/// <summary>
- /// ()[]{}<>`´“”«»
+ /// Tests whether the character is an enclosing/bounding type, one of:
+ /// ()[]{}&lt;&gt;`´“”«».
/// </summary>
+
public bool Enclosing
{
get
@@ -145,6 +207,10 @@ public bool Enclosing
}
}
+ /// <summary>
+ /// Tests whether the bound character is a single- or double-quote
+ /// </summary>
+
public bool Quote
{
get
@@ -152,6 +218,11 @@ public bool Quote
return CharacterData.IsType(Target, CharacterType.Quote);
}
}
+
+ /// <summary>
+ /// Tests whether the bound character is an opening or closing parenthesis.
+ /// </summary>
+
public bool Parenthesis
{
get
@@ -159,6 +230,11 @@ public bool Parenthesis
return Target == '(' || Target == ')';
}
}
+
+ /// <summary>
+ /// Tests
+ /// </summary>
+
public bool Separator
{
get
View
242 source/CsQuery/Utility/Objects.cs
@@ -49,22 +49,37 @@ public static bool IsNullableType(Type type)
}
/// <summary>
- /// Returns true if the string appears to be JSON.
+ /// Returns true if the object is a string, and appears to be JSON, e.g. it starts with a single
+ /// curly brace.
/// </summary>
- /// <param name="text"></param>
- /// <returns></returns>
+ ///
+ /// <param name="obj">
+ /// The object to test.
+ /// </param>
+ ///
+ /// <returns>
+ /// true if json, false if not.
+ /// </returns>
+
public static bool IsJson(object obj)
{
string text = obj as string;
return text != null && text.StartsWith("{") && !text.StartsWith("{{");
}
-
/// <summary>
- /// Only value types, strings, and null
+ /// Tests whether an object is a common immutable, specifically, value types, strings, and null.
+ /// KeyValuePairs are specifically excluded. (Why?)
/// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
+ ///
+ /// <param name="obj">
+ /// .
+ /// </param>
+ ///
+ /// <returns>
+ /// true if immutable, false if not.
+ /// </returns>
+
public static bool IsImmutable(object obj)
{
return obj == null ||
@@ -72,11 +87,19 @@ public static bool IsImmutable(object obj)
obj is string ||
(obj is ValueType && !(Objects.IsKeyValuePair(obj)));
}
+
/// <summary>
/// Returns false if this is a value type, null string, or enumerable (but not Extendable)
/// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
+ ///
+ /// <param name="obj">
+ /// .
+ /// </param>
+ ///
+ /// <returns>
+ /// true if extendable type, false if not.
+ /// </returns>
+
public static bool IsExtendableType(object obj)
{
// Want to allow enumerable types since we can treat them as objects. Exclude arrays.
@@ -112,59 +135,125 @@ public static bool IsTruthy(object obj)
return true;
}
+
/// <summary>
- /// Returns true if the object is a primitive numeric type, e.g. exluding string &amp; char
+ /// Returns true if the object is a primitive numeric type, that is, any primtive except string
+ /// &amp; char.
/// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
+ ///
+ /// <param name="type">
+ /// The type to test.
+ /// </param>
+ ///
+ /// <returns>
+ /// true if numeric type, false if not.
+ /// </returns>
+
public static bool IsNumericType(Type type)
{
Type t = GetUnderlyingType(type);
return t.IsPrimitive && !(t == typeof(string) || t == typeof(char) || t==typeof(bool));
}
+
/// <summary>
- /// Returns true if the value is a JS native type (string, number, bool, datetime)
+ /// Returns true if the value is a Javascript native type (string, number, bool, datetime)
/// </summary>
- /// <param name="t"></param>
- /// <returns></returns>
+ ///
+ /// <param name="type">
+ /// The type to test
+ /// </param>
+ ///
+ /// <returns>
+ /// true if a Javascript native type, false if not.
+ /// </returns>
+
public static bool IsNativeType(Type type)
{
Type t = GetUnderlyingType(type);
return t.IsEnum || t.IsValueType || t.IsPrimitive || t == typeof(string);
}
- public static string Join(Array list)
+
+ /// <summary>
+ /// Combine elements of an array into a single string, separated by a comma.
+ /// </summary>
+ ///
+ /// <param name="array">
+ /// The array to join.
+ /// </param>
+ ///
+ /// <returns>
+ /// A string separated by a comma.
+ /// </returns>
+
+ public static string Join(Array array)
{
- return Join(toStringList(list), ",");
+ return Join(toStringList(array), ",");
}
+
+ /// <summary>
+ /// Combine elements of a sequenceinto a single string, separated by a comma.
+ /// </summary>
+ ///
+ /// <param name="list">
+ /// A list of objects.
+ /// </param>
+ ///
+ /// <returns>
+ /// A string containging the string representation of each object in the sequence separated by a
+ /// comma.
+ /// </returns>
+
public static string Join(IEnumerable list)
{
return Join(toStringList(list), ",");
}
+
/// <summary>
- /// Test if an object is "Expando-like", e.g. a an IDictionary-string,object-
+ /// Test if an object is "Expando-like", e.g. is an IDictionary&lt;string,object&gt;.
/// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
+ ///
+ /// <param name="obj">
+ /// The object to test.
+ /// </param>
+ ///
+ /// <returns>
+ /// true if expando, false if not.
+ /// </returns>
+
public static bool IsExpando(object obj)
{
return (obj is IDictionary<string, object>);
}
/// <summary>
- /// Test if an object is a an IDictionary-string,object- that is empty
+ /// Test if an object is a an IDictionary&lt;string,object&gt; that is empty.
/// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
+ ///
+ /// <param name="obj">
+ /// The object to test
+ /// </param>
+ ///
+ /// <returns>
+ /// true if empty expando, false if not.
+ /// </returns>
+
public static bool IsEmptyExpando(object obj)
{
return IsExpando(obj) && ((IDictionary<string, object>)obj).Count == 0;
}
/// <summary>
- /// Test if an object is a KeyValuePair<,> (e.g. of any types)
+ /// Test if an object is a KeyValuePair&lt;,&gt; (e.g. of any types)
/// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
+ ///
+ /// <param name="obj">
+ /// The object to test
+ /// </param>
+ ///
+ /// <returns>
+ /// true if key value pair, false if not.
+ /// </returns>
+
public static bool IsKeyValuePair(object obj)
{
Type valueType = obj.GetType();
@@ -238,12 +327,26 @@ public static IConvertible Coerce(object value)
}
+
/// <summary>
- /// Convert an object of any value type to the specified type using any known means
+ /// Convert an object of any value type to the specified type using any known means.
/// </summary>
- /// <param name="value"></param>
- /// <param name="type"></param>
- /// <returns></returns>
+ ///
+ /// <exception cref="InvalidCastException">
+ /// Thrown when an object cannot be cast to a required type.
+ /// </exception>
+ ///
+ /// <typeparam name="T">
+ /// Generic type parameter.
+ /// </typeparam>
+ /// <param name="value">
+ /// The object to convert
+ /// </param>
+ ///
+ /// <returns>
+ /// An object of the target type
+ /// </returns>
+
public static T Convert<T>(object value)
{
T output;
@@ -650,20 +753,40 @@ public static IEnumerable<T> EmptyEnumerable<T>()
}
/// <summary>
- /// Convert (recursively) an IDictionary<string,object> to expando objects
+ /// Convert (recursively) an IDictionary&lt;string,object&gt; to a dynamic object.
/// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
+ ///
+ /// <typeparam name="T">
+ /// Generic type parameter.
+ /// </typeparam>
+ /// <param name="obj">
+ /// The source dicationary
+ /// </param>
+ ///
+ /// <returns>
+ /// A new dynamic object
+ /// </returns>
+
public static T Dict2Dynamic<T>(IDictionary<string, object> obj) where T : IDynamicMetaObjectProvider, new()
{
return Dict2Dynamic<T>(obj, false);
}
/// <summary>
- /// Combine elements of a list into a single string, separated by separator
+ /// Combine elements of a sequence into a single string, separated by separator.
/// </summary>
- /// <param name="list"></param>
- /// <returns></returns>
+ ///
+ /// <param name="list">
+ /// The source sequence.
+ /// </param>
+ /// <param name="separator">
+ /// The separator.
+ /// </param>
+ ///
+ /// <returns>
+ /// A string.
+ /// </returns>
+
public static string Join(IEnumerable<string> list, string separator)
{
StringBuilder sb = new StringBuilder();
@@ -809,12 +932,25 @@ public static Type GetUnderlyingType(Type type)
// TODO - the implementation needs to go to another class
/// <summary>
- /// Convert any IDictionary<string,object> into an expandoobject recursively
+ /// Convert any IDictionary&lt;string,object&gt; into an expandoobject recursively.
/// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="obj"></param>
- /// <param name="convertDates"></param>
- /// <returns></returns>
+ ///
+ /// <typeparam name="T">
+ /// The type of target to create. It must implementing IDynamicMetaObjectProvider; if it is
+ /// actually the interface IDynamicMetaObjectProvider, then the default dynamic object type will
+ /// be created.
+ /// </typeparam>
+ /// <param name="obj">
+ /// The source dictionary
+ /// </param>
+ /// <param name="convertDates">
+ /// .
+ /// </param>
+ ///
+ /// <returns>
+ /// .
+ /// </returns>
+
public static T Dict2Dynamic<T>(IDictionary<string, object> obj, bool convertDates) where T : IDynamicMetaObjectProvider, new()
{
T returnObj = new T();
@@ -830,14 +966,24 @@ public static T Dict2Dynamic<T>(IDictionary<string, object> obj, bool convertDat
}
/// <summary>
- /// Map properties of inputObjects to target. If target is an expando object, it will be updated. If not,
- /// a new one will be created including the properties of target and inputObjects.
+ /// Map properties of inputObjects to target. If target is an expando object, it will be updated.
+ /// If not, a new one will be created including the properties of target and inputObjects.
/// </summary>
- /// <param name="parents"></param>
- /// <param name="deep"></param>
- /// <param name="target"></param>
- /// <param name="inputObjects"></param>
- /// <returns></returns>
+ ///
+ /// <param name="deep">
+ /// When true, will clone properties that are objects.
+ /// </param>
+ /// <param name="target">
+ /// The target of the mapping, or null to create a new target
+ /// </param>
+ /// <param name="inputObjects">
+ /// One or more objects that are the source of the mapping
+ /// </param>
+ ///
+ /// <returns>
+ /// The target object itself, if non-null, or a new dynamic object, if the target is null
+ /// </returns>
+
public static object Extend( bool deep, object target, params object[] inputObjects)
{
return ExtendImpl(null, deep, target, inputObjects);
Please sign in to comment.
Something went wrong with that request. Please try again.