X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1ac74d83a39abb3697745e0d494f28f4d27f3efd..dc484d491b15355285a89da275c58c2ef247d1f4:/docs/latex/wx/array.tex diff --git a/docs/latex/wx/array.tex b/docs/latex/wx/array.tex index 5ed809ade2..9910452a57 100644 --- a/docs/latex/wx/array.tex +++ b/docs/latex/wx/array.tex @@ -128,12 +128,16 @@ Things are much simpler for wxArray and wxSortedArray however: it is enough just to write \begin{verbatim} -WX_DEFINE_ARRAY(int, ArrayOfDirectories); -WX_DEFINE_SORTED_ARRAY(int, ArrayOfFiles); +WX_DEFINE_ARRAY_INT(int, ArrayOfInts); +WX_DEFINE_SORTED_ARRAY_INT(int, ArrayOfSortedInts); \end{verbatim} i.e. there is only one {\tt DEFINE} macro and no need for separate -{\tt DECLARE} one. +{\tt DECLARE} one. For the arrays of the primitive types, the macros +{\tt WX\_DEFINE\_ARRAY\_CHAR/SHORT/INT/SIZE\_T/LONG/DOUBLE} should be used +depending on the sizeof of the values (notice that storing values of smaller +type, e.g. shorts, in an array of larger one, e.g. {\tt ARRAY\_INT}, does +\emph{not} work on all architectures!). \wxheading{See also:} @@ -250,7 +254,8 @@ does exactly the same as \helpref{Item()}{wxarrayitem} method. \helpref{Add}{wxarrayadd}\\ \helpref{Insert}{wxarrayinsert}\\ \helpref{SetCount}{wxarraysetcount}\\ -\helpref{WX\_APPEND\_ARRAY}{wxappendarray} +\helpref{WX\_APPEND\_ARRAY}{wxappendarray}\\ +\helpref{WX\_PREPEND\_ARRAY}{wxprependarray} \membersection{Removing items}\label{arrayremoving} @@ -288,10 +293,10 @@ needed for exporting an array from a user DLL. Example: \begin{verbatim} -WX_DEFINE_ARRAY_INT(int, wxArrayInt); +WX_DEFINE_ARRAY_INT(int, MyArrayInt); class MyClass; -WX_DEFINE_ARRAY(MyClass *, wxArrayOfMyClass); +WX_DEFINE_ARRAY(MyClass *, ArrayOfMyClass); \end{verbatim} Note that wxWidgets predefines the following standard array classes: wxArrayInt, @@ -313,10 +318,10 @@ needed for exporting an array from a user DLL. Example: \begin{verbatim} -WX_DEFINE_SORTED_ARRAY_INT(wxSortedArrayInt); +WX_DEFINE_SORTED_ARRAY_INT(int, MySortedArrayInt); class MyClass; -WX_DEFINE_SORTED_ARRAY(MyClass *, wxArrayOfMyClass); +WX_DEFINE_SORTED_ARRAY(MyClass *, ArrayOfMyClass); \end{verbatim} You will have to initialize the objects of this class by passing a comparison @@ -405,6 +410,13 @@ WX_DEFINE_OBJARRAY(wxArrayOfMyClass); This macro may be used to append all elements of the {\it other} array to the {\it array}. The two arrays must be of the same type. +\membersection{WX\_PREPEND\_ARRAY}\label{wxprependarray} + +\func{void}{WX\_PREPEND\_ARRAY}{\param{wxArray\& }{array}, \param{wxArray\& }{other}} + +This macro may be used to prepend all elements of the {\it other} array to the +{\it array}. The two arrays must be of the same type. + \membersection{WX\_CLEAR\_ARRAY}\label{wxcleararray} \func{void}{WX\_CLEAR\_ARRAY}{\param{wxArray\& }{array}} @@ -493,7 +505,8 @@ append a lot of items. Preallocates memory for a given number of array elements. It is worth calling when the number of items which are going to be added to the array is known in advance because it will save unneeded memory reallocation. If the array already -has enough memory for the given number of items, nothing happens. +has enough memory for the given number of items, nothing happens. In any case, +the existing contents of the array is not modified. \membersection{wxArray::Clear}\label{wxarrayclear} @@ -534,9 +547,9 @@ Return the number of items in the array. \membersection{wxArray::Index}\label{wxarrayindex} -\func{int}{Index}{\param{T\& }{item}, \param{bool }{searchFromEnd = false}} +\constfunc{int}{Index}{\param{T\& }{item}, \param{bool }{searchFromEnd = false}} -\func{int}{Index}{\param{T\& }{item}} +\constfunc{int}{Index}{\param{T\& }{item}} The first version of the function is for wxArray and wxObjArray, the second is for wxSortedArray only. @@ -679,3 +692,4 @@ return a negative, zero or positive value according to whether the first element passed to it is less than, equal to or greater than the second one. wxSortedArray doesn't have this function because it is always sorted. +