]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Include/Library/SortLib.h
Update the copyright notice format
[mirror_edk2.git] / ShellPkg / Include / Library / SortLib.h
CommitLineData
4983ca93 1/** @file\r
125c2cf4 2 Library used for sorting and comparison routines.\r
4983ca93 3\r
3a888f2a 4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
1e6e84c7 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
4983ca93 9\r
1e6e84c7 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
4983ca93 12\r
13**/\r
14\r
15#if !defined(__SORT_LIB_H__)\r
16#define __SORT_LIB_H__\r
17\r
18/**\r
19 Prototype for comparison function for any 2 element types.\r
20\r
a31bd33c 21 @param[in] Buffer1 Pointer to first buffer.\r
22 @param[in] Buffer2 Pointer to second buffer.\r
4983ca93 23\r
a31bd33c 24 @retval 0 Buffer1 equal to Buffer2.\r
25 @return < 0 Buffer1 is less than Buffer2.\r
26 @return > 0 Buffer1 is greater than Buffer2.\r
4983ca93 27**/\r
28typedef\r
29INTN\r
30(EFIAPI *SORT_COMPARE)(\r
b3011f40 31 IN CONST VOID *Buffer1,\r
32 IN CONST VOID *Buffer2\r
4983ca93 33 );\r
34\r
35/**\r
36 Function to perform a Quick Sort on a buffer of comparable elements.\r
37\r
38 Each element must be equally sized.\r
39\r
a31bd33c 40 If BufferToSort is NULL, then ASSERT.\r
41 If CompareFunction is NULL, then ASSERT.\r
4983ca93 42\r
a31bd33c 43 If Count is < 2 then perform no action.\r
44 If Size is < 1 then perform no action.\r
4983ca93 45\r
a31bd33c 46 @param[in,out] BufferToSort On call a Buffer of (possibly sorted) elements\r
47 on return a buffer of sorted elements.\r
48 @param[in] Count The number of elements in the buffer to sort\r
49 @param[in] ElementSize Size of an element in bytes.\r
1e6e84c7 50 @param[in] CompareFunction The function to call to perform the comparison\r
a31bd33c 51 of any 2 elements.\r
4983ca93 52**/\r
53VOID\r
54EFIAPI\r
55PerformQuickSort (\r
b3011f40 56 IN OUT VOID *BufferToSort,\r
57 IN CONST UINTN Count,\r
58 IN CONST UINTN ElementSize,\r
59 IN SORT_COMPARE CompareFunction\r
4983ca93 60 );\r
61\r
125c2cf4 62\r
63/**\r
64 Function to compare 2 device paths for use as CompareFunction.\r
65\r
11d2decf 66 @param[in] Buffer1 Pointer to Device Path to compare.\r
67 @param[in] Buffer2 Pointer to second DevicePath to compare.\r
125c2cf4 68\r
11d2decf 69 @retval 0 Buffer1 equal to Buffer2.\r
70 @return < 0 Buffer1 is less than Buffer2.\r
1e6e84c7 71 @return > 0 Buffer1 is greater than Buffer2.\r
125c2cf4 72**/\r
73INTN\r
11d2decf 74EFIAPI\r
125c2cf4 75DevicePathCompare (\r
b3011f40 76 IN CONST VOID *Buffer1,\r
77 IN CONST VOID *Buffer2\r
125c2cf4 78 );\r
11d2decf 79\r
80/**\r
81 Function to compare 2 strings without regard to case of the characters.\r
82\r
1e6e84c7 83 @param[in] Buffer1 Pointer to String to compare (CHAR16**).\r
11d2decf 84 @param[in] Buffer2 Pointer to second String to compare (CHAR16**).\r
85\r
86 @retval 0 Buffer1 equal to Buffer2.\r
87 @return < 0 Buffer1 is less than Buffer2.\r
1e6e84c7 88 @return > 0 Buffer1 is greater than Buffer2.\r
11d2decf 89**/\r
90INTN\r
91EFIAPI\r
92StringNoCaseCompare (\r
b3011f40 93 IN CONST VOID *Buffer1,\r
94 IN CONST VOID *Buffer2\r
11d2decf 95 );\r
96\r
4983ca93 97#endif //__SORT_LIB_H__\r