Changeset 99770 in vbox
- Timestamp:
- May 12, 2023 9:27:23 AM (17 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
-
include/VBox/com/array.h (modified) (1 diff)
-
src/VBox/Main/testcase/Makefile.kmk (modified) (2 diffs)
-
src/VBox/Main/testcase/tstSafeArray.cpp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/array.h
r98103 r99770 816 816 817 817 /** 818 * Prepends a copy of the given element at the beginning of the array. 819 * 820 * The array size is increased by one by this method and the additional 821 * space is allocated as needed. 822 * 823 * This method is handy in cases where you want to assign a copy of the 824 * existing value to the array element, for example: 825 * <tt>Bstr string; array.push_front(string);</tt>. If you create a string 826 * just to put it in the array, you may find #appendedRaw() more useful. 827 * 828 * @param aElement Element to prepend. 829 * 830 * @return @c true on success and @c false if there is not enough 831 * memory for resizing. 832 */ 833 bool push_front(const T &aElement) 834 { 835 if (!ensureCapacity(size() + 1)) 836 return false; 837 838 for (size_t i = size(); i > 0; --i) 839 { 840 #ifdef VBOX_WITH_XPCOM 841 SafeArray::Copy(m.arr[i - 1], m.arr[i]); 842 #else 843 Copy(m.arr[i - 1], m.arr[i]); 844 #endif 845 } 846 847 #ifdef VBOX_WITH_XPCOM 848 SafeArray::Copy(aElement, m.arr[0]); 849 ++ m.size; 850 #else 851 Copy(aElement, m.arr[0]); 852 #endif 853 return true; 854 } 855 856 /** 818 857 * Appends a copy of the given element at the end of the array. 819 858 * -
trunk/src/VBox/Main/testcase/Makefile.kmk
r99744 r99770 47 47 $(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlPaths,) \ 48 48 tstMediumLock \ 49 tstSafeArray \ 49 50 tstBstr \ 50 51 tstGuid \ … … 285 286 tstMediumLock_TEMPLATE = VBoxMainClientTstExe 286 287 tstMediumLock_SOURCES = tstMediumLock.cpp 288 289 290 # 291 # tstSafeArray 292 # 293 tstSafeArray_TEMPLATE = VBoxMainClientTstExe 294 tstSafeArray_SOURCES = tstSafeArray.cpp 287 295 288 296
Note:
See TracChangeset
for help on using the changeset viewer.

