summaryrefslogtreecommitdiffstats
path: root/src/example.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/example.h')
-rw-r--r--src/example.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/example.h b/src/example.h
index 2af06ba..7929c24 100644
--- a/src/example.h
+++ b/src/example.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2021 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -18,8 +16,10 @@
#ifndef EXAMPLE_H
#define EXAMPLE_H
+#include <algorithm>
+#include <vector>
+
#include <qcstring.h>
-#include "sortdict.h"
class ClassDef;
class MemberName;
@@ -27,21 +27,27 @@ class MemberName;
/** Data associated with an example. */
struct Example
{
+ Example(const QCString &a,const QCString &n,const QCString &f) : anchor(a), name(n), file(f) {}
QCString anchor;
QCString name;
QCString file;
};
-/** A sorted dictionary of Example objects. */
-class ExampleSDict : public SDict<Example>
+class ExampleList : public std::vector<Example>
{
public:
- ExampleSDict(uint size=17) : SDict<Example>(size) { setAutoDelete(TRUE); }
- ~ExampleSDict() {}
- private:
- int compareValues(const Example *item1,const Example *item2) const
+ bool inSort( const Example& ex )
{
- return qstricmp(item1->name,item2->name);
+ auto it = std::find_if(begin(),end(),[&ex](const Example &e) { return e.name==ex.name; });
+ if (it==end())
+ {
+ insert( std::upper_bound( begin(), end(), ex,
+ [](const auto &e1,const auto &e2) { return e1.name < e2.name; }
+ ), ex
+ );
+ return true;
+ }
+ return false;
}
};