summaryrefslogtreecommitdiff
path: root/tools.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-01-14 09:09:06 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2015-01-14 09:09:06 +0100
commit6ba9de491c7f0df65f0ed4c0e0e3fdebc57412be (patch)
tree25dc57cdda5dcceb07681ec268648ce91a34cf00 /tools.h
parent24b38eb81239059470a846dd1b48e487eb0ab518 (diff)
downloadvdr-6ba9de491c7f0df65f0ed4c0e0e3fdebc57412be.tar.gz
vdr-6ba9de491c7f0df65f0ed4c0e0e3fdebc57412be.tar.bz2
Added boolean return values to cVector's InsertUnique(), AppendUnique() and RemoveElement()
Diffstat (limited to 'tools.h')
-rw-r--r--tools.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/tools.h b/tools.h
index 0a9ecbd4..920a1d11 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 3.5 2015/01/12 12:13:33 kls Exp $
+ * $Id: tools.h 3.6 2015/01/14 09:09:06 kls Exp $
*/
#ifndef __TOOLS_H
@@ -557,10 +557,13 @@ public:
else
Append(Data);
}
- void InsertUnique(T Data, int Before = 0)
+ bool InsertUnique(T Data, int Before = 0)
{
- if (IndexOf(Data) < 0)
+ if (IndexOf(Data) < 0) {
Insert(Data, Before);
+ return true;
+ }
+ return false;
}
virtual void Append(T Data)
{
@@ -568,10 +571,13 @@ public:
Realloc(allocated * 3 / 2); // increase size by 50%
data[size++] = Data;
}
- void AppendUnique(T Data)
+ bool AppendUnique(T Data)
{
- if (IndexOf(Data) < 0)
+ if (IndexOf(Data) < 0) {
Append(Data);
+ return true;
+ }
+ return false;
}
virtual void Remove(int Index)
{
@@ -581,11 +587,14 @@ public:
memmove(&data[Index], &data[Index + 1], (size - Index) * sizeof(T));
size--;
}
- void RemoveElement(const T &Data)
+ bool RemoveElement(const T &Data)
{
int i = IndexOf(Data);
- if (i >= 0)
+ if (i >= 0) {
Remove(i);
+ return true;
+ }
+ return false;
}
virtual void Clear(void)
{