]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - filematch.h
common: Move filematch headers to new filematch.h
[xonotic/darkplaces.git] / filematch.h
diff --git a/filematch.h b/filematch.h
new file mode 100644 (file)
index 0000000..a35fee6
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+Copyright (C) 2006-2021 DarkPlaces contributors
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
+#ifndef FILEMATCH_H
+#define FILEMATCH_H
+
+#include "qtypes.h"
+
+typedef struct stringlist_s
+{
+       /// maxstrings changes as needed, causing reallocation of strings[] array
+       int maxstrings;
+       int numstrings;
+       char **strings;
+} stringlist_t;
+
+int matchpattern(const char *in, const char *pattern, int caseinsensitive);
+int matchpattern_with_separator(const char *in, const char *pattern, int caseinsensitive, const char *separators, qbool wildcard_least_one);
+void stringlistinit(stringlist_t *list);
+void stringlistfreecontents(stringlist_t *list);
+void stringlistappend(stringlist_t *list, const char *text);
+void stringlistsort(stringlist_t *list, qbool uniq);
+void listdirectory(stringlist_t *list, const char *basepath, const char *path);
+
+#endif