I have added some nsTArray-like APIs for those of you who want to be able to switch between nsTArray and nsCOMArray. The following *Element* APIs have been created based on the *Object* APIs, however the return value has been changed from bool to void where possible (only the *Object* APIs perform range checks, especially ReplaceObjectAt), and the parameters are passed in nsTArray order (index before element):

   * ElementAt
   * SafeElementAt
   * InsertElementAt
   * InsertElementsAt
   * RemoveElementAt
   * RemoveElementsAt
   * ReplaceElementAt
   * AppendElement
   * RemoveElement

The following nsTArray-like APIs have also been added:

   * Optional aStartIndex parameter added to IndexOf
   * Contains and ContainsObject convenience variations of IndexOf and
     IndexOfObject
   * Elements (note that this returns a T** so it's useful for passing
     as an XPCOM array)
   * SwapElements
   * Length (and its IsEmpty convenience method)
   * TruncateLength
   * Capacity

There is also a SwapElementsAt method, and a version of InsertElementsAt that takes a T** and a length rather than an nsCOMArray<T>.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to