From 1833c6f88b69331f896af9280fd28063e81254ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dariusz=20Knoci=C5=84ski?= <dknoto@gmail.com>
Date: Thu, 6 Dec 2012 23:13:27 +0100
Subject: [PATCH 2/2] BStringList: implemented Sort() with custom sort
function.
---
headers/os/support/StringList.h | 3 ++-
src/kits/support/StringList.cpp | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/headers/os/support/StringList.h b/headers/os/support/StringList.h
index e58956b..13b06fc 100644
a
|
b
|
public:
|
36 | 36 | |
37 | 37 | // Reorder items |
38 | 38 | void Sort(bool ignoreCase = false); |
39 | | // TODO: Sort() with custom sort function. |
| 39 | void Sort(int (*compareFunc)(const void*, const void*)) |
| 40 | |
40 | 41 | bool Swap(int32 indexA, int32 indexB); |
41 | 42 | bool Move(int32 fromIndex, int32 toIndex); |
42 | 43 | |
diff --git a/src/kits/support/StringList.cpp b/src/kits/support/StringList.cpp
index 7b453d8..61904c4 100644
a
|
b
|
BStringList::Sort(bool ignoreCase)
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
| 205 | void |
| 206 | BStringList::Sort(int (*compareFunc)(const void*, const void*)) |
| 207 | { |
| 208 | if (compareFunc != NULL) |
| 209 | fStrings.SortItems(compareFunc); |
| 210 | } |
| 211 | |
| 212 | |
205 | 213 | bool |
206 | 214 | BStringList::Swap(int32 indexA, int32 indexB) |
207 | 215 | { |